chore: use pgbouncer for connection pooling which handles crunchy failover better than prisma pool#2440
Merged
chore: use pgbouncer for connection pooling which handles crunchy failover better than prisma pool#2440
Conversation
…lover better than prisma pool
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR switches the database connection pooling to PgBouncer across the Helm charts and backend service, and updates deployment automation to use the latest Crunchy Postgres Operator action.
- Increase PgBouncer replicas and tune connection settings in
charts/crunchy/values.yml - Expose
PGBOUNCER_URLvia the app’s Kubernetes Secret and consume it inPrismaService - Bump
bcgov/action-crunchyGitHub Action to v1.2.3
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| charts/crunchy/values.yml | Increase replicas, bump maxConnections, add poolMode for PgBouncer |
| charts/app/templates/secret.yaml | Add PGBOUNCER_URL entry from secret data |
| backend/src/prisma.service.ts | Use PGBOUNCER_URL for Prisma data source with fallback to direct URL |
| .github/workflows/.deployer.yml | Upgrade bcgov/action-crunchy to v1.2.3 |
Comments suppressed due to low confidence (3)
charts/crunchy/values.yml:114
- [nitpick] Consider clarifying the rationale for increasing
maxConnectionsto 100 and ensure this value, in combination withpoolMode, does not exceed the Postgres server'smax_connectionssetting. You might reference the server config or make it configurable.
maxConnections: 100 # make sure less than postgres max connections
charts/crunchy/values.yml:115
- [nitpick] Add a comment explaining why
'transaction'was chosen forpoolMode(vs.sessionorstatement) to help future maintainers understand this setting.
poolMode: 'transaction'
charts/app/templates/secret.yaml:19
- [nitpick] Consider renaming the variable to align with the secret key (e.g.,
$pgbouncerUri) or updating the secret field topgbouncerUrlso naming is consistent and clear.
{{- $pgbouncerUrl = b64dec (get $secretData "pgbouncer-uri") }}
DerekRoberts
approved these changes
Jul 9, 2025
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.
Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in: