Skip to content

chore: use pgbouncer for connection pooling which handles crunchy failover better than prisma pool#2440

Merged
mishraomp merged 4 commits intomainfrom
fix/cp-pgbouncer
Jul 9, 2025
Merged

chore: use pgbouncer for connection pooling which handles crunchy failover better than prisma pool#2440
mishraomp merged 4 commits intomainfrom
fix/cp-pgbouncer

Conversation

@mishraomp
Copy link
Collaborator

@mishraomp mishraomp commented Jul 9, 2025


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:

Copilot AI review requested due to automatic review settings July 9, 2025 19:35
@mishraomp mishraomp requested a review from DerekRoberts July 9, 2025 19:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_URL via the app’s Kubernetes Secret and consume it in PrismaService
  • Bump bcgov/action-crunchy GitHub 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 maxConnections to 100 and ensure this value, in combination with poolMode, does not exceed the Postgres server's max_connections setting. 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 for poolMode (vs. session or statement) 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 to pgbouncerUrl so naming is consistent and clear.
{{- $pgbouncerUrl = b64dec (get $secretData "pgbouncer-uri") }}

@mishraomp mishraomp self-assigned this Jul 9, 2025
@mishraomp mishraomp added the chore Regular Maintenance label Jul 9, 2025
@mishraomp mishraomp merged commit 5ed86c3 into main Jul 9, 2025
28 checks passed
@mishraomp mishraomp deleted the fix/cp-pgbouncer branch July 9, 2025 22:27
@github-project-automation github-project-automation bot moved this from New to Done in NRIDS - Architecture Jul 9, 2025
@github-project-automation github-project-automation bot moved this from New to Done in DevOps (NR) Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Regular Maintenance

Projects

Archived in project
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants