Skip to content

Commit 4e94112

Browse files
committed
make persistent backup script run once a month
1 parent 75be4f3 commit 4e94112

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

infra/base/templates/backup-prod-mongo.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,23 @@ spec:
3939
echo "Uploading backup to s3 bucket..."
4040
backup_date=$(date +%Y%m%d)
4141
aws s3 cp /tmp/prod_backup.gz s3://$BUCKET_NAME/daily/prod_backup-$backup_date.gz \
42-
--endpoint-url=https://$ACCOUNT_ID.r2.cloudflarestorage.com \
42+
--endpoint-url=$ENDPOINT_URL \
4343
--checksum-algorithm CRC32
4444
45-
month_day=$(date +%m%d)
46-
if [ "$month_day" = "0101" ] || [ "$month_day" = "0601" ]; then
45+
date_day=$(date +%d)
46+
if [ "$date_day" = "01" ]; then
4747
echo "Also uploading to persistent storage"
4848
aws s3 cp /tmp/prod_backup.gz s3://$BUCKET_NAME/persistent/prod_backup-$backup_date.gz \
49-
--endpoint-url=https://$ACCOUNT_ID.r2.cloudflarestorage.com \
49+
--endpoint-url=$ENDPOINT_URL \
5050
--checksum-algorithm CRC32
5151
fi
5252
5353
# Cleanup local files
5454
rm /tmp/prod_backup.gz
5555
echo "MongoDB backup completed successfully!"
5656
env:
57-
- name: ACCOUNT_ID
58-
value: ff660bd2dac18c00551ed509d24ef4d7
57+
- name: ENDPOINT_URL
58+
value: https://ff660bd2dac18c00551ed509d24ef4d7.r2.cloudflarestorage.com
5959
- name: BUCKET_NAME
6060
value: prod-mongo-backups
6161
envFrom:

0 commit comments

Comments
 (0)