Install Hasura on Dokku

Roger Stringer

Roger Stringer / May 27, 2021

1 min read

Dokku is a handy PaaS service you can run on servers. I have it running on a couple Digital Ocean servers and it works nicely.

I also use Hasura a lot as my graphQL database, so being able to quickly install is very handy.

Here's a little recipe I use to set it up. First, we want to create the app and set up everything we need:

dokku apps:create hasura
dokku domains:add hasura YOURDOMAIN
dokku postgres:create hasura-db
dokku postgres:link hasura-db hasura
dokku proxy:ports-set hasura http:80:8080

This creates the app, and the database, and configures the app to use the env vars specified.

Next, we want to pull the hasura docker image and deploy it:

docker pull hasura/graphql-engine
docker tag hasura/graphql-engine dokku/hasura
dokku tags:deploy hasura

Last step is to set up our SSL certs:

dokku config:set --no-restart hasura DOKKU_LETSENCRYPT_EMAIL=YOU@YOURDOMAIN
dokku letsencrypt:enable hasura

That's it, you now have an hasura instance running, and you can add other instances quickly by making new apps.

To update, you can replace latest with any tag you want:

docker pull hasura/graphql-engine:latest && dokku git:from-image hasura hasura/graphql-engine:latest

Do you like my content?

Sponsor Me On Github