Files
TimeTracker/docs/deploy/RENDER.md
T
Dries Peeters a6b60b16dd feat: Render deployment and demo mode for single-user demo
- Add render.yaml Blueprint: PostgreSQL + Python web service, auto-deploy on push
- Add demo mode (DEMO_MODE, DEMO_USERNAME, DEMO_PASSWORD): single fixed user only
- Login page shows demo credentials when demo mode is active
- Disable self-registration, admin user creation, and OIDC user creation in demo mode
- DB init creates demo user with password when DEMO_MODE is true
- Add docs/deploy/RENDER.md with deployment and demo mode instructions
2026-02-16 20:34:32 +01:00

3.5 KiB
Raw Blame History

Deploy TimeTracker on Render

This guide explains how to host TimeTracker as a Web Service on Render with optional demo mode (single user, credentials shown on the login page).

Prerequisites

  • A Render account
  • This repository connected to your GitHub (or GitLab) account

Deploy with the Blueprint

  1. In the Render Dashboard, click NewBlueprint.
  2. Connect your Git provider and select the TimeTracker repository.
  3. Render will detect the render.yaml in the repository root.
  4. Review the blueprint: it creates one PostgreSQL database and one Web Service.
  5. Click Apply to create the database and deploy the app.

After the first deploy, every push to the connected branch will trigger a new build and deploy (auto-updates on push).

Environment variables

The blueprint sets:

  • FLASK_ENV: production
  • FLASK_APP: app:create_app() (used for flask db upgrade in the release step)
  • SECRET_KEY: Auto-generated by Render (recommended; you can override in the Dashboard)
  • DATABASE_URL: Filled automatically from the linked PostgreSQL database
  • AUTH_METHOD: local (username/password login)
  • REDIS_ENABLED: false (rate limiting uses in-memory storage; no Redis required for demo)

Demo mode (single-user demo)

To run a demo instance where only one user can log in and the credentials are shown on the login page:

  1. In the Render Dashboard, open your timetracker web service.
  2. Go to Environment and add (or uncomment in render.yaml and redeploy):
    • DEMO_MODE: true
    • DEMO_USERNAME: demo (or any username you want)
    • DEMO_PASSWORD: Set a strong password (use a Secret so it is not visible in the dashboard to others)
  3. Redeploy the service.

In demo mode:

  • Only the user with DEMO_USERNAME can log in.
  • The login page shows the demo username and password.
  • Self-registration and admin user creation are disabled; OIDC cannot create new users.
  • The demo user is created automatically on first run if it does not exist.

Security: Use a strong DEMO_PASSWORD for any public demo. Do not use DEMO_MODE=true for production multi-user deployments.

Optional: Run without the Blueprint

If you prefer to create the database and web service manually:

  1. Create a PostgreSQL database and note the Internal Database URL (or External if your app runs elsewhere).
  2. Create a Web Service, connect the repo, and set:
    • Build Command: pip install -r requirements.txt && npm ci && npm run build:docker
    • Start Command: gunicorn --bind 0.0.0.0:$PORT --worker-class eventlet --workers 1 --timeout 120 "app:create_app()"
    • Release Command: flask db upgrade
  3. In Environment, set FLASK_APP to app:create_app(), DATABASE_URL to the Postgres URL, SECRET_KEY, and any demo-mode variables as above.

Troubleshooting

  • Migrations: The release command runs flask db upgrade. If it fails, check that FLASK_APP is set to app:create_app() and that DATABASE_URL is set and reachable from Render.
  • Build: The build installs Python dependencies and compiles Tailwind CSS. If npm run build:docker fails, ensure package.json and app/static/src/input.css are in the repo.
  • Database URL: Renders PostgreSQL URL is usually in postgres:// form; the app uses postgresql+psycopg2. If you see connection errors, try setting DATABASE_URL to the same URL with the scheme changed to postgresql:// (Render may also provide a direct URL in the database dashboard).