Repository navigation
infra(dev): cut dev Postgres over to shared Aurora (database-per-dev) - #96
Merged
Merged
Conversation
Retires the per-developer in-cluster er-postgres StatefulSet in favour of the
shared Aurora Serverless v2 cluster (rds.tf). Each developer gets their own
role + control-plane database (erctl_{dev}) on the one cluster — the same
isolation the private pod gave, but pay-per-use (Aurora pauses to 0 ACU idle).
er-dev-namespace chart:
- delete postgres.yaml (StatefulSet + Service + init ConfigMap) and
externalsecret-postgres.yaml.
- add bootstrap.yaml: two ExternalSecrets (the shared Aurora master creds
er/{env}/shared/postgres; this dev's role password er/{env}/{dev}/postgres)
+ an er-db-bootstrap Job (post-install/post-upgrade hook) that idempotently
creates role er_{dev} + database erctl_{dev} as the master. psql runs under a
restricted securityContext; helm blocks on the hook so dev-up installs
er-platform only once the DB exists.
- values.yaml: drop the StatefulSet shape (storage/resources); keep the pinned
postgres image for the bootstrap Job's psql.
scripts/dev_env.sh:
- postgres secret now carries only ER_ROLE_PASSWORD (the per-dev role pw).
- read the Aurora endpoint from er/{env}/shared/postgres; point both
erserver.ERSERVER_DSN and erweb.ERWEB_DATABASE_URL at
er_{dev}@aurora/erctl_{dev} (sslmode=require). Postgres identifiers fold the
DNS-safe dev name's hyphens to underscores.
- drop ERSERVER_MAINT_DSN / ERSERVER_TENANT_DSN_TEMPLATE: the Rust control
plane uses a single DSN (per-org catalogs are DuckLake, not Postgres DBs).
Makefile:
- dev-up: drop the StatefulSet rollout wait (helm blocks on the hook Job).
- dev-suspend/dev-resume: no StatefulSet to scale (Aurora auto-pauses); fix
the stale er-api/er-web/er-dispatcher names to the merged web-api deployment.
NetworkPolicy is Ingress-only (egress unrestricted), so web-api reaches Aurora
in the VPC with no policy change. Validated offline: bash -n, helm lint, helm
template (renders the Job + ExternalSecrets, no StatefulSet). Live validation
(bootstrap SQL against Aurora + a throwaway dev-up) pending SSO re-auth.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #94 (which created the Aurora Serverless v2 cluster). Retires the per-developer in-cluster
er-postgresStatefulSet in favour of the shared cluster, database-per-dev: each developer getserctl_{dev}+ roleer_{dev}on the one cluster — same isolation the private pod gave, but pay-per-use (Aurora pauses to 0 ACU when idle).Changes
er-dev-namespacechartpostgres.yaml(StatefulSet + Service + init ConfigMap) andexternalsecret-postgres.yamlbootstrap.yaml: two ExternalSecrets (shared Aurora master credser/{env}/shared/postgres; this dev's role pwer/{env}/{dev}/postgres) + aner-db-bootstrappost-install/post-upgrade hook Job that idempotently createser_{dev}+erctl_{dev}as the master. psql runs under a restrictedsecurityContext; helm blocks on the hook sodev-upinstallser-platformonly once the DB exists.values.yaml: drop the StatefulSet shape; keep the pinned postgres image for the Job's psql.scripts/dev_env.shpostgressecret now carries onlyER_ROLE_PASSWORDer/{env}/shared/postgres; point bothERSERVER_DSNandERWEB_DATABASE_URLater_{dev}@aurora/erctl_{dev}(sslmode=require). Hyphens in the DNS-safe dev name fold to underscores for the PG identifiers.ERSERVER_MAINT_DSN/ERSERVER_TENANT_DSN_TEMPLATE— the Rust control plane uses a single DSN (per-org catalogs are DuckLake, not per-tenant Postgres DBs).Makefiledev-up: drop the StatefulSet rollout wait (helm blocks on the hook Job)dev-suspend/dev-resume: no StatefulSet to scale (Aurora auto-pauses); fix the staleer-api/er-web/er-dispatchernames → the mergedweb-apideploymentValidation
bash -non dev_env.sh,helm lint,helm template(renders the Job + 2 ExternalSecrets, no StatefulSet/Service/ConfigMap). ✅sslmode=require. ✅make dev-up DEV=auroratestend-to-end before merge.🤖 Generated with Claude Code