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
name: backup-multiple-configs
trigger:
schedule:
- cron: '0 2 * * 0' # This schedules the job to run at 2 AM every Sunday
steps:
- name: backup-and-encrypt
- name: backup-homebox
image: alpine
commands:
- apk add --no-cache openssl tar
- |
for dir in vaultwarden homebox koillection Homepage mealie; do
echo "Processing $dir"
# This line should create a unique backup file for each directory
tar cvf - "/backup/$dir" | openssl enc -aes-256-cbc -salt -out "/backup/${dir}_backup.tar.enc" -k "$ENCRYPTION_KEY" -md sha256
echo "${dir}_backup.tar.enc created."
done
- echo "Listing all backup files:"
- ls -lah /backup/*.tar.enc
- tar cvf - /backup/homebox | openssl enc -aes-256-cbc -salt -out /backup/homebox_backup.tar.enc -k "$ENCRYPTION_KEY" -md sha256
volumes:
- name: config_volumes
path: /backup
environment:
ENCRYPTION_KEY:
from_secret: encryption_key
- 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:
- name: config_volumes
path: /backup
@ -27,26 +27,58 @@ steps:
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
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:
AWS_ACCESS_KEY_ID:
from_secret: aws_access_key_id
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:
- name: config_volumes
path: /backup
- name: cleanup
image: alpine
commands:
- rm -f /backup/*.tar.enc
volumes:
- name: config_volumes
host:

Loading…
Cancel
Save