This a basic step by step how to deploy this app on a Dokku instance
- Install the required plugins:
- Postgres
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
- RabbitMQ
sudo dokku plugin:install https://github.com/dokku/dokku-rabbitmq.git
- Let's Encrypt
sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
- Create a new app
dokku apps:create backend-staging
- Create a new Postgres database
dokku postgres:create staging-db
- Link the new db with the app
dokku postgres:link staging-db backend-staging
- Create a new RabbitMQ service
dokku rabbitmq:create staging-store
- Link the new store with the app
dokku rabbitmq:link staging-store backend-staging
- Configure environment variables
dokku --app backend-staging config:set [KEY]=[VALUE]
- DJANGO_SECRET_KEY (A new one can be generated with
tr -dc A-Za-z0-9 </dev/urandom | head -c 48
) - DJANGO_SETTINGS_MODULE (
app.settings.prod
orapp.settings.staging
) - SMS_GATEWAY_TOKEN
- EMAIL_HOST
- EMAIL_HOST_PASSWORD
- EMAIL_HOST_USER
- WORKER_QUEUE
- Deploy the app once.
- Setup Let's Encrypt (Optional, but VERY recommended)
- Add email as a global variable
dokku config:set --global DOKKU_LETSENCRYPT_EMAIL=domain@tld.com
- Run configuration command
dokku letsencrypt backend-staging
- Setup logging service to Papertrail (Optional, but recommended)
- Install Logspout plugin
dokku plugin:install https://github.com/michaelshobbs/dokku-logspout.git
- Go to Papertrail and add a new system
- Configure the logspout logspout at /home/dokku/.logspout/OPTS
With a new line:
export DOKKU_LOGSPOUT_SYSLOG_SERVER=syslog+tls://YOU-PAPERTRAIL-URL
- Setup database backup service to Amazon Bucket (Optional, but VERY recommended)
- dokku postgres:backup-auth staging-db aws-access-key-id aws-secret-access-key
- dokku postgres:backup-schedule db "0 3 * * *" bucket-name