Using Ofelia with Frappe Docker for Auto Backup

We have deployed Frappe via docker using the single compose set-up. We found out that auto-backup is not running since it requires cron. A quick search led us to this fairly recent discussion in this forum that points to this documentation on how to set up cron job that will execute docker compose.

I recently found out about Ofelia, a job scheduler docker service that can be used in replacement to cron. Has anybody tried using this in production with Frappe?

1 Like

I use GitHub - crazy-max/swarm-cronjob: Create jobs on a time-based schedule on Docker Swarm

If I try Ofelia I’ll write a post or reply here. If you manage to setup then add how-to here on forum.

1 Like

Thank you for this. I am also trying Ofelia as of this moment but I cannot seem to make it work yet. I will post an update here also if any thing comes up.

I was able to execute scheduled backup by adding the following under the services configuration of the single compose file:

   # Configurations for frontend service from the single compose file will appear here
      #Allow Ofelia to exectue job in this container
      ofelia.enabled: "true"
      #Let the frappe user to execute the job called `site-backup` instead of root "frappe"
      #Schedule the job to be run daily "@daily"
      #This is the job to be executed "bench --site frontend backup"

    image: mcuadros/ofelia:latest
      - frontend
    command: daemon --docker
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ofelia-logs:/var/log/ofelia
      #Allow saving of logs when an error occured "/var/log/ofelia" "true"
      #Remove old logs by running a job in this container that deletes logs every day
      ofelia.job-local.clean-logs.schedule: "@daily"
      ofelia.job-local.clean-logs.command: "find /var/log/ofelia/ -type f -mtime +7 -print -delete"

The configuration I used here uses labels, but it can be set using a configuration file. More details can be found here.

What I am wondering now is why the Download Backups page of Frappe is still blank. What should I expect to see in this page anyway?