To configure nxs-backup in docker-compose, you need to follow two steps.
1. Prepare docker-compose.yml with nxs-backup image and correct volume mounts. The directory in which the copies will be stored must be mounted as a volume. When backing up files, mount the files to be backed up as volumes (including if required a physical copy of the databases).
Example of docker-compose with two volumes:
services:
nxs-backup:
image: nixyslab/nxs-backup:latest
container_name: nxs-backup
command:
- nxs-backup
- -c
- /nxs-backup.conf
- start
- all
volumes:
- type: bind
source: ./backup
target: /var/nxs-backup/dump_tmp
- type: bind
source: /path/to/backup
target: /path/to/backup
configs:
- nxs-backup.conf
configs:
nxs-backup.conf:
file: ./nxs-backup.conf
When docker-compose is configured, you need to prepare nxs-backup.conf. Provided config from the repository contains the empty main config and the configs of the different types of jobs.
For more details on how to configure different types of backup jobs, see Usage
To run nxs-backup on a regular schedule, you must add a call of docker-compose with nxs-backup to your crontab or cron.d
This is an example of the cron file defining rules for Cron daemon to run nxs-backup by schedule:
/etc/cron.d/nxs-backup
0 2 * * * root /usr/bin/docker compose up -d -f /var/apps/nxs-backup/docker-compose.yml