Skip to content

Latest commit

 

History

History
33 lines (31 loc) · 2.01 KB

Dokku.md

File metadata and controls

33 lines (31 loc) · 2.01 KB

Dokku Setup

This a basic step by step how to deploy this app on a Dokku instance

  1. 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
  1. Create a new app dokku apps:create backend-staging
  2. Create a new Postgres database dokku postgres:create staging-db
  3. Link the new db with the app dokku postgres:link staging-db backend-staging
  4. Create a new RabbitMQ service dokku rabbitmq:create staging-store
  5. Link the new store with the app dokku rabbitmq:link staging-store backend-staging
  6. 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 or app.settings.staging)
  • SMS_GATEWAY_TOKEN
  • EMAIL_HOST
  • EMAIL_HOST_PASSWORD
  • EMAIL_HOST_USER
  • WORKER_QUEUE
  1. Deploy the app once.
  2. 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
  1. 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
  1. 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