Skip to content

Commit 5f6c603

Browse files
authored
chore: documentation update, and add a way for teams to provide separate values file for different environments with different resource needs. (#2139)
Signed-off-by: OMPRAKASH MISHRA <omprakashmishra3978@gmail.com>
1 parent 44a88c4 commit 5f6c603

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

.github/workflows/.dbdeployer.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ on:
2121
description: Enable S3 backups
2222
required: false
2323
type: boolean
24+
values:
25+
description: 'Values file'
26+
default: 'values.yaml'
27+
required: false
28+
type: string
2429
secrets:
2530
oc_namespace:
2631
description: OpenShift namespace
@@ -88,17 +93,17 @@ jobs:
8893
shell: bash
8994
run: |
9095
echo 'Deploying crunchy helm chart'
91-
if [ ${{ secrets.s3_endpoint }} ]; then
96+
if [ ${{ inputs.s3_enabled }} == true ]; then
9297
helm status postgres || \
9398
helm upgrade --install --wait --set crunchy.pgBackRest.s3.enabled=true \
9499
--set-string crunchy.pgBackRest.s3.accessKey=${{ secrets.s3_access_key }} \
95100
--set-string crunchy.pgBackRest.s3.secretKey=${{ secrets.s3_secret_key }} \
96101
--set-string crunchy.pgBackRest.s3.bucket=${{ secrets.s3_bucket }} \
97102
--set-string crunchy.pgBackRest.s3.endpoint=${{ secrets.s3_endpoint }} \
98-
postgres .
103+
--values ${{ inputs.values }} postgres .
99104
else
100105
helm status postgres || \
101-
helm upgrade --install --wait postgres .
106+
helm upgrade --install --wait --values ${{ inputs.values }} postgres .
102107
fi
103108
104109
- name: Add PR specific user to Crunchy DB # only for PRs

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Features:
5353
* Self-healing through with probes/checks (startup, readiness, liveness)
5454
* Point the long-lived DEMO route to PRs by using the `demo` label
5555
* Sample application stack:
56-
* Database: Postgres, PostGIS, backups, Flyway
56+
* Database: Crunchy(Postgres, PostGIS), backups, Flyway
5757
* Frontend: TypeScript, Caddy Server
5858
* Backend: TypeScript, Nest.js
5959
* Alternative backend examples - see [Alternative Backends](#alternative-backends)
@@ -353,20 +353,23 @@ Features:
353353
* [TypeScript](https://www.typescriptlang.org/) strong-typing for JavaScript
354354
* [NestJS](https://docs.nestjs.com) Nest/Node backend and frontend
355355
* [Flyway](https://flywaydb.org/) database migrations
356-
* [Postgres](https://www.postgresql.org/) or [PostGIS](https://postgis.net/) database
357-
* [backup-container](https://github.com/BCDevOps/backup-container) provided by BCDevOps
356+
* [Crunchy](https://www.crunchydata.com/products/crunchy-postgresql-for-kubernetes) Postgres/Postgis Database
358357

359-
Postgres is default. Switch to PostGIS by copying the appropriate Dockerfile to `./database`:
358+
Postgis is default. Switch to Postgres by removing the image names in [crunchy helm chart values](./charts/crunchy/values.yaml)
360359

361-
> cp ./database/postgis/Dockerfile ./database
360+
## Crunchy
361+
362+
Crunchy is the default choice for HA postgres/postgis DB in BCGov. provided chart is to get up and going fast, it is upto teams to fine tune resource allocation and patroni parameters of crunchy DB to get the best out of database.
363+
364+
* For specifying different resources for different envs, just add values-test.yml and values-prod.yml , then provide them to the [DB Deployer in GHA](.github/workflows/.dbdeployer.yml#L24).
365+
* For enabling S3 backups/recovery, please enable in [values file](./charts/crunchy/values.yaml#L62), and in the [DB Deployer in GHA](.github/workflows/.dbdeployer.yml#L20), then provide necessary secret values which are prefixed with `s3` [DB Deployer in GHA](.github/workflows/.dbdeployer.yml#L36)
362366

363367
## Alternative Backends
364368

365369
The sample Java, Python and Go backends repository has been archived, but we have lots of other great examples of active projects you can learn from!
366370

367371
* [NR-RFC-AlertAuthoring - Python with FastAPI and Alembic](https://github.com/bcgov/nr-rfc-alertauthoring)
368-
* [NR-SPAR - Java with SpringBoot and Flyway](https://github.com/bcgov/nr-spar) (Quarkus and Cloud Native coming soon!)
369-
* [QuickStart OpenShift Backends](https://github.com/bcgov/quickstart-openshift-backends) (archived, maintainer needed!)
372+
* [QuickStart OpenShift Backends](https://github.com/bcgov/quickstart-openshift-backends)
370373

371374
## SchemaSpy
372375

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ x-postgres-vars: &postgres-vars
1616

1717
services:
1818
database:
19-
image: postgres:15
19+
image: postgis/postgis:16-3.4 # if using crunchy , make sure to align with crunchy version, currently it is at 16 and postgis 3.3
2020
container_name: database
2121
environment:
2222
<<: *postgres-vars

0 commit comments

Comments
 (0)