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:
Environment variables
Streamlit reads secrets from environment variables on Heroku. Set the database URL as a config var:
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
Verify
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:
- Go to Settings → Pages
- Set Source to
gh-pagesbranch - 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:
Preview locally before pushing
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
This generates the static site in a site/ directory. The site/ directory is excluded from version control via .gitignore.