Skip to content

Deployment

The app is deployed on Heroku with a PostgreSQL add-on. Documentation is hosted on GitHub Pages via MkDocs.


Heroku

Why Heroku

Heroku's Basic dyno tier runs continuously — there is no cold start when players open the app in the morning. The Heroku Postgres add-on provides a managed PostgreSQL database with automatic backups.

Prerequisites

  • A Heroku account
  • The Heroku CLI installed
  • The repository pushed to GitHub

Initial setup

# Log in to Heroku
heroku login

# Create the app
heroku create your-app-name

# Add the Postgres add-on
heroku addons:create heroku-postgresql:essential-0

Heroku automatically sets a DATABASE_URL environment variable when the Postgres add-on is attached.

Procfile

The repository must contain a Procfile at the root to tell Heroku how to start the app:

web: streamlit run main.py --server.port=$PORT --server.address=0.0.0.0

Environment variables

Streamlit reads secrets from environment variables on Heroku. Set the database URL as a config var:

heroku config:set DATABASE_URL=$(heroku config:get DATABASE_URL)

The get_engine() function in database.py reads from st.secrets["database"]["postgres_url"] locally and falls back to the DATABASE_URL environment variable on Heroku.

Deploy

git push heroku main

Verify

heroku logs --tail
heroku open

GitHub Pages (Documentation)

The documentation is published automatically to GitHub Pages whenever a commit is pushed to the main branch, via a GitHub Actions workflow.

First-time setup

Enable GitHub Pages in your repository settings:

  1. Go to Settings → Pages
  2. Set Source to gh-pages branch
  3. Save

The gh-pages branch is created and maintained automatically by the workflow — you never push to it manually.

GitHub Actions workflow

The workflow file lives at .github/workflows/deploy-docs.yml. It installs MkDocs, builds the site, and pushes it to the gh-pages branch on every push to main.

Your docs will be available at:

https://your-username.github.io/player_wellness_registration/

Preview locally before pushing

mkdocs serve

This starts a live-reloading preview at http://localhost:8000. Always preview locally before pushing to confirm formatting and navigation look correct.

Build without serving

mkdocs build

This generates the static site in a site/ directory. The site/ directory is excluded from version control via .gitignore.