commit
2cfc4a46f1
1 changed files with 61 additions and 61 deletions
|
|
@ -1,63 +1,63 @@
|
||||||
apiVersion: batch/v1
|
# apiVersion: batch/v1
|
||||||
kind: CronJob
|
# kind: CronJob
|
||||||
metadata:
|
# metadata:
|
||||||
name: postgres-backup-dev
|
# name: postgres-backup-dev
|
||||||
namespace: default
|
# namespace: default
|
||||||
spec:
|
# spec:
|
||||||
schedule: "30 18 * * 5" # weekly Friday 18:30
|
# schedule: "30 18 * * 5" # weekly Friday 18:30
|
||||||
jobTemplate:
|
# jobTemplate:
|
||||||
spec:
|
# spec:
|
||||||
template:
|
# template:
|
||||||
spec:
|
# spec:
|
||||||
restartPolicy: OnFailure
|
# restartPolicy: OnFailure
|
||||||
containers:
|
# containers:
|
||||||
- name: backup
|
# - name: backup
|
||||||
image: postgres:16
|
# image: postgres:16
|
||||||
command:
|
# command:
|
||||||
- /bin/sh
|
# - /bin/sh
|
||||||
- -c
|
# - -c
|
||||||
- |
|
# - |
|
||||||
pg_dump \
|
# pg_dump \
|
||||||
-h postgres-dev.default.svc.cluster.local \
|
# -h postgres-dev.default.svc.cluster.local \
|
||||||
-U $POSTGRES_USER \
|
# -U $POSTGRES_USER \
|
||||||
stripe_invoice \
|
# stripe_invoice \
|
||||||
| gzip \
|
# | gzip \
|
||||||
| aws s3 cp - s3://$S3_BUCKET/dev/stripe_invoice/$(date +%F).sql.gz
|
# | aws s3 cp - s3://$S3_BUCKET/dev/stripe_invoice/$(date +%F).sql.gz
|
||||||
envFrom:
|
# envFrom:
|
||||||
- secretRef:
|
# - secretRef:
|
||||||
name: postgres-secret # DEV DB creds
|
# name: postgres-secret # DEV DB creds
|
||||||
- secretRef:
|
# - secretRef:
|
||||||
name: aws-backup-secret # shared AWS creds
|
# name: aws-backup-secret # shared AWS creds
|
||||||
|
|
||||||
---
|
# ---
|
||||||
|
|
||||||
apiVersion: batch/v1
|
# apiVersion: batch/v1
|
||||||
kind: CronJob
|
# kind: CronJob
|
||||||
metadata:
|
# metadata:
|
||||||
name: postgres-backup-prod
|
# name: postgres-backup-prod
|
||||||
namespace: default
|
# namespace: default
|
||||||
spec:
|
# spec:
|
||||||
schedule: "30 01 * * *" # daily at 01:30 (recommended for prod)
|
# schedule: "30 01 * * *" # daily at 01:30 (recommended for prod)
|
||||||
jobTemplate:
|
# jobTemplate:
|
||||||
spec:
|
# spec:
|
||||||
template:
|
# template:
|
||||||
spec:
|
# spec:
|
||||||
restartPolicy: OnFailure
|
# restartPolicy: OnFailure
|
||||||
containers:
|
# containers:
|
||||||
- name: backup
|
# - name: backup
|
||||||
image: postgres:16
|
# image: postgres:16
|
||||||
command:
|
# command:
|
||||||
- /bin/sh
|
# - /bin/sh
|
||||||
- -c
|
# - -c
|
||||||
- |
|
# - |
|
||||||
pg_dump \
|
# pg_dump \
|
||||||
-h postgres-prod.default.svc.cluster.local \
|
# -h postgres-prod.default.svc.cluster.local \
|
||||||
-U $POSTGRES_USER \
|
# -U $POSTGRES_USER \
|
||||||
stripe_invoice \
|
# stripe_invoice \
|
||||||
| gzip \
|
# | gzip \
|
||||||
| aws s3 cp - s3://$S3_BUCKET/prod/stripe_invoice/$(date +%F).sql.gz
|
# | aws s3 cp - s3://$S3_BUCKET/prod/stripe_invoice/$(date +%F).sql.gz
|
||||||
envFrom:
|
# envFrom:
|
||||||
- secretRef:
|
# - secretRef:
|
||||||
name: postgres-prod-secret # PROD DB creds
|
# name: postgres-prod-secret # PROD DB creds
|
||||||
- secretRef:
|
# - secretRef:
|
||||||
name: aws-backup-secret # shared AWS creds
|
# name: aws-backup-secret # shared AWS creds
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue