Coded Geekery


Install Hasura on Dokku

Roger Stringer / May 28, 2021

1 min read––– views

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 config:set hasura HASURA_GRAPHQL_DATABASE_URL="<info from above command>" HASURA_GRAPHQL_ADMIN_SECRET="YOURPASSWORD" HASURA_GRAPHQL_ENABLE_CONSOLE="true" 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

Tagged In:#code#dokku#docker#hasura

Not Playing


Coded Geekery



HomeAbout MeContact Me

© 2022 Roger Stringer. All rights reserved.