hasura/graphql-engine

By hasura

Updated 5 days ago

Blazing fast, instant GraphQL APIs on Postgres with fine grained access control (https://hasura.io)

Image
131

500M+

hasura/graphql-engine repository overview

Important notice

On 7th Dec 2022 10:00 AM PST, Hasura removed certain images that were impacted by a security vulnerability from this repository to prevent them being run in production. We encourage anyone who is impacted update to a patched version immediately.

More details can be found on this security advisory: https://github.com/hasura/graphql-engine/security/advisories/GHSA-g7mj-g7f4-hgrg

Affected versionsPatched version
v2.15.1, v2.15.0v2.15.2
v2.14.0v2.14.1
v2.13.1, v2.13.0v2.13.2
v2.12.0v2.12.1
v2.11.2, v2.11.1, v2.11.0v2.11.3
v2.10.1, v2.10.0v2.10.2

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.
  • The Hasura GraphQL Engine collects anonymous telemetry to understand usage and provide the best experience. Read more here on what data is collected and the procedure to opt out.
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:[email protected]: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

The hasura/graphql-engine image includes both open-source and proprietary components. The open source portions are licensed under the Apache License, Version 2.0. The proprietary components include features for Hasura Enterprise and are enabled with a license key provided by Hasura. If you would like to use an image with only the open source components, please use Docker images on this page that end with -ce. (example: hasura/graphql-engine:<VERSION>-ce)

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).

Tag summary

Content type

Image

Digest

sha256:d7cb0d7f1

Size

178.3 MB

Last updated

5 days ago

Requires Docker Desktop 4.37.1 or later.