Files
padelnomics/padelnomics/.env.example
Deeman c0c8607664 fix: migration atomicity + deploy hardening + Litestream R2
Migration atomicity:
- Remove conn.commit() and executescript() from all up() functions (0000,
  0011, 0012, 0013, 0014, 0015); executescript() issued implicit COMMITs
  which broke the batch-rollback guarantee of the migration runner
- Rewrite 0000 with individual conn.execute() calls (was a single
  executescript block)

Deploy hardening:
- Add pre-migration DB backup step to deploy.sh: saves
  app.db.pre-deploy-<timestamp> in the volume before every migration
- On health-check failure: restore the backup, then stop + exit
- On success: clean up old backups (keep last 3)

Litestream:
- Enable R2 as primary replica in litestream.yml (env-var placeholders)
- Add local /app/data/backups as secondary replica
- docker-compose: add auto-restore on empty volume (sh entrypoint runs
  'litestream restore' before 'litestream replicate' if app.db missing)
- Add LITESTREAM_R2_* vars to .gitlab-ci.yml .env block and .env.example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 10:28:59 +01:00

63 lines
2.1 KiB
Plaintext

# App
APP_NAME=Padelnomics
SECRET_KEY=change-me-generate-a-real-secret
BASE_URL=http://localhost:5000
DEBUG=true
# Admin access — comma-separated emails that get the admin role on login
ADMIN_EMAILS=dev@localhost
# Database
DATABASE_PATH=data/app.db
# Auth
MAGIC_LINK_EXPIRY_MINUTES=15
SESSION_LIFETIME_DAYS=30
# Email (Resend)
# Leave blank for dev — emails print to console (no Resend account needed).
#
# Resend test addresses (work with any valid API key, no verified domain needed):
# delivered@resend.dev — accepted, simulates successful delivery
# bounced@resend.dev — simulates a hard bounce
# complained@resend.dev — simulates a spam complaint
# suppressed@resend.dev — simulates a suppressed recipient
# These support +label syntax: delivered+test1@resend.dev
# You can also send FROM onboarding@resend.dev without a verified domain.
#
# Dev login shortcut (no email needed): /auth/dev-login?email=dev@localhost
RESEND_API_KEY=
EMAIL_FROM=hello@padelnomics.io
LEADS_EMAIL=leads@padelnomics.io
# Waitlist mode — set to true to gate routes and capture emails before launch.
# Resend audiences are created automatically per blueprint (waitlist-auth,
# waitlist-suppliers, etc.) on first signup — no audience IDs needed.
WAITLIST_MODE=false
# Optional: Resend audience ID for the planner/export waitlist (legacy, manual)
RESEND_AUDIENCE_PLANNER=
# Paddle — leave blank to skip checkout (overlay won't initialize)
# Run `uv run python -m padelnomics.scripts.setup_paddle` to create products
# and a webhook notification destination. It writes PADDLE_WEBHOOK_SECRET and
# PADDLE_NOTIFICATION_SETTING_ID here automatically.
PADDLE_API_KEY=
PADDLE_CLIENT_TOKEN=
PADDLE_WEBHOOK_SECRET=
PADDLE_NOTIFICATION_SETTING_ID=
PADDLE_ENVIRONMENT=sandbox
# Umami — leave blank for dev (analytics tracking disabled)
UMAMI_API_URL=https://umami.padelnomics.io
UMAMI_API_TOKEN=
# Rate limiting
RATE_LIMIT_REQUESTS=100
RATE_LIMIT_WINDOW=60
# Litestream R2 backup — leave blank to skip R2 replication (local-only backup)
LITESTREAM_R2_BUCKET=
LITESTREAM_R2_ACCESS_KEY_ID=
LITESTREAM_R2_SECRET_ACCESS_KEY=
LITESTREAM_R2_ENDPOINT=