-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1882 - Recovery and backup startegy patroni #2057
#1882 - Recovery and backup startegy patroni #2057
Conversation
guru-aot
commented
Jun 28, 2023
•
edited
Loading
edited
- Updated the base image of database backup container to support till Postgres 14 - https://github.com/BCDevOps/backup-container/blob/master/docker/Dockerfile
- The base build template was changed from sample build given in https://github.com/BCDevOps/backup-container/blob/master/openshift/templates/backup/backup-build.yaml
- Removed the mongo db backup from makefile and removed in all the namespaces
- The backup.conf should be created for databases seperately, so renamed it for simsdb and refactored to reflect the changes in the config names, pvc's and containers created
- The deploy.yaml is updated with the latest from bcgov recommendations https://github.com/BCDevOps/backup-container/blob/master/openshift/templates/backup/backup-deploy.yaml
- Backup stratergy is followed by rolling backup with default bcgov recommendations on backup

export BACKUP_MONGODB_APP_NAME := $(or $(BACKUP_MONGODB_APP_NAME), mongodb-backup) | ||
export BACKUP_CONFIGMAP_NAME := $(or $(BACKUP_CONFIGMAP_NAME), backup-conf) | ||
export BACKUP_POSTGRESQL_APP_NAME := $(or $(BACKUP_POSTGRESQL_APP_NAME), patroni-simsdb-backup) | ||
export PATRONI_SIMSDB_BACKUP_CONFIGMAP_NAME := $(or $(PATRONI_SIMSDB_BACKUP_CONFIGMAP_NAME), patroni-simsdb-backup-conf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this was mentioned "The backup.conf should be created for databases separately" does it means that they need to be created per database or per database type? For instance, Mongo/Postgres? In case we have a second DB on Postgres, do we need to create a second backup structure?
IMO, the answer to this question can help determine the variable's names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah for seperate database not the database type, because individual databases can have different schedule of backups
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, "The backup.conf should be created for databases separately" actually means that the backups can be configured for multiple databases but we are actually structuring it in a way that it will be per database assuming that a new database will have a different backup schedule, right?
Does it mean that in the future, if we have more than one DB, instead of a new line in a config file we will create a separate structure to handle the new backup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you got it right, that was the plan, as individual backup stratergy for different databases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through the conversation @guru-aot @andrewsignori-aot .
@guru-aot what could be the benefit of having individual backup strategy per db?
@@ -73,4 +71,4 @@ parameters: | |||
displayName: FROM Image Tag | |||
description: Base image to build from. Docker creds or Artificatory setup may be needed to alleviate docker rate-limiting | |||
required: true | |||
value: artifacts.developer.gov.bc.ca/docker-remote/centos/postgresql-12-centos7:20200917-804ef01 | |||
value: docker.io/centos/postgresql-12-centos7:20200917-804ef01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artifacts.developer.gov.bc.ca/docker-remote
is not the same as docker.io
?
Are we not supposed to be using the artifacts
URL as much as possible (if not for everything)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right, but in this case, the build.yaml has been copied from the https://github.com/BCDevOps/backup-container/blob/master/openshift/templates/backup/backup-build.yaml. And the base image is actually not uses this too instead it uses quay.io/fedora/postgresql-14:14, as per the suggestion from the bcgov developer who did the changes to the dockerfile, which supports postgres 14.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guru-aot does artifacts.developer.gov.bc.ca/docker-remote/centos/postgresql-12-centos7:20200917-804ef01
work? as artifacts.developer.gov.bc.ca/docker-remote is just a proxy.
Correct me if wrong.
IMO only if it does not work we should start thinking about docker.io IMO.
@@ -170,16 +169,16 @@ objects: | |||
value: ${MONGODB_AUTHENTICATION_DATABASE} | |||
- name: TABLE_SCHEMA | |||
value: ${TABLE_SCHEMA} | |||
- name: ${DATABASE_SERVER_NAME}_USER | |||
- name: DATABASE_USER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we removing the "_USER" because we will no longer support the backup for multiple DBs?
"_USER" reference: https://github.com/BCDevOps/backup-container/tree/master#backupconf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we decide to move away from back-up of multiple db in same backup container?
If there is a requirement in future to have a another db, or we if decide to back up redis(by any chance) current way will be easily adaptable right?
# Create the POSTGRES structure | ||
db-backup-build-postgresql: | ||
db-backup-build-patroni: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also include SIMS to be aligned with the other renamed variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i specifically did not add SIMS, becuase build is going to be same for all, but while deploying we can have multiple databases with different names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the research on this. Few comments to get moe clarity 😉
devops/Makefile
Outdated
@@ -143,16 +143,15 @@ oc-build-forms: | print-status build-forms | |||
oc-deploy-ha-mongo: | print-status deploy-ha-mongo | |||
oc-deploy-forms: | print-status deploy-forms | |||
|
|||
# Build backup structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor - preriod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever available, I would like to have a walk-through for my information
@@ -73,4 +71,4 @@ parameters: | |||
displayName: FROM Image Tag | |||
description: Base image to build from. Docker creds or Artificatory setup may be needed to alleviate docker rate-limiting | |||
required: true | |||
value: artifacts.developer.gov.bc.ca/docker-remote/centos/postgresql-12-centos7:20200917-804ef01 | |||
value: docker.io/centos/postgresql-12-centos7:20200917-804ef01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we claim that current backup supports postgres 14 with this image?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it supports Postgres 14, as per the fedora postgres 14 base image
@@ -1,7 +1,4 @@ | |||
postgres=patroni-master:5432/SIMSDB | |||
postgres=patroni-master:5432/FFA_API_DB | |||
postgres=patroni-master:5432/FFA_BPM_DB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Great work. Added some comments for my understanding and clarity. Also, as we are in production curious to know about enabling FTP. I know it is outside the PR context but when I looked at the readme of back up container it rang a bell to ask about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the walk through 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the walk through @guru-aot 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanations!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this happen. Looks good 👍
Kudos, SonarCloud Quality Gate passed!
|