- Create Dokku app, link Postgres
- Clone this Template
- Set CI/CD envs in Github repo settings
- Push something to trigger deploy
- Enable Https if required
On your server (where Dokku is installed):
dokku apps:create prefect
dokku config:set prefect POSTGRES_DATABASE_SCHEME=postgresql+asyncpg \
PREFECT_API_URL=https://prefect.yourdomain.com/api
dokku postgres:create prefect
dokku postgres:link prefect prefect -a PREFECT_API_DATABASE_CONNECTION
Read more about Prefect database connection for self-hosted production deployment.
In order to enable Dokku auto deployment after a commit / PR to main branch, you need to set Repo secrets in Github repo's settings:
-
Open Settings -> Secrets and variables -> Actions -> New repository secret
-
Set variables
- SSH_PRIVATE_KEY (
cat .ssh/id_rsa
& copy-paste your key) - DOKKU_HOST (e.g. myserver.dokku.com)
- DOKKU_APP_NAME (e.g. prefect)
dokku letsencrypt:enable prefect
dokku plugin:install https://github.com/dokku/dokku-http-auth.git
dokku http-auth:enable prefect admin admin_password
dokku http-auth:add-allowed-ip app $(curl http://icanhazip.com/)
dokku ps:restart prefect
Don't forget to disable Cloudflare Proxy to allow add-allowed-ip
do its job.