Skip to content

Prod Backup

Prod Backup #2

Workflow file for this run

name: Prod Backup
on:
schedule:
- cron: '0 0 * * *'
jobs:
backup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Copy db file from server
run: |
mkdir ./backup
flyctl ssh sftp get /data/verdant.sqlite ./backup/verdant.sqlite
flyctl ssh sftp get /data/database.sqlite ./backup/database.sqlite
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
FLY_APP_NAME: aglio
- name: Upload to S3 in directory by date
uses: jakejarvis/s3-sync-action@master
with:
args: --follow-symlinks
env:
AWS_S3_BUCKET: prod-db-backups.gnocchi.club
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
SOURCE_DIR: ./backup
# date string
DEST_DIR: ${{ steps.date.outputs.date }}