What gets provisioned
A singleterraform apply creates:
- VPC with a private subnet, Cloud NAT, and a Serverless VPC Access Connector
- Cloud Run v2 services:
api,web,workerwith autoscaling (min/max instance counts) - Cloud Run v2 job:
init(one-shot migrations + seeds) - Cloud SQL Postgres (Open-source distribution): optional HA, encrypted, automated backups
- Memorystore Redis: BASIC or STANDARD_HA tier
- GCE instance (data host): ClickHouse on a persistent disk, with optional Prometheus and Grafana, accessible via IAP SSH tunnel
- Global HTTPS Load Balancer with managed SSL certificate (when domain is supplied)
- Cloud DNS A record pointing to the load balancer
- Secret Manager: generated DB / ClickHouse / SECRET_KEY passwords, plus connection URLs injected into Cloud Run services
- GCS backups bucket: versioned, lifecycle to Nearline → delete
- Artifact Registry: for storing container images (optional)
Prerequisites
Enable required APIs:
Quickstart
Configuration
All inputs live interraform.tfvars.
Minimal (no custom domain)
https://observal-prod-api-xxxxx-uc.a.run.app).
Recommended (HTTPS on your domain)
Sizing
data_machine_type to e2-standard-4, db_tier to db-custom-4-16384, and redis_tier to STANDARD_HA.
Operating the install
Shell into the data host
View logs
Cloud Run logs go to Cloud Logging automatically:resource.type="cloud_run_revision".
Re-run migrations
Read a generated secret
Upgrade to a new release
Resize the data disk
Destroy
Cost estimate (us-central1, on-demand)
Cloud Run scales to zero when idle (if
min_instances = 0), which can significantly reduce costs for low-traffic deployments.
Production hardening checklist
- Set
db_ha_enabled = truefor Cloud SQL high availability - Set
redis_tier = "STANDARD_HA"for Redis failover - Restrict Cloud Run ingress (use
ingress = "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"if behind GCLB) - Enable Cloud Armor (WAF) on the Global HTTPS Load Balancer
- Enable Security Command Center in the project
- Set up alerting on Cloud SQL CPU, memory, and Cloud Run error rates
- Configure SSO
- Test backup and restore end-to-end
- Set up Terraform remote state in GCS
Troubleshooting
Cloud Run service stuck inRevision is not ready.
Check revision logs in Cloud Logging. Common causes: Secret Manager permissions missing, VPC connector not ready, or image pull failure.
Init job fails.
connector_cidr doesn’t overlap with your VPC subnet.
For application-level issues, see Troubleshooting.
Next
- Production deployment — overview of both clouds
- Configuration — environment variables
- Upgrades — upgrade and rollback procedures
- Backup and restore — restore procedures

