Backup S3 Production Bucket #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backup S3 Production Bucket | |
on: | |
workflow_dispatch: | |
schedule: | |
# At 01:27 UTC every Monday | |
- cron: '27 1 * * 1' | |
env: | |
S3_BUCKET_SOURCE_CONNECTION_STRING: :s3,provider=Scaleway,region=fr-par,endpoint=s3.fr-par.scw.cloud,access_key_id=${{ secrets.S3_ACCESS_KEY }},secret_access_key=${{ secrets.S3_SECRET_KEY }} | |
S3_BUCKET_DESTINATION_CONNECTION_STRING: :s3,provider=Scaleway,region=nl-ams,endpoint=s3.nl-ams.scw.cloud,access_key_id=${{ secrets.S3_ACCESS_KEY }},secret_access_key=${{ secrets.S3_SECRET_KEY }} | |
jobs: | |
backup-production: | |
name: Backup S3 in Production environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install rclone | |
run: | | |
apt-get update && apt-get install -y curl unzip | |
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip | |
unzip rclone-current-linux-amd64.zip | |
- name: Backup Upload S3 Bucket | |
run: ./rclone-*-linux-amd64/rclone sync -v --s3-storage-class=GLACIER ${{ env.S3_BUCKET_SOURCE_CONNECTION_STRING }}:envergo-stage/envergo-upload-prod/upload ${{ env.S3_BUCKET_DESTINATION_CONNECTION_STRING }}:envergo-prod-backup/upload | |
- name: Backup Media S3 Bucket | |
run: ./rclone-*-linux-amd64/rclone sync -v --s3-storage-class=GLACIER ${{ env.S3_BUCKET_SOURCE_CONNECTION_STRING }}:envergo-stage/envergo-media-prod ${{ env.S3_BUCKET_DESTINATION_CONNECTION_STRING }}:envergo-prod-backup/media |