Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions code-for-philly/CronJob/code-for-philly-backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ spec:
export AWS_SECRET_ACCESS_KEY='$AWS_SECRET_ACCESS_KEY'

# install CLI dependencies
hab pkg install jarvus/restic core/gzip core/curl
hab pkg install core/gzip core/curl

if [ ! -f /bin/restic ]; then
hab pkg exec core/curl curl -L https://github.com/restic/restic/releases/download/v0.18.1/restic_0.18.1_linux_amd64.bz2 | bunzip2 > /bin/restic
chmod +x /bin/restic
fi

# get composite service name
composite_svc_name=\"\$(hab svc status | tail -n +2 | awk '{print \$1}' | grep -- "-composite/" | cut -d '/' -f 1,2)\"
Expand All @@ -66,7 +71,7 @@ spec:
--ignore-table=\"\${database_name}.sessions\" \
\"\${database_name}\" \
| hab pkg exec core/gzip gzip --rsyncable \
| hab pkg exec jarvus/restic restic backup \
| restic backup \
--host 'code-for-philly' \
--stdin \
--stdin-filename database.sql.gz
Expand All @@ -75,15 +80,15 @@ spec:

# snapshot data
echo 'Snapshotting site data'
hab pkg exec jarvus/restic restic backup \
restic backup \
/hab/svc/site/data \
--host 'code-for-philly' \
--exclude='*.log' \
--exclude='/hab/svc/site/data/media/*x*/**'

# prune aged snapshots
echo 'Pruning snapshots'
hab pkg exec jarvus/restic restic forget \
restic forget \
--host 'code-for-philly' \
--keep-last 3 \
--keep-daily 7 \
Expand Down