5

I'm trying to get started with Hasura GraphQL engine running locally on OSX in Docker and connecting to an existing database but I am having trouble finding the container or the Hasura console.

Here's what I have:

docker -v
Docker version 19.03.5, build 633a0ea
docker-compose -v
docker-compose version 1.25.4, build 8d51620a
docker images
hasura/graphql-engine v1.0.0
hasura version
INFO hasura cli version=v1.0.0

Here's my start script (docker-run.sh) which sets up the port and environment variables for Hasura:

#!/bin/bash
docker run -d -p 8080:8080 \
-e HASURA_GRAPHQL_DATABASE_URL=postgres://someuser:somepassword@host.docker.internal:5432/somedb \
-e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
hasura/graphql-engine:latest

Running ./docker-run.sh returns a 64 char hex string, which I assume to be the container ID, but I cannot see a container when I run docker ps, and nothing loads on http://localhost:8080/console.

What am I missing?

UPDATE 1

I can see the container when I run docker ps -a - it has a status of exited(1) (which means application error).

I can see in the logs:

{"path":"$","error":"pgcrypto extension is required, but the current user doesn’t have permission to create it. Please grant superuser permission, or setup the initial schema via https://docs.hasura.io/1.0/graphql/manual/deployment/postgres-permissions.html","code":"postgres-error"}

I have followed the instructions for setting up the initial schema but the result of running ./docker-run.sh has not changed.

UPDATE 2

I did not realise that the pgcrypto extension had to be installed on the specific database. Now that I have done so, the logs look healthy - although I am still unable to access the console when I run hasura console.

Here's my config.yaml:

endpoint: http:localhost:8080

...and the resulting error:

FATA[0001] version check: failed to get version from server: failed making version api call: Get http:localhost:8080/v1/version: http: no Host in request URL

Again, what am I missing?

UPDATE 3

Changed config.yaml...

endpoint: http://localhost:8080

Whoops (blush).

OK, it's working :)

burntsugar
  • 54,120
  • 21
  • 51
  • 77
  • 2
    what's the output of below commands: `docker ps -a ` and `docker logs <64_char_hex_string>`? – BMW Feb 17 '20 at 00:50
  • 2
    Ahh OK, I can see a few entries for Hasura when I run ps -a. The logs show `...pgcrypto extension is required, but the current user doesn’t have permission to create it...` which I will look up next. Thanks! – burntsugar Feb 17 '20 at 00:56
  • So everything is OK now? And the problem was "http://" ? – Alex Yu May 21 '21 at 04:24

0 Answers0