Blazing fast, instant GraphQL APIs on Postgres with fine grained access control (https://hasura.io)
10da5f7a
163.3 MB
6 days ago
485.3M
Name
Layer
Last update
6 days ago
about 1 year ago
about 1 year ago
about 1 year ago
about 1 year ago
about 1 year ago
about 1 year ago
about 1 year ago
about 1 year ago
about 1 year ago
about 1 year ago
6 days ago
about 1 year ago
Readme

Supported tags

  • <version>, latest
  • <version>.cli-migrations-v2, latest.cli-migrations-v2, <version>.cli-migrations-v3, latest.cli-migrations-v3

Quick reference

What is Hasura?

Hasura GraphQL Engine is a blazing-fast GraphQL server that gives you instant, realtime GraphQL APIs over Postgres, with webhook triggers on database events, and remote schemas for business logic.

Hasura helps you build GraphQL apps backed by Postgres or incrementally move to GraphQL for existing applications using Postgres.

Read more at hasura.io and the docs.

Hasura logo

How to use this image

Postgres is a dependency to run Hasura. See instructions for running Postgres at postgres.

Start a Hasura instance

docker run -d -p 8080:8080 \
  -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \
  -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
  hasura/graphql-engine:latest

Hasura Console will be available at http://localhost:8080.

Examples of HASURA_GRAPHQL_DATABASE_URL:

  • postgres://admin:password@localhost:5432/my-db
  • postgres://admin:@localhost:5432/my-db (if there is no password)

Note:

  • If your password contains special characters (e.g. #, %, $, @, etc.), you might need to URL encode them in the HASURA_GRAPHQL_DATABASE_URL env var (e.g. %40 for @).
  • You can check the logs to see if the database credentials are proper and if Hasura is able to connect to the database.
  • Hasura GraphQL engine needs access permissions to your Postgres database as described in Postgres permissions.

Network config

If your Postgres instance is running on localhost, the following changes will be needed to the docker run command to allow the Docker container to access the host’s network:

Linux

Add the --net=host flag to access the host’s Postgres service.

docker run -d --net=host \
  -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \
  -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
  hasura/graphql-engine:latest

Docker for Mac and Windows

Use host.docker.internal as the hostname to access the host’s Postgres service.

docker run -d -p 8080:8080 \
  -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@host.docker.internal:port/dbname \
  -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
  hasura/graphql-engine:latest

Using docker-compose

Example docker-compose.yaml for hasura and postgres:

version: '3.6'
services:
  postgres:
    image: postgres
    restart: always
    volumes:
    - db_data:/var/lib/postgresql/data
  graphql-engine:
    image: hasura/graphql-engine:v1.0.0-beta.6
    ports:
    - "8080:8080"
    depends_on:
    - "postgres"
    restart: always
    environment:
      HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:@postgres:5432/postgres
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
      ## uncomment next line to set an admin secret
      # HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
volumes:
  db_data:

Run docker-compose up, wait for it to initialize completely and visit http://host-ip:8080 or http://localhost:8080 to open the Hasura Console.

License

View license information for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).