separate backups
continuous-integration/drone/push Build is passing Details

main
ronnic 2 years ago
parent 8e70b51ae1
commit 34604d66fc

@ -2,24 +2,24 @@ kind: pipeline
type: docker type: docker
name: backup-multiple-configs name: backup-multiple-configs
trigger:
schedule:
- cron: '0 2 * * 0' # This schedules the job to run at 2 AM every Sunday
steps: steps:
- name: backup-and-encrypt - name: backup-homebox
image: alpine image: alpine
commands: commands:
- apk add --no-cache openssl tar - apk add --no-cache openssl tar
- | - tar cvf - /backup/homebox | openssl enc -aes-256-cbc -salt -out /backup/homebox_backup.tar.enc -k "$ENCRYPTION_KEY" -md sha256
for dir in vaultwarden homebox koillection Homepage mealie; do volumes:
echo "Processing $dir" - name: config_volumes
# This line should create a unique backup file for each directory path: /backup
tar cvf - "/backup/$dir" | openssl enc -aes-256-cbc -salt -out "/backup/${dir}_backup.tar.enc" -k "$ENCRYPTION_KEY" -md sha256 environment:
echo "${dir}_backup.tar.enc created." ENCRYPTION_KEY:
done from_secret: encryption_key
- echo "Listing all backup files:"
- ls -lah /backup/*.tar.enc - name: backup-vaultwarden
image: alpine
commands:
- apk add --no-cache openssl tar
- tar cvf - /backup/vaultwarden | openssl enc -aes-256-cbc -salt -out /backup/vaultwarden_backup.tar.enc -k "$ENCRYPTION_KEY" -md sha256
volumes: volumes:
- name: config_volumes - name: config_volumes
path: /backup path: /backup
@ -27,26 +27,58 @@ steps:
ENCRYPTION_KEY: ENCRYPTION_KEY:
from_secret: encryption_key from_secret: encryption_key
- name: upload to s3 - name: backup-koillection
image: alpine
commands:
- apk add --no-cache openssl tar
- tar cvf - /backup/koillection | openssl enc -aes-256-cbc -salt -out /backup/koillection_backup.tar.enc -k "$ENCRYPTION_KEY" -md sha256
volumes:
- name: config_volumes
path: /backup
environment:
ENCRYPTION_KEY:
from_secret: encryption_key
- name: backup-Homepage
image: alpine
commands:
- apk add --no-cache openssl tar
- tar cvf - /backup/Homepage | openssl enc -aes-256-cbc -salt -out /backup/Homepage_backup.tar.enc -k "$ENCRYPTION_KEY" -md sha256
volumes:
- name: config_volumes
path: /backup
environment:
ENCRYPTION_KEY:
from_secret: encryption_key
- name: backup-mealie
image: alpine
commands:
- apk add --no-cache openssl tar
- tar cvf - /backup/mealie | openssl enc -aes-256-cbc -salt -out /backup/mealie_backup.tar.enc -k "$ENCRYPTION_KEY" -md sha256
volumes:
- name: config_volumes
path: /backup
environment:
ENCRYPTION_KEY:
from_secret: encryption_key
- name: upload-to-s3
image: amazon/aws-cli image: amazon/aws-cli
commands: commands:
- | - |
find /backup -name "*.tar.enc" -exec sh -c 'aws s3 cp "{}" "s3://ronnic-backup/${1#/backup/}"' _ {} \; find /backup -type f -name "*.tar.enc" -exec aws s3 cp "{}" "s3://ronnic-backup/{}" \;
environment: environment:
AWS_ACCESS_KEY_ID: AWS_ACCESS_KEY_ID:
from_secret: aws_access_key_id from_secret: aws_access_key_id
AWS_SECRET_ACCESS_KEY: AWS_SECRET_ACCESS_KEY:
from_secret: aws_secret_access_key from_secret: aws_secret_access_key
AWS_DEFAULT_REGION: us-west-1 AWS_DEFAULT_REGION:
from_secret: aws_default_region
volumes: volumes:
- name: config_volumes - name: config_volumes
path: /backup path: /backup
- name: cleanup
image: alpine
commands:
- rm -f /backup/*.tar.enc
volumes: volumes:
- name: config_volumes - name: config_volumes
host: host:

Loading…
Cancel
Save