Controlling Backups in Docker Setup

Hello,

I am using the “frappe_docker” to build my image which is the base for my Frappe docker setup.

As the container does not have a “crontab” the Ofelia setup is introduced.

Yet, it is not working in my case as it should be.

Here are the details:

overrides/compose.backup-cron.yaml

is having:

services:
  cron:
    image: mcuadros/ofelia:latest
    depends_on:
      - scheduler
    command: daemon --docker
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

  scheduler:
    labels:
      ofelia.enabled: "true"
      ofelia.job-exec.datecron.schedule: "${BACKUP_CRONSTRING:-@every 6h}"
      ofelia.job-exec.datecron.command: "bench --site all backup --with-files --compress"
      ofelia.job-exec.datecron.user: "frappe"

The schedule variable is set as:
BACKUP_CRONSTRING=“0 22 * * *”

Both scheduler and cron containers are running.

Yet, there are backups happening every hour.

I checked the “crontab” for each user in the host system and there are no jobs with hourly schedule.

What is the problem?

1 Like

Looks like the issue with the CRONSTRING… :crossed_fingers:

BACKUP_CRONSTRING=“0 22 * * *”

Should be:

BACKUP_CRONSTRING=“0 0 22 * * *”

!!

Let’s see… I am testing now and will confirm.

1 Like

Hello,

This is to confirm… Ofelia adds a “seconds” place in the Cront String.
So, guys who are used to crontab be careful.

1 Like

How do you like running backups through ofelia? How do you manage getting the backups off-container once they are created?

Hello @trustedcomputer

It just does the job. Clean and efficient.

I simply use a job that runs a shell script which in turn executes "docker cp" command to collect the files and transfer it to the backup media/location.

Need further details or the above is clear?

1 Like