bilbs84/cifs-backup

By bilbs84

Updated almost 2 years ago

A simple container that will backup desired files and folders on a schedule.

Image
Networking
Developer tools
Web servers
0

5.3K

bilbs84/cifs-backup repository overview

A simple utility for backing up configuration or other files and directories to a remote location using CIFS. Multiple locations, and configurations can be defined, and you can either create a .tar.gz archive of the location, or mirror the directory structure using rsync. Scheduling is performed using standard cron expressions. https://crontab.guru/ is useful for generating valid cron expressions. Ensure that there is no warning about the expression being Non standard, as it will not work.

Docker compose...

name: sample-docker-compose
services:
    cifs-backup:
        container_name: cifs-backup
        volumes:
            - /path/to/backup/folder:/src/backup1:ro
            - /path/to/backup/folder2:/src/backup2:ro
            - /path/to/config.ini:/etc/config.ini
        restart: unless-stopped
        image: /bilbs84/cifs-backup:latest
        environment:
            - TZ=Australia/Melbourne
        privileged: true

You can define as many folders to backup as you like, and you can name the container folders as you please, as these will all get defined in the configuration file. I like to mount them as read only to ensure that there is no possibility of messing anything up, but the scripts don't do anything the the mounted directories.

Here is a sample of config.ini


# Backups configuration

[Server] server=192.168.4.69 share=Backups user=backup password=backup source=/src/backup1/folder/to/backup compress=0 schedule=* * * * 0 [ZIP-Configs] server=192.168.4.169 share=configs user=user password=secret source=/src/backup2 compress=1 keep=3 # Excludes - must be relative to the /src/backups-folder location, for example - /src/backups2/folder-to-exclude exclude=folder-to-exlude exclude=folder-to-exclude/subfolder # Can also specify file types, or specific files to exclude exclude=*.sock schedule=0 * 3 * * # Backed up files will be stored in the share folder, under a subfolder of the section name [ZIP-Server] server=192.168.4.69 share=Backups user=backup password=backup source=/src/backup1/folder/to/backup compress=1 keep=2 schedule=30 * 3 * *

schedule is not required, and can be omitted from any configuration section. The rest of the options are required.

server The IP address of the server for backing up to.

share The share name of the server.

user Username associated with the share. Currently, I only offer support for password protected shares.

password The password for the share user.

source The location of the folder to backup. Specified in the docker run command, or compose file.

compress Set to 1 to compress the contents of the source folder.

keep How many days to keep compressed archives, any backups older than this will be removed.

exclude And exclusions for the backup (See example above)

schedule A cron expression for the schedule that the backups will run.

Tag summary

Content type

Image

Digest

sha256:7940ba027

Size

12.7 MB

Last updated

almost 2 years ago

docker pull bilbs84/cifs-backup:v1.4.23s-test