Skip to content

Commit

Permalink
feat: support additional options for pg_dump cli
Browse files Browse the repository at this point in the history
  • Loading branch information
mlauke authored and dploeger committed Dec 5, 2024
1 parent 4f90f16 commit 71a6add
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion container/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ then
echo "Dumping ${NAME}"
echo "${DATABASE_HOST}:5432:${DATABASE_NAME}:${DATABASE_USERNAME}@${DATABASE_HOST}:${DATABASE_PASSWORD}" > ~/.pgpass
chmod 0600 ~/.pgpass
pg_dump --format "${PG_DUMP_FORMAT}" --host="${DATABASE_HOST}" --dbname="${DATABASE_NAME}" --username="${DATABASE_USERNAME}@${DATABASE_HOST}" > dump
pg_dump ${PG_ADD_OPTIONS} --format "${PG_DUMP_FORMAT}" --host="${DATABASE_HOST}" --dbname="${DATABASE_NAME}" --username="${DATABASE_USERNAME}@${DATABASE_HOST}" > dump
azcopy copy --overwrite true dump "https://${BACKUP_STORAGE_ACCOUNT}.blob.core.windows.net/${BACKUP_STORAGE_CONTAINER}/databases/${NAME}.$(date +%u).${PG_DUMP_SUFFIX}?${SAS_BACKUP}"
done
fi
Expand Down
2 changes: 2 additions & 0 deletions helm-charts/azure-advanced-backup/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
value: {{ .Values.config.postgres.databases }}
- name: PG_USE_CUSTOM_FORMAT
value: "{{ .Values.config.postgres.useCustomFormat }}"
- name: PG_ADD_OPTIONS
value: "{{ .Values.config.postgres.additionalOptions }}"
- name: AZ_APPLICATION_ID
value: {{ .Values.config.auth.applicationId }}
- name: AZCOPY_SPA_CLIENT_SECRET
Expand Down
5 changes: 4 additions & 1 deletion helm-charts/azure-advanced-backup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ config:
# -- set to yes to use the pg_dump custom format (`--format c`) and a dmp suffix instead of the sql format and an
# sql suffix
useCustomFormat: "no"

#
# -- optional additional pg_dump parameters, e.g. to support --no-acl --no-ower in dump which may cause problems together with the azure flexible server
additionalOptions: ""

backupStorage:
# -- Name of the storage account to sync the containers to
account: ""
Expand Down

0 comments on commit 71a6add

Please sign in to comment.