Running GraphSchema

I am running dgraph from a ubuntu box on my home network. I can access DGraph from a browser on a windows machine on the same network at http://192.168.0.200:8080/.

I’m trying to work through this: Running GraphSchema · MichaelJCompton/GraphSchemaTools Wiki · GitHub

The docs state “current version of GraphSchema was tested against Dgraph v1.0.13”. I don’t know how to determine the version of Dgraph I have.

I’m hung up at " Initialise the database"

I’m using the helper script:
./graphschema.sh init-dgraph --schema-file AuthorPosts.graphql --dgraph-alpha “<alpha-addr>:<alpha-grpc-port>” --force --verbose

I’ve tried several addresses to no avail
0.0.0.0:8080 and 127.0.0.1:8080 return Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail=“Connect Failed”)

host.docker.internal:8080 returns StatusCode=Unavailable, Detail="Name resolution failure

192.168.0.200:8080 returns StatusCode=Unavailable, Detail="Trying to connect an http1.x server

I’m missing something here. Any help is appreciated.

Hi, thanks for getting in touch.

Glad you have looked at GraphSchema.

GraphSchema connects to Dgraph via grpc, so you won’t be able to do connect to Dgraph over HTTP. You’d need to know the grpc port of the instance you want to connect to.

It’s no longer under active development. We are working on GraphQL support in Dgraph. If it’s GraphQL you want then that’s going to be the right thing to use. Is there a reason you need to connect over HTTP? That isn’t built in our GraphQL yet, maybe it’s something we should consider.

Sorry, Michael I don’t understand the question about connecting over http. I was just following your instructions and received the errors I noted after I ran your script. My understanding of all this is very limited I’m afraid.

No probs.

Dgraph has two ways to connect to it: HTTP and gRPC. As in it exposes two ports: normally HTTP is exposed at 8080 and gRPC at 9080. That’s mostly so two different types of clients can connect. HTTP being for ‘web traffic’ type clients and gRPC for things like go/java/etc programs.

GraphSchema is C# program that tries to dial Dgraph on its gRPC port. So to use it, you’d need to make sure that you also expose the gRPC port and then you can connect with that.

There’s info in the Dgraph docs about that https://docs.dgraph.io/deploy/#ports-usage … but mostly if you’ve just started Dgraph with no other options, you probably have the gRPC port at 9080.

docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0db23b071192 dgraph/dgraph:latest “dgraph alpha --my=s…” 2 weeks ago Up 2 days 0.0.0.0:8080->8080/tcp, 0.0.0.0:9080->9080/tcp fatwebo_server_1

f6085dd5f2b1 dgraph/dgraph:latest “dgraph-ratel” 2 weeks ago Up 2 days 8080/tcp, 0.0.0.0:8000->8000/tcp, 9080/tcp fatwebo_ratel_1

10bfd87eb108 dgraph/dgraph:latest “dgraph zero --my=ze…” 2 weeks ago Up 2 days 0.0.0.0:5080->5080/tcp, 8080/tcp, 0.0.0.0:6080->6080/tcp, 9080/tcp fatwebo_zero_1

what port should I use in your helper script? “<alpha-addr>:<alpha-grpc-port>”

./graphschema.sh init-dgraph --schema-file AuthorPosts.graphql --dgraph-alpha “<alpha-addr>:<alpha-grpc-port>” --force --verbose

That container’s 9080 port looks right.

Ok, so I run the script with that port:

rchevalier@icollect:~/GraphSchemaTools/GraphSchema.Examples/AuthorPosts$ ./graphschema.sh init-dgraph --schema-file AuthorPosts.graphql --dgraph-alpha “0.0.0.0: 8080” --force --verbose

This is returned…

Installing schema file /data/AuthorPosts.graphql into Dgraph alpha “0.0.0.0:8080”.
Reading /data/AuthorPosts.graphql.
Preparing schema.
Generating Dgraph schema.
Connecting to Dgraph “0.0.0.0:8080”.
Error executing GraphSchema command.
Last caught error is (other errors may have been logged) :
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> Grpc.Core.RpcException: Status(StatusCode=Unavailabl e, Detail=“Name resolution failure”)
at Grpc.Core.Internal.AsyncCall2.UnaryCall(TRequest msg) at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request)
at Grpc.Core.Interceptors.InterceptingCallInvoker.b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext2 ctx) at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorC ontext2 context, BlockingUnaryCallContinuation2 continuation) at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request)
at Api.Dgraph.DgraphClient.CheckVersion(Check request, CallOptions options)
at Api.Dgraph.DgraphClient.CheckVersion(Check request, Metadata headers, Nullable1 deadline, CancellationToken cancellationToken) at DgraphDotNet.GRPCConnection.CheckVersion() at DgraphDotNet.DgraphClient.CheckVersion() at GraphSchema.Commands.InitDgraphCommand.OnExecute(CommandLineApplication app) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments) in C:\projects\com mandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 86 at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) in C:\projects\commandlineutils\src\CommandL ineUtils\Conventions\ExecuteMethodConvention.cs:line 64 at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() in C:\projects\commandlineutils\sr c\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 25 --- End of stack trace from previous location where exception was thrown --- at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass126_0.<OnExecute>b__0() in C:\projects\commandlineutils\src\CommandLineUtils\ CommandLineApplication.cs:line 505 at GraphSchema.Program.Main(String[] args) Error executing GraphSchema command. Arguments were "init-dgraph --schema-file /data/AuthorPosts.graphql --dgraph-alpha “0.0.0.0:8080” --force --verbose" Last caught exception (other errors may have been logged). System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Grpc.Core.RpcException: Status(StatusCode=Unavailabl e, Detail="Name resolution failure") at Grpc.Core.Internal.AsyncCall2.UnaryCall(TRequest msg)
at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request) at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext2 ctx)
at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorC ontext2 context, BlockingUnaryCallContinuation2 continuation)
at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request) at Api.Dgraph.DgraphClient.CheckVersion(Check request, CallOptions options) at Api.Dgraph.DgraphClient.CheckVersion(Check request, Metadata headers, Nullable1 deadline, CancellationToken cancellationToken)
at DgraphDotNet.GRPCConnection.CheckVersion()
at DgraphDotNet.DgraphClient.CheckVersion()
at GraphSchema.Commands.InitDgraphCommand.OnExecute(CommandLineApplication app)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object arguments) in C:\projects\com mandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 86
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) in C:\projects\commandlineutils\src\CommandL ineUtils\Conventions\ExecuteMethodConvention.cs:line 64
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<b__0>d.MoveNext() in C:\projects\commandlineutils\sr c\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 25
— End of stack trace from previous location where exception was thrown —
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass126_0.b__0() in C:\projects\commandlineutils\src\CommandLineUtils\ CommandLineApplication.cs:line 505
at GraphSchema.Program.Main(String args)

Ooops sorry, I used port 8080. When I use 9080 the same result is returned.

From your first post, looks like that container is reachable at 192.168.0.200:9080, not 0.0.0.0:9080.

Sadly, I get the same result.

rchevalier@icollect:~/GraphSchemaTools/GraphSchema.Examples/AuthorPosts$ ./graphschema.sh init-dgraph --schema-file AuthorPosts.graphql --dgraph-alpha “192.168.0.200:9080” --force --verbose
Installing schema file /data/AuthorPosts.graphql into Dgraph alpha 192.168.0.200:9080.
Reading /data/AuthorPosts.graphql.
Preparing schema.
Generating Dgraph schema.
Connecting to Dgraph 192.168.0.200:9080.
Error executing GraphSchema command.
Last caught error is (other errors may have been logged) :
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail=“Connect Failed”)
at Grpc.Core.Internal.AsyncCall2.UnaryCall(TRequest msg) at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request)
at Grpc.Core.Interceptors.InterceptingCallInvoker.b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext2 ctx) at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorContext2 context, BlockingUnaryCallContinuation2 continuation) at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request)
at Api.Dgraph.DgraphClient.CheckVersion(Check request, CallOptions options)
at Api.Dgraph.DgraphClient.CheckVersion(Check request, Metadata headers, Nullable1 deadline, CancellationToken cancellationToken) at DgraphDotNet.GRPCConnection.CheckVersion() at DgraphDotNet.DgraphClient.CheckVersion() at GraphSchema.Commands.InitDgraphCommand.OnExecute(CommandLineApplication app) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 86 at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 64 at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 25 --- End of stack trace from previous location where exception was thrown --- at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass126_0.<OnExecute>b__0() in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.cs:line 505 at GraphSchema.Program.Main(String[] args) Error executing GraphSchema command. Arguments were "init-dgraph --schema-file /data/AuthorPosts.graphql --dgraph-alpha 192.168.0.200:9080 --force --verbose" Last caught exception (other errors may have been logged). System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Connect Failed") at Grpc.Core.Internal.AsyncCall2.UnaryCall(TRequest msg)
at Grpc.Core.DefaultCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request) at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext2 ctx)
at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorContext2 context, BlockingUnaryCallContinuation2 continuation)
at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request) at Api.Dgraph.DgraphClient.CheckVersion(Check request, CallOptions options) at Api.Dgraph.DgraphClient.CheckVersion(Check request, Metadata headers, Nullable1 deadline, CancellationToken cancellationToken)
at DgraphDotNet.GRPCConnection.CheckVersion()
at DgraphDotNet.DgraphClient.CheckVersion()
at GraphSchema.Commands.InitDgraphCommand.OnExecute(CommandLineApplication app)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object arguments) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 86
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 64
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<b__0>d.MoveNext() in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 25
— End of stack trace from previous location where exception was thrown —
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass126_0.b__0() in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.cs:line 505
at GraphSchema.Program.Main(String args)

The error simply says that it can’t connect to Dgraph, so the problem is in working out where the right port is.

Looking at this, did we miss something ? why is port 8080 available to you externally and not 9080?

I’ll get someone else to pass some eyes over it to see what we are missing.

You can run dgraph version in the container. The beginning of the log output also prints out the Dgraph version, so you can check the version from there too.

If you can share the config you’re using to run the Dgraph cluster, that might reveal the issue in the config. As @michaelcompton wrote earlier, it looks like a connection issue for port 9080.

Daniel also pointed out that GraphSchema was compatible with Dgraph v1.0.14, so it might not work if you are running a more recent Dgraph version (e.g. v1.1 made some breaking changes to grpc API).

As I said earlier, GraphSchema isn’t under active development any more, but we are building a simlar thing into Dgraph. That’s not 100% ready for release, but does work. We don’t build a container image for it, but I’d be more than happy to look at what you want to use it for and see if it will work for you.

Thanks for the replies fellas. I’m on a camping trip for a few days so I won’t be able to try them till Tuesday.

docker-compose.yml

version: “3.2”
services:
zero:
image: dgraph/dgraph:latest
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- 5080:5080
- 6080:6080
restart: on-failure
command: dgraph zero --my=zero:5080
server:
image: dgraph/dgraph:latest
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- 8080:8080
- 9080:9080
restart: on-failure
command: dgraph alpha --my=server:7080 --lru_mb=2048 --zero=zero:5080
ratel:
image: dgraph/dgraph:latest
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- 8000:8000
command: dgraph-ratel

volumes:
dgraph:

Won’t work with GraphSchema.

Dgraph’s native GraphQL support is nearly out. Would you like to try that instead?

“nearly out” could you be more specific? Days, weeks, months?
Will it support recursive queries? Recursive queries are a must have for my application.

weeks. Sometime around end of October is the current plan.

It doesn’t have recurse queries at the moment, but it’s something that we should be able support on a directive in a similar way to how Dgraph does. I’ll put up a ticket for us to look at it.

Thanks very much for your efforts fellas. My skills and resources are very limited so DGraph is not a good choice for me at this time. I will find a graph db that has already been integrated with Laravel.