With HTTPS, Docker, Digital Ocean, Google Domains
Hasura is an awesome tool to rapidly prototype a back end api. Hasura cloud is a newer product of theirs that allows you to pay for hosting a scalable Hasura instance. I recommend doing that instead of managing your own infrastructure, but I wanted to go through the process anyway and thought I’d share the steps I took.
There are a couple of assumptions in this article. I decided on using Digital Ocean, and I am using google domains for my domain names.
0. Setup/Sign up for digital ocean.
- Create a droplet on Digital Ocean by clicking the green create button in the upper left corner by your account.
2. Select market place and search for
3. You probably want to setup SSK authentication but for the purposes of this demo, let’s use a root password.
4. Click create.
5. Go back to your droplets view, and find the droplet you just created. Click ‘more’ then
add a domain
6. Follow the prompts and enter your domain, you’ll then get a list of records at the bottom of the page. Copy the
A record value, then go to your domain provider.
7. Create a new
A dns record that includes the sub domain you want for example
graphql.yourdomain.com and point it to the copied
A record IP
This should setup your docker container, now you need to setup hasura to run on docker.
0. We’re going to be using this starter: https://github.com/hasura/graphql-engine.git
- ssh into your digital ocean droplet, by opening a new terminal window and typing
ssh root@yourip(you can use
firstname.lastname@example.org the name changes are propogated)
- clone the starter repo with
git clone https://github.com/hasura/graphql-engine.git
- cd into the docker compose https manifest (this sets up https encryption by default)
4. Use a text editor to change the
vim Caddyfile or
nano Caddyfile ) to the following:
essentially this passes all traffic coming into our domain to a reverse proxy that goes to hasura.
change the line with
# HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
# to uncomment, and change
myadminsecretkey to something for your hasura admin.
6. exit vim and run
docker-compose up -d
You’re all set. You can now access your admin console here:
And your endpoint will be
(assuming DNS has finished propogating)
You can go to the console endpoint and just enter that secret key you set earlier.