Skip to content

feat: migrate quotes-backend from GCP SQL to pgrator Postgres#304

Open
Starefossen wants to merge 1 commit into
mainfrom
feat/add-pgrator-postgres
Open

feat: migrate quotes-backend from GCP SQL to pgrator Postgres#304
Starefossen wants to merge 1 commit into
mainfrom
feat/add-pgrator-postgres

Conversation

@Starefossen
Copy link
Copy Markdown
Member

What

Migrate the quotes-backend from GCP Cloud SQL (gcp.sqlInstances) to pgrator-managed Postgres (data.nais.io/v1 Postgres CR + spec.postgres.clusterName).

This tests the full pgrator → naiserator flow end-to-end with a real app.

Changes

  • quotes-backend/.nais/postgres.yaml — new Postgres CR (PostgreSQL 17, 2Gi disk, nb_NO collation)
  • quotes-backend/.nais/app.yaml — replaced gcp.sqlInstances with postgres.clusterName: quotes-backend-db + env var mappings (PGJDBCURLDB_JDBC_URL, PGUSERDB_USERNAME, PGPASSWORDDB_PASSWORD)
  • .github/workflows/service-pipeline.yaml — added extra-resources input for additional deploy resources
  • .github/workflows/quotes-backend.yaml — passes postgres.yaml as extra resource

Testing

Deploying this will exercise:

  1. pgrator creating the CNPG cluster + setting active-engine annotation
  2. naiserator watching the Postgres CR and wiring env vars into the app pod
  3. The app connecting via the JDBC URL from pgrator-provided env vars

Replace the gcp.sqlInstances block with a Postgres CR managed by pgrator
and wire it to the app via spec.postgres.clusterName.

Env var mapping added for backward compatibility:
- PGJDBCURL → DB_JDBC_URL
- PGUSER → DB_USERNAME
- PGPASSWORD → DB_PASSWORD

Also adds extra-resources support to the reusable pipeline so the
Postgres CR is deployed alongside the app.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant