Files
scha/.env.prod.example
westfarn 42418fd123
Unit Tests / test (push) Successful in 3s
Dockerize scha + Gitea CI/CD auto-deploy via server-infra (#21)
## Summary
- Dockerize SCHA Wheaton (uv packaging, Dockerfile, compose, entrypoint) and move secrets/DB config to env-driven `scha/settings/`.
- Add Gitea Actions: unit tests on push/PR to `master`, auto-deploy on green master push via `server-infra/scripts/deploy.sh --app scha --env prod`.
- Prod compose uses shared external Postgres only (no bundled DB); control-node secret template at `.env.prod.example`.

Closes #19 (Part A). Depends on companion server-infra PR for catalog/host_apps registration.

## Test plan
- [ ] `uv sync --frozen` + `DJANGO_ENV=dev DJANGO_SECRET_KEY=test uv run python manage.py check`
- [ ] `docker compose build` succeeds locally
- [ ] `docker compose up` serves app against bundled Postgres
- [ ] `./scripts/validate-env.sh ~/Documents/secrets/scha/scha_prod.env` passes
- [ ] After merge + server-infra catalog live: push to master runs Unit Tests then Deploy

Reviewed-on: #21
2026-07-14 03:12:35 -07:00

54 lines
2.4 KiB
Bash

# Server-side secrets for server-infra deploy.
# Copy to the control node (never commit):
# ~/Documents/secrets/scha/scha_prod.env
# ~/Documents/secrets/scha/scha_beta.env (optional)
#
# server-infra pushes these to /opt/apps/env/scha_<env>.env on each host at deploy time.
#
# Docker Compose: if a secret contains $ (e.g. in DATABASE_URL password), escape each
# $ as $$ or compose will treat $word as a variable (see "pqv1n variable is not set").
# =============================================================================
# PROD template — ports/hosts for production
# =============================================================================
DJANGO_ENV=prod
DJANGO_DEBUG=false
DJANGO_SECRET_KEY=replace-with-a-long-random-secret
DJANGO_ALLOWED_HOSTS=schawheaton.aimloperations.com,www.schawheaton.aimloperations.com,schawheaton.com,www.schawheaton.com
# Optional override; when unset, https:// origins are derived from DJANGO_ALLOWED_HOSTS.
# DJANGO_CSRF_TRUSTED_ORIGINS=https://schawheaton.aimloperations.com,https://www.schawheaton.aimloperations.com,https://schawheaton.com,https://www.schawheaton.com
# Logging (optional override; defaults: dev=DEBUG, beta=INFO, prod=WARNING)
# DJANGO_LOG_LEVEL=WARNING
# Shared external Postgres (10.0.0.230) — prod database
DATABASE_URL=postgres://westfarn:replace-db-password@10.0.0.230:5432/scha
# Host port on adama/roslin (must match server-infra host_apps)
WEB_PORT=8002
# Stripe (rotate away from any keys previously committed in git)
STRIPE_PUBLISHABLE_KEY=pk_live_replace-me
STRIPE_SECRET_KEY=sk_live_replace-me
STRIPE_ENDPOINT_SECRET=whsec_replace-me
# reCAPTCHA (rotate away from any keys previously committed in git)
RECAPTCHA_PUBLIC_KEY=replace-with-production-public-key
RECAPTCHA_PRIVATE_KEY=replace-with-production-private-key
# Gunicorn
GUNICORN_WORKERS=2
GUNICORN_BIND=0.0.0.0:8000
# =============================================================================
# BETA overrides (use separate file: scha_beta.env)
# =============================================================================
# DJANGO_ENV=beta
# DJANGO_SECRET_KEY=replace-with-a-different-beta-secret
# DJANGO_ALLOWED_HOSTS=beta.schawheaton.aimloperations.com
# DATABASE_URL=postgres://westfarn:replace-db-password@10.0.0.230:5432/scha_beta
# WEB_PORT=8012
# STRIPE_PUBLISHABLE_KEY=pk_test_replace-me
# STRIPE_SECRET_KEY=sk_test_replace-me
# STRIPE_ENDPOINT_SECRET=whsec_replace-me