Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/.deployer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
tag: ${{ inputs.tag || steps.pr.outputs.pr }}
triggered: ${{ steps.deploy.outputs.triggered }}
steps:
- uses: bcgov/action-crunchy@v1.2.2
- uses: bcgov/action-crunchy@v1.2.3
name: Deploy Crunchy
id: deploy_crunchy
with:
Expand Down
3 changes: 2 additions & 1 deletion backend/src/prisma.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const DB_PWD = encodeURIComponent(process.env.POSTGRES_PASSWORD || "default"); /
const DB_PORT = process.env.POSTGRES_PORT || 5432;
const DB_NAME = process.env.POSTGRES_DATABASE || "postgres";
const DB_SCHEMA = process.env.POSTGRES_SCHEMA || "users";
const dataSourceURL = `postgresql://${DB_USER}:${DB_PWD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?schema=${DB_SCHEMA}&connection_limit=5`;
const PGBOUNCER_URL = process.env.PGBOUNCER_URL;
const dataSourceURL = PGBOUNCER_URL?`${PGBOUNCER_URL}?schema=${DB_SCHEMA}&pgbouncer=true`:`postgresql://${DB_USER}:${DB_PWD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?schema=${DB_SCHEMA}&connection_limit=5`;

@Injectable()
class PrismaService extends PrismaClient<Prisma.PrismaClientOptions, 'query'> implements OnModuleInit, OnModuleDestroy {
Expand Down
3 changes: 2 additions & 1 deletion charts/app/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{{- end }}
{{- $databasePassword = get $secretData "password" }}
{{- $databaseName = b64dec (get $secretData "dbname") }}
{{- $pgbouncerUrl = b64dec (get $secretData "pgbouncer-uri") }}
{{- $host = printf "%s:%s" (b64dec (get $secretData "host")) (b64dec (get $secretData "port")) }}
{{- $hostWithoutPort = printf "%s" (b64dec (get $secretData "host")) }}
{{- $databaseURL := printf "postgresql://%s:%s@%s/%s" $databaseUser (b64dec $databasePassword) $host $databaseName }}
Expand All @@ -37,7 +38,7 @@ data:
POSTGRES_USER: {{ $databaseUser | b64enc | quote }}
POSTGRES_DATABASE: {{ $databaseName | b64enc | quote }}
POSTGRES_HOST: {{ $hostWithoutPort | b64enc | quote }}

PGBOUNCER_URL: {{ $pgbouncerUrl | b64enc | quote }}
---
apiVersion: v1
kind: Secret
Expand Down
5 changes: 3 additions & 2 deletions charts/crunchy/values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ crunchy: # enable it for TEST and PROD, for PR based pipelines simply use single
enabled: true
pgBouncer:
image: # it's not necessary to specify an image as the images specified in the Crunchy Postgres Operator will be pulled by default
replicas: 1
replicas: 2
requests:
cpu: 5m
memory: 32Mi
maxConnections: 10 # make sure less than postgres max connections
maxConnections: 100 # make sure less than postgres max connections
poolMode: 'transaction'

# Postgres Cluster resource values:
pgmonitor:
Expand Down