Skip to content

Commit

Permalink
chore: documentation update, and add a way for teams to provide separ…
Browse files Browse the repository at this point in the history
…ate values file for different environments with different resource needs. (#2139)

Signed-off-by: OMPRAKASH MISHRA <[email protected]>
  • Loading branch information
mishraomp authored Oct 25, 2024
1 parent 44a88c4 commit 5f6c603
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/.dbdeployer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ on:
description: Enable S3 backups
required: false
type: boolean
values:
description: 'Values file'
default: 'values.yaml'
required: false
type: string
secrets:
oc_namespace:
description: OpenShift namespace
Expand Down Expand Up @@ -88,17 +93,17 @@ jobs:
shell: bash
run: |
echo 'Deploying crunchy helm chart'
if [ ${{ secrets.s3_endpoint }} ]; then
if [ ${{ inputs.s3_enabled }} == true ]; then
helm status postgres || \
helm upgrade --install --wait --set crunchy.pgBackRest.s3.enabled=true \
--set-string crunchy.pgBackRest.s3.accessKey=${{ secrets.s3_access_key }} \
--set-string crunchy.pgBackRest.s3.secretKey=${{ secrets.s3_secret_key }} \
--set-string crunchy.pgBackRest.s3.bucket=${{ secrets.s3_bucket }} \
--set-string crunchy.pgBackRest.s3.endpoint=${{ secrets.s3_endpoint }} \
postgres .
--values ${{ inputs.values }} postgres .
else
helm status postgres || \
helm upgrade --install --wait postgres .
helm upgrade --install --wait --values ${{ inputs.values }} postgres .
fi
- name: Add PR specific user to Crunchy DB # only for PRs
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Features:
* Self-healing through with probes/checks (startup, readiness, liveness)
* Point the long-lived DEMO route to PRs by using the `demo` label
* Sample application stack:
* Database: Postgres, PostGIS, backups, Flyway
* Database: Crunchy(Postgres, PostGIS), backups, Flyway
* Frontend: TypeScript, Caddy Server
* Backend: TypeScript, Nest.js
* Alternative backend examples - see [Alternative Backends](#alternative-backends)
Expand Down Expand Up @@ -353,20 +353,23 @@ Features:
* [TypeScript](https://www.typescriptlang.org/) strong-typing for JavaScript
* [NestJS](https://docs.nestjs.com) Nest/Node backend and frontend
* [Flyway](https://flywaydb.org/) database migrations
* [Postgres](https://www.postgresql.org/) or [PostGIS](https://postgis.net/) database
* [backup-container](https://github.com/BCDevOps/backup-container) provided by BCDevOps
* [Crunchy](https://www.crunchydata.com/products/crunchy-postgresql-for-kubernetes) Postgres/Postgis Database

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

> cp ./database/postgis/Dockerfile ./database
## Crunchy

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.

* 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).
* 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)

## Alternative Backends

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!

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

## SchemaSpy

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ x-postgres-vars: &postgres-vars

services:
database:
image: postgres:15
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
container_name: database
environment:
<<: *postgres-vars
Expand Down

0 comments on commit 5f6c603

Please sign in to comment.