Self-host Hasura with Levelrail
An instant GraphQL and REST API on top of Postgres with permissions, subscriptions and an admin console.
- Authorhasura
- LicenceApache-2.0
- Memory512 MiB
- Archarm64
- Services2
How to self-host Hasura
-
Pull the images
2 images are pulled on your server.
Show images
postgres:16-alpinehasura/graphql-engine:v2.51.0
-
Create the app
2 services start in a single Compose app, with 1 named volume mount for your data, on port 8080.
-
Fill in the secrets
4 secrets are generated and stored encrypted, 5 settings are preset, you do not have to fill in anything.
-
Open it
Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.
Hasura requirements
- Memory
- About 512 MiB
- Architectures
- amd64 image published, arm64 image published
- Ports
- 8080
- Domain
- Optional, an sslip.io address is used without one
- Settings
- none to fill in
- License
- Apache-2.0, permissive license
- Listed. It is in the catalog but not verified. Back up the data volume before changing an image tag.
Install Levelrail first
On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then Hasura. New to Levelrail? Install it on a fresh VPS first.
docker pull ghcr.io/glincker/levelrail:latest Then levelrail-cli login --device. See Getting started and the Hasura docs page.
Deploy Hasura your way
Every format below deploys the same pinned images. Pick the one that fits how you work.
Deploy Hasura from the CLI
levelrail-cli templates install hasura --name my-hasura Deploy Hasura with the API
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
https://levelrail.example.com/api/v1/service-templates/hasura/install \
-d '{
"name": "my-hasura"
}' Hasura configuration
Hasura services
| Service | Image | Ports | Volumes |
|---|---|---|---|
| db | postgres:16-alpine | none | pgdata -> /var/lib/postgresql/data |
| hasura | hasura/graphql-engine:v2.51.0 | 8080 | none |
Hasura environment variables
| Variable | Service | Value |
|---|---|---|
| POSTGRES_DB | db | Preset by the template |
| POSTGRES_PASSWORD | db | Generated at deploy |
| POSTGRES_USER | db | Preset by the template |
| HASURA_GRAPHQL_ADMIN_SECRET | hasura | Generated at deploy |
| HASURA_GRAPHQL_DEV_MODE | hasura | Preset by the template |
| HASURA_GRAPHQL_ENABLED_LOG_TYPES | hasura | Preset by the template |
| HASURA_GRAPHQL_ENABLE_CONSOLE | hasura | Preset by the template |
| HASURA_GRAPHQL_METADATA_DATABASE_URL | hasura | Generated at deploy |
Show all 9 variables
- PG_DATABASE_URLhasuraGenerated at deploy
Ports and volumes
- Ports
- 8080
- Volumes
- 1 named mount: pgdata -> /var/lib/postgresql/data
Hasura FAQ
How much memory does Hasura need?
The catalog lists about 512 MiB of memory for Hasura across its 2 services.
Does Hasura run on arm64?
For Hasura, an arm64 image is published; amd64 is image published.
What licence is Hasura under?
Hasura is licensed under Apache-2.0, which is permissive, with few conditions on reuse.
Does Hasura need configuration before it starts?
No. The template fills in its own defaults and generates secrets at deploy time.
Which database does Hasura bundle?
The template includes Postgres, running as its own service.
Which ports does Hasura use?
Hasura listens on port 8080 inside the stack.
Where does Hasura keep its data?
In a named volume: pgdata mounted at /var/lib/postgresql/data.
Can I deploy Hasura on Dokploy or Dokku?
The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Hasura, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image postgres:16-alpine, hasura/graphql-engine:v2.51.0 is what you deploy there.