This section is a work-in-progress and outlines issues that arise during or relate to deployment. The main assumption is that we are deploying to Dokku PaaS.
Configure the initial Dokku app and database with the following commands.
- create app
dokku apps:create caregiving-app
- configure app domain
sudo dokku domains:add caregiving-app <example.com>
- set
DJANGO_ALLOWED_HOSTS
to include app domaindokku config:set caregiving-app DJANGO_ALLOWED_HOSTS=<example.com>
- set
DJANGO_CSRF_TRUSTED_ORIGINS
to include app domain with scheme (e.g., https://)dokku config:set caregiving-app DJANGO_CSRF_TRUSTED_ORIGINS=<https://example.com>
Enable HTTPS support with the following commands on the Dokku server.
- install Let's Encrypt
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
- configure Let's Encrypt email
dokku config:set --no-restart --global DOKKU_LETSENCRYPT_EMAIL=<user@email.com>
- enable Let's Encrypt for app
dokku letsencrypt:enable caregiving-app
- auto-update Let's Encrypt certificate
dokku letsencrypt:cron-job --add
'dokku letsencrypt:auto-renew caregiving-app
- install Postgres plugin
dokku plugin:install https://github.com/dokku/dokku-postgres.git
- create Postgres DB
dokku postgres:create caregiving-db
- link DB to app
dokku postgres:link caregiving-db caregiving-app
Now that the Dokku app and database are configured, push code from a local computer to the Dokku server.
- add Git remote on local computer
git remote add dokku dokku@<dokku_server>:caregiving-app
- push changes to
dokku
remotegit push dokku main:main
The following commands will need to be run from within the Dokku app. Use the following command on the Dokku server to enter the app.
dokku enter caregiving-app
For now, database migrations need to be run manually, until a post deployment task is configured. Run the database migrations with the following command.
python manage.py migrate
Create an initial superuser on the deployed app with the following command.
python manage.py createsuperuser
Follow the prompts to create the initial superuser.