← Index
Source: docs/runbooks/cloud-sql-setup.md (auto-generated by scripts/generate-docs-html.mjs — edit the .md, not this file)

Cloud SQL (Postgres) setup — rabbit / Task 1

How to provision the Postgres instance Task 1 needs, connect Cloud Run to it, and put the DATABASE_URL in Secret Manager. Project doubletree-498007 (billing enabled), region asia-northeast3, smallest tier. (2026-06-25)

⚠️ Billable. A Cloud SQL instance bills monthly even when idle (~$8–10+ at the smallest tier). Run these only when you're ready. Claude does not run these automatically — they create real, billed cloud resources.

0. Prereqs (local)

gcloud config set project doubletree-498007
gcloud services enable sqladmin.googleapis.com secretmanager.googleapis.com

1. Create the instance + DB + user

# smallest shared-core tier; pick a strong password for the app user
gcloud sql instances create rabbit-pg \
  --database-version=POSTGRES_16 \
  --tier=db-f1-micro \
  --region=asia-northeast3 \
  --storage-size=10GB --storage-auto-increase

gcloud sql databases create rabbit --instance=rabbit-pg

gcloud sql users create rabbit_app --instance=rabbit-pg --password='REPLACE_ME_STRONG'

Get the instance connection name (used by the Cloud SQL connector):

gcloud sql instances describe rabbit-pg --format='value(connectionName)'
# → doubletree-498007:asia-northeast3:rabbit-pg

2. DATABASE_URL → Secret Manager

Cloud Run reaches Cloud SQL over a unix socket at /cloudsql/<connectionName>:

CONN=doubletree-498007:asia-northeast3:rabbit-pg
DB_URL="postgresql://rabbit_app:REPLACE_ME_STRONG@localhost/rabbit?host=/cloudsql/${CONN}"

printf '%s' "$DB_URL" | gcloud secrets create DATABASE_URL --data-file=- || \
printf '%s' "$DB_URL" | gcloud secrets versions add DATABASE_URL --data-file=-

3. Run the Prisma migration

4. Wire Cloud Run → Cloud SQL (in scripts/deploy.sh)

Add to the gcloud run deploy flags:

--add-cloudsql-instances=doubletree-498007:asia-northeast3:rabbit-pg \
--update-secrets=DATABASE_URL=DATABASE_URL:latest

Teardown (stop billing)

gcloud sql instances delete rabbit-pg