Environment setup and E2E tests

This guide explains how to set up dev, test, qa, and prod environments and how to run end-to-end (E2E) tests against them. It is for system administrators who deploy Rediflow and for developers who verify deployments.

Environments overview

Environment APP_ENV Config Use case
dev dev .env.dev Local development
test test .env.test Automated tests (unit, integration, E2E)
qa qa .env.qa QA / staging before production
prod prod .env.prod Production

Each environment uses its own .env file and, when using containers, its own compose profile or file. See Configuration for load order and variable reference.

Prerequisites

  • Podman (or Docker) with podman compose
  • PostgreSQL 18+ — always containerised; no SQLite
  • uv — for running Python scripts (or equivalent)

Dev environment

For local development:

  1. Copy .env.dev.example to .env.dev and set DATABASE_URL, SECRET_KEY.

  2. Start the database and app:

    make up-db
    make migrate
    make up
    

    Or with Podman: podman compose --profile dev up -d

  3. Open http://localhost:5000

See Podman install and Configuration for details.

Test environment

The test environment is used for automated unit, integration, and E2E tests. It runs on port 5002 and can include Authentik for identity tests.

  1. Copy .env.test.example to .env.test and set DATABASE_URL (e.g. postgresql://rediflow:rediflow@localhost:15433/rediflow), SECRET_KEY, and optionally AUTHENTIK_BOOTSTRAP_TOKEN.

  2. Ensure docs/example.ods exists (required for seed).

  3. Run the full test suite:

    make test-e2e-test
    

This target:

  • Starts db, redis, and optionally Authentik
  • Runs migrations and RLS setup
  • Seeds the Example project
  • Runs unit and integration tests
  • Starts the app (container or local fallback)
  • Runs E2E browser tests (Playwright)

Prerequisites for make test-e2e-test: .env.test, docs/example.ods, podman compose. Optional: ts (from moreutils) for timestamped logs when redirecting output.

E2E against an already-running app: If the app is already running (e.g. on port 5002), set LIVE_URL=http://localhost:5002 and run:

make test-e2e

QA environment

For QA or staging before production:

  1. Copy .env.qa.example to .env.qa and set POSTGRES_PASSWORD, SECRET_KEY, and any OIDC variables.

  2. Start the stack:

    podman compose -f compose.deploy-qa.yml up -d
    
  3. Run migrations:

    podman compose -f compose.deploy-qa.yml run --rm app-qa rediflow migrate head
    
  4. (Optional) Seed calendars and projects. See Seed projects and calendars.

App at http://localhost:5001.

Running E2E against QA: Set LIVE_URL=http://localhost:5001 and run make test-e2e (or uv run pytest tests/e2e -v -m e2e). Ensure the app is healthy and reachable first; see QA verification.

Production environment

For production:

  1. Copy .env.prod.example to .env.prod and set strong POSTGRES_PASSWORD, SECRET_KEY, and any OIDC variables.

  2. Start the stack:

    podman compose -f compose.deploy-prod.yml up -d
    
  3. Run migrations:

    podman compose -f compose.deploy-prod.yml run --rm app-prod rediflow migrate head
    
  4. (Optional) Seed calendars and projects. See Seed projects and calendars.

App at http://localhost:5000.

E2E on production: Generally not recommended. Use QA for pre-release verification. If you must run E2E against prod, set LIVE_URL to your prod URL and run make test-e2e — ensure tests are read-only or use a dedicated test project.

E2E test summary

Command When to use
make test-e2e-test Full automated run: starts test stack, seeds, runs unit + integration + E2E
make test-e2e E2E only; app must already be running; set LIVE_URL to app URL

E2E tests require a running app with seeded data (e.g. Example project). Tests are skipped if LIVE_URL is not set or the app is not reachable.

See also