mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-23 00:05:09 +00:00
- 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.
26 lines
No EOL
1.2 KiB
Bash
Executable file
26 lines
No EOL
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Path to your docker-compose files
|
|
COMPOSE_FILES="-f compose.yaml -f overrides/compose.mariadb.yaml -f overrides/compose.redis.yaml -f overrides/compose.https.yaml"
|
|
|
|
# Create backup with files
|
|
docker compose $COMPOSE_FILES exec backend bench --site all backup --with-files
|
|
|
|
# Optional: Copy backups to a local directory outside the Docker volume
|
|
# Create a backups directory if it doesn't exist
|
|
mkdir -p ./backups
|
|
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
|
docker compose $COMPOSE_FILES exec backend mkdir -p /home/frappe/frappe-bench/backups-export
|
|
docker compose $COMPOSE_FILES exec backend cp -r /home/frappe/frappe-bench/sites/*/backup/* /home/frappe/frappe-bench/backups-export/
|
|
|
|
# Copy the backups from the container to the host
|
|
docker compose $COMPOSE_FILES cp backend:/home/frappe/frappe-bench/backups-export/ ./backups/$TIMESTAMP
|
|
|
|
# Cleanup the temporary directory in the container
|
|
docker compose $COMPOSE_FILES exec backend rm -rf /home/frappe/frappe-bench/backups-export
|
|
|
|
echo "Backup completed at ./backups/$TIMESTAMP"
|
|
|
|
# Optional: Implement backup rotation/cleanup to prevent using too much disk space
|
|
# Keep only the last 7 days of backups
|
|
find ./backups -type d -mtime +7 -exec rm -rf {} \; 2>/dev/null || true |