Closed krishkumar closed 6 years ago
@krishkumar,
/
should redirect to /console
. The graphql endpoint is /v1alpha1/graphql
.hasura console --address 0.0.0.0
since the default address is localhost
.Thanks @shahidhk.
$ curl http://172.104.125.25:8080/v1alpha1/graphql {"path":"$","error":"resource does not exist","code":"not-found"}
"Not able to reach the graphql server. Check if hasura console server is running or if graphql server is running and try again"
/v1alpha1/graphql/
only accepts POST requests. curl -d'{"query":""}' http://172.104.125.25:8080/v1alpha1/graphql
throws a correct parsing error. Also, http://172.104.125.25:8080/console should serve the API console if --enable-console
flag is present in docker-compose.yaml
. Can you verify that?
Since you're accessing the console through a non-localhost interface, you need to pass the graphql endpoint also to console. The command will now look like this: hasura console --address 0.0.0.0 --endpoint http://172.104.125.25:8080
.
Ideally you should be running the cli on a client machine, where you've configured the endpoint
to a remote graphql-engine instance in config.yaml
. The cli can be
initialised on a client by executing hasura init --endpoint <remote-graphql-engine-url>
. Then open the console by doing hasura console
docker-compose.yaml looks to have the correct flag.
Makes sense. I am now passing the endpoint the the console command - hasura console --address 0.0.0.0 --endpoint http://172.104.125.25:8080
Curious why this is failing at all. Is there a Hasura logs file I can tail to see what is going on?
As I understand the situation, you're using docker-compose to run postgres and graphl-engine, as mentioned in the docs. But this is running on a virtual machine with a public ip. Correct?
You can run docker logs <container-id>
to see the logs. Use docker ps
to get the container id for graphql enigne.
Is the console accessible by running hasura console
command with the correct flags?
This is a fresh Linode instance with a public ip. Installed postgresql and docker with apt.
Console is still not accessible via browser. Throws this alert - "Not able to reach the graphql server. Check if hasura console server is running or if graphql server is running and try again"
Okay. Here is how you can access the console using hasura cli:
On your local machine (not on the linode machine), install hasura cli.
Then execute the following:
hasura init --endpoint http://172.104.125.25:8080 --directory my-project
cd my-project
hasura console
This will open up the console on your default browser.
Now, to debug console not being served on http://172.104.125.25:8080/console, can you paste me the output of docker ps
?
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c6e541efe4cd hasura/graphql-engine:latest "graphql-engine --da…" 11 minutes ago Up 11 minutes 0.0.0.0:8080->8080/tcp angry_kalam
Ah, okay. So I assume you have not used docker-compose as mentioned in https://docs.hasura.io/1.0/graphql/manual/getting-started/docker-simple.html, but went with the standalone docker run mentioned in https://docs.hasura.io/1.0/graphql/manual/deployment/docker/index.html. Is that correct?
In that case, the console is not available on the server because --enable-console
was not passed to the docker run command. You can confirm this by checking docker inspect <container id>
.
If you want console to be available on the server, please restart the container with the following command:
docker run -d -p 8080:8080 \
hasura/graphql-engine:latest \
graphql-engine \
--database-url postgres://username:password@hostname:port/dbname \
serve --enable-console
Otherwise, your setup is alright and you can continue using console from CLI, by following the steps above.
I recommend adding an access key, since the IP is in a public forum now.
Turns out I did use the standalone docker setup instructions instead of docker compose.
Hasura on my Linode box works fine now. Thanks @shahidhk for all the support and debugging!
No problem @krishkumar. When using the CLI, initialise with hasura init --endpoint http://172.104.125.25:8080 --access-key <access-key> --directory my-project
or add access_key: <access-key>
to an existing config.yaml
Makes sense. I have secured my endpoint by adding a access_key
to config.yaml
.
I setup Hasura, PostgreSQL on my Linux box running Ubuntu 16.04 using the following instructions - https://docs.hasura.io/1.0/graphql/manual/getting-started/docker-simple.html
Two issues -
On accessing the endpoint at http://ip:8080 I get this - {"path":"$","error":"resource does not exist","code":"not-found"}
Hasura console says its running at http://ip:9695 but it does not seem to be running.
Any ideas on what is wrong with my setup?