Skip to content

Commit

Permalink
Testing with curl
Browse files Browse the repository at this point in the history
  • Loading branch information
JS Fillman committed Apr 3, 2024
1 parent aa925d0 commit 916b1d8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
jobs:
build-push:
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
uses: kbase/.github/.github/workflows/reusable_build-push.yml@develop
with:
name: '${{ github.event.repository.name }}-develop'
tags: br-${{ github.ref_name }}
Expand Down
22 changes: 13 additions & 9 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ A robust zip & upload utility for sending archives to a remote location.

### Variables

- `DUMP_BASE` - The base directory for backup dumps (default `/dump`)
- `DUMP_RETENTION` - The number of days to keep uncompressed backups locally
- `REMOTE` - The remote location to sync backups to
- `SECRET` - The encryption key for 7zip
- `SLACK_CHANNEL` - The slack channel to send notifications to
- `SLACK_WEBHOOK` - The webhook URL for slack notifications
- `ZIP_BASE` - The base filename, minus date, for the compressed backups
- `ZIP_DIR` - The directory to store all compressed backups (default `/zip`)
- `ZIP_RETENTION` - The number of days to keep compressed backups locally
| Variable | Description | Default |
|-----------------|---------------------------------------------------|---------|
| `BUCKET` | The bucket to store the backups | |
| `BUCKET_PATH` | The path within the bucket to store the backups | |
| `DUMP_BASE` | The base directory for backup dumps | `/dump` |
| `DUMP_RETENTION`| The number of days to keep uncompressed backups locally | |
| `REMOTE` | The remote location to sync backups to | |
| `SECRET` | The encryption key for 7zip | |
| `SLACK_CHANNEL` | The slack channel to send notifications to | |
| `SLACK_WEBHOOK` | The webhook URL for slack notifications | |
| `ZIP_BASE` | The base filename, minus date, for the compressed backups | |
| `ZIP_DIR` | The directory to store all compressed backups | `/zip` |
| `ZIP_RETENTION` | The number of days to keep compressed backups locally | |
7 changes: 6 additions & 1 deletion app/zip2cloud
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ ZIP_RETENTION=4
#echo "Deleting database archives older than 30 days"
#/usr/bin/find ${ZIP_DIR} -mtime +30 -type f -name "${ZIP_BASE}*" -print -exec rm {} \;

# Delete all old backups, except the last #, as defined by $ZIP_RETENTION
# Delete all old zip files, except the last N+1, as defined by $ZIP_RETENTION
ls -t ${ZIP_DIR}/${ZIP_BASE}*.{7z,md5} | tail -n +$((${ZIP_RETENTION} + 1)) | xargs rm -f

# Delete all old backup dumps, except the last N+1, as defined by $DUMP_RETENTION
find ${DUMP_BASE} -type d -regextype posix-extended -regex ".*/[0-9]{4}-[0-9]{2}-[0-9]{2}$" -print0 | xargs -0 ls -td | tail -n +$((${DUMP_RETENTION} + 1)) | xargs -I {} rm -rf {}
# ls -t ${DUMP_BASE}/* | tail -n +$((${DUMP_RETENTION} + 1)) | xargs rm -f


# Get list of remote backups
remote_files=$(rclone ls remote:${BUCKET}/${BUCKETPATH} | grep 7z | awk '{print $2}' | rev | cut -d. -f2- | rev)
# Pull remote md5 sums for each remote backup into `tmp_md5` directory
Expand Down

0 comments on commit 916b1d8

Please sign in to comment.