You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.2 KiB
YAML

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
image: alpine
commands:
- apk add --no-cache openssl tar
- |
for dir in vaultwarden homebox koillection Homepage mealie; do
tar cvf - /backup/$dir | openssl enc -aes-256-cbc -salt -out "/backup/${dir}_backup.tar.enc" -k $ENCRYPTION_KEY
done
volumes:
- name: config_volumes
path: /backup
environment:
ENCRYPTION_KEY:
from_secret: encryption_key
- name: upload to s3
image: amazon/aws-cli
commands:
- pwd
- ls -lah /
- ls -lah /backup || echo "Backup directory is not available"
- find /backup -name "*.tar.enc" | while read file; do
aws s3 cp "${file}" "s3://ronnic-backup/${file#/backup/}";
done
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
- name: cleanup
image: alpine
commands:
- rm -f /backup/*.tar.enc
volumes:
- name: config_volumes
host:
path: /home/ronnic/Configs