frappe_docker/s3-backup.yaml
Tushar 56cef5fe68 feat: add backup and email configuration scripts and environment files
- Introduced backup scripts for S3 and Google Drive, including cron job setup for automated backups.
- Added email configuration script to set up SMTP settings for ERPNext.
- Created environment files for backup configurations (backup.env, gdrive-backup.env, email.env).
- Updated docker-compose files to support new backup services and configurations.
2025-03-20 10:44:25 +00:00

34 lines
No EOL
1.1 KiB
YAML

services:
backup:
image: frappe/erpnext:v15.54.4
entrypoint: ["bash", "-c"]
command:
- |
# Create a backup of all sites with files
bench --site all backup --with-files
# Upload backups to S3
for site_path in /home/frappe/frappe-bench/sites/*/; do
site=$(basename "$site_path")
if [ -d "${site_path}backup" ]; then
echo "Pushing backup for $site to S3..."
cd "${site_path}backup"
# Use aws cli to sync backups to S3
aws s3 sync . s3://${S3_BUCKET}/${site}/$(date +%Y-%m-%d)/
fi
done
# Cleanup old backups (keeping last 7 days)
find /home/frappe/frappe-bench/sites/*/backup -type f -mtime +7 -delete
environment:
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- S3_BUCKET=${S3_BUCKET}
- AWS_DEFAULT_REGION=${S3_REGION}
volumes:
- sites:/home/frappe/frappe-bench/sites
volumes:
sites:
external: true
name: frappe_docker_sites