-
Notifications
You must be signed in to change notification settings - Fork 4
Deployment and Operations.md
The repo contains GitHub Actions workflows for:
-
Staging: triggered on push to
staging -
Production: triggered on push to
production
Both deploy to Google App Engine and run database steps before deploy.
For both staging and production, the CI workflow:
- Checks out the repo
- Installs
uvand exportsrequirements.txt - Authenticates to Google Cloud
- Runs
alembic upgrade headagainst Cloud SQL - Refreshes pygeoapi materialized views
- Renders
app.yamlfrom.github/app.template.yaml - Deploys via
gcloud app deploy - Removes old non-serving versions
| Component | Detail |
|---|---|
| Runtime | Python 3.13 on Google App Engine |
| Database | Cloud SQL-backed Postgres |
| Server | Gunicorn + Uvicorn workers |
| Warmup |
/_ah/warmup endpoint; Cloud Scheduler hits /ogcapi/_ah/warmup Mon–Fri 08:00–17:00 to prevent cold starts |
| Min instances | Zero (configured in rendered app.yaml) |
Refresh materialized views manually:
python -m cli.cli refresh-pygeoapi-materialized-viewsManaged view list:
ogc_latest_depth_to_water_wellsogc_water_elevation_wellsogc_avg_tds_wellsogc_depth_to_water_trend_wellsogc_water_well_summaryogc_major_chemistry_resultsogc_minor_chemistry_wells
-
/adminrequiresSESSION_SECRET_KEYto be set - Login uses Authentik authorization-code flow with PKCE
- Admin callback route:
/admin/auth/callback
# Run both Alembic and data migrations
python -m cli.cli alembic-upgrade-and-data
# Inspect data migration status
python -m cli.cli data-migrations status
# Restore local DB from file or GCS
python -m cli.cli restore-local-db path/to/dump.sql
python -m cli.cli restore-local-db gs://bucket/path.sql.gzAll unhandled exceptions are reported to Sentry. Check the OcotilloAPI project in Sentry for alerts.
- Configured via
SENTRY_DSNincore/factory.py - A Sentry release is created on every push to
main
Traffic, response times, and error rates are tracked via Apitally.
- Middleware configured in
core/factory.py - Requires
APITALLY_CLIENT_ID
| Environment | Location |
|---|---|
| Development |
tail -f cli/logs/cli.log (for CLI tools) |
| Production | Google Cloud Logging console for the App Engine service |
| Symptom | Check |
|---|---|
401 / 403 errors |
Verify Authentik tokens; confirm AUTHENTIK_DISABLE_AUTHENTICATION is not set in production |
| Database connection failures | Verify Cloud SQL Auth Proxy settings or POSTGRES_HOST variables |
| OGC API failures | Check core/pygeoapi-config.yml for malformed YAML or missing collection definitions |
/admin returns 503 |
SESSION_SECRET_KEY is not set; session middleware is only added when the variable is present |
The repo does not document a manual rollback runbook, incident procedure, or production approval chain. Those should be added if this wiki is meant to be the central operational hub.
The repo contains a
Procfilepointing topython3 -m transfers.transfer, which does not match the main API hosting path. Treat it as historical or specialized until confirmed otherwise.