forked from magda-io/magda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re-written Magda postgresql dockfile image & add wal-g for point-in-t…
…ime recovery & backup
- Loading branch information
Showing
6 changed files
with
78 additions
and
56 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
deploy/helm/internal-charts/postgresql-wrapper/templates/cronjob-backup.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{- if .Values.backupRestore.backup.enabled -}} | ||
apiVersion: batch/v1beta1 | ||
kind: CronJob | ||
metadata: | ||
name: "{{ .Values.dbModuleName }}-backup-jobs" | ||
spec: | ||
concurrencyPolicy: Forbid | ||
schedule: {{ .Values.wal-g.backup.schedule | quote }} | ||
failedJobsHistoryLimit: 1 | ||
successfulJobsHistoryLimit: 1 | ||
startingDeadlineSeconds: 120 | ||
jobTemplate: | ||
spec: | ||
backoffLimit: 3 | ||
completions: 1 | ||
parallelism: 1 | ||
template: | ||
metadata: | ||
name: "{{ .Values.dbModuleName }}-backup-job" | ||
labels: | ||
cron: "{{ .Values.dbModuleName }}-backup-jobs" | ||
spec: | ||
{{- include "magda.pullSecrets" . | indent 10 }} | ||
containers: | ||
- image: "{{ .Values.backupRestore.image.repository }}:{{ .Values.backupRestore.image.tag }}" | ||
imagePullPolicy: "{{ .Values.backupRestore.image.repository }}" | ||
name: db-backup | ||
command: | ||
- "/bin/sh" | ||
- "-c" | ||
- "apk add --no-cache ca-certificates curl && curl -i -X POST http://indexer/v0/reindex" | ||
- "{{ typeof "sdsd" }}" | ||
restartPolicy: OnFailure | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,4 @@ | ||
FROM postgres:9.6.15 | ||
FROM bitnami/postgresql:13.3.0-debian-10-r79 | ||
|
||
# Install wall-e | ||
RUN apt-get update && \ | ||
apt-get install -y patch && \ | ||
apt-get install -y python3-pip lzop pv && \ | ||
python3 -m pip install --upgrade pip && \ | ||
python3 -m pip install wal-e[aws,google,swift] && \ | ||
# Install postgresql pl debugger | ||
# The debugger module won't be loaded until you modify the postgresql.conf with: | ||
# shared_preload_libraries = ‘$libdir/other_libraries/plugin_debugger’ | ||
# We will do it in start.sh depends on env var switch | ||
# After that, you need to run `CREATE EXTENSION pldbgapi;` | ||
# in the database that you want to debug to turn it on database level | ||
apt-get install -y postgresql-9.6-pldebugger | ||
|
||
COPY component/start.sh /usr/local/bin/ | ||
|
||
# docker-entrypoint.sh (from the parent image) frustratingly only creates the database | ||
# if the "next" command it runs is "postgres". But we want to do a migration after | ||
# the normal startup, so we can't simply launch postgres. So here we monkey patch | ||
# the startup script to allow chaining to any command. This is arguably better than | ||
# the alternative of forking the upstream docker-entrypoint.sh entirely. | ||
COPY component/docker-entrypoint.sh.patch /usr/local/bin | ||
RUN patch -i /usr/local/bin/docker-entrypoint.sh.patch /usr/local/bin/docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
CMD ["start.sh", "postgres"] | ||
# copy wal-g from pre-built image | ||
COPY --from=bitnami/wal-g:1.1.0-debian-10-r3 /opt/bitnami/wal-g/bin/wal-g /usr/local/bin/wal-g |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters