Question - how to automate the file backup?

Does anyone find a way to automate the files backup in the eramba, i have seen then we can do the backup of the database using the cron expression and that is also saved in the docker container at the directory:- /var/www/eramba/app/upgrade/data/backups, but can we do the same with files as well, will be helpful while restoring from the backup.

if you run dockers you use volumes … you just backup the entire volume right? that will include everything you need to restore the system.

@kisero , same way we can do for the db backups as well, take the complete directory as backup, but there is some specific path where they are storing the db files, i am looking for a same directory for the files backup as well, otherwise complete directory backup is the only option in the end.

is not good idea to narrow down things that much, we build software and make many changes all the time, we do not communicate software, architecture, etc changes to users so you might one day doing backups of an old directory.

Hi,

I’ve devised a backup solution for Eramba files that operates on a server hosting Docker. This method involves creating a systemd service and timer to automate backups to AWS S3. While there might be alternative approaches, this solution is effective for me.

Quick Overview:

  1. Create the erambaBackup service and timer files as described below.
  2. Ensure these files have the correct permissions (root:root, 644).
  3. Reload the systemctl daemon with systemctl daemon-reload.
  4. Start and enable the timer using systemctl start erambaBackup.timer and systemctl enable erambaBackup.timer.

Detailed Setup:

Service File: /etc/systemd/system/erambaBackup.service This service is responsible for executing the backup process. It includes steps to set a dynamic environment variable for the current date, perform the backup to S3, and then clean up the environment variable.

[Unit]
Description=Service to backup Eramba files to S3
Wants=erambaBackup.timer

[Service]
Type=oneshot
EnvironmentFile=-/dev/shm/tcs.env
ExecStartPre=/bin/sh -c 'echo date=$(date +%%Y/%%m/%%d/%%H) > /dev/shm/tcs.env'
ExecStart=/usr/bin/aws s3 sync /var/lib/docker/volumes/eramba_data/_data/ s3://<BUCKET_NAME>/<KEY>/${date}/
ExecStartPost=/bin/rm -f /dev/shm/tcs.env

[Install]
WantedBy=multi-user.target

Timer File: /etc/systemd/system/erambaBackup.timer The timer is configured to trigger the backup service at specified times on weekdays.

[Unit]
Description=Timer for Eramba backup service
Requires=erambaBackup.service

[Timer]
Unit=erambaBackup.service
OnCalendar=Mon..Fri *-*-* 8,12,16,20:00:00

[Install]
WantedBy=timers.target

Notes:

  • Make sure to replace <BUCKET_NAME> and <KEY> with your actual AWS S3 bucket name and key.
  • For more information on scheduling tasks with systemd timers, I found this Fedora Magazine article helpful: Systemd Timers for Scheduling Tasks.

I hope this solution helps others looking for a reliable method to back up their Eramba files. Feedback or suggestions for improvement are welcome.