Skip to content

Phase A — Migrate Treepolitics API to Cloud Run #2

Description

@amrtgaber

Goal

Deploy the FastAPI backend to Cloud Run in treepolitics-prod, replacing the local docker-compose setup. End state: api.treepolitics.net serves the live API from Cloud Run.

Steps

  1. Enable required APIs on treepolitics-prod: run, sqladmin, secretmanager, artifactregistry, cloudbuild.
  2. Create Artifact Registry Docker repo; build + push first image from the existing Dockerfile.
  3. Provision Cloud SQL Postgres (smallest tier, ~$10–15/mo).
  4. Create Secret Manager secrets: SECRET_KEY, DATABASE_URL, anything else currently in .env.
  5. First Cloud Run deploy with Cloud SQL Auth Proxy sidecar.
  6. Run Alembic migrations against Cloud SQL.
  7. Smoke-test API endpoints.
  8. Wire api.treepolitics.net DNS → Cloud Run.

Done when

  • api.treepolitics.net serves the FastAPI app
  • DB migrations applied against Cloud SQL
  • All secrets sourced from Secret Manager (no .env in prod)

Cost estimate

~$10–15/mo (dominated by Cloud SQL).

Notes

Prerequisite for Phase C (frontend wiring) and Phase D (CI/CD).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions