Jon Atkinson

Jon Atkinson

title: "Dokku Cheatsheet" date: 2020-07-12 16:09:06.111000+00:00

I always forget how to setup new Dokku apps; I do it infrequently enough that it never sticks.

Create the app:

$ ssh host
$ dokku apps:create myapp

Create the database and link it to the app:

$ dokku mysql:create myapp
$ dokku mysql:link myapp myapp

Set some variables. DEBUG and SECRET_KEY are Django-specific, and the other is for SSL provisioning:

$ dokku config:set --no-restart myapp SECRET_KEY=foo
$ dokku config:set --no-restart myapp DEBUG=True
$ dokku config:set --no-restart myapp [email protected]

Now, on the localhost, setup the repository and push:

$ git remote add dokku dokku@host:myapp
$ git push dokku master

Finally, back on the live server, setup port forwarding (I'm not 100% sure if this is necessary, and note that I run gunicorn on port 8000 in my containers), and SSL:

$ ssh host
$ dokku proxy:ports-add myapp http:80:8000
$ dokku letsencrypt myapp
$ dokku letsencrypt:cron-job --add