Coder Social home page Coder Social logo

anotherdaniel / nxtcldbackup Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 18 KB

Small alpine-based docker image that performs automated backup of a filesystem folder

License: Apache License 2.0

Dockerfile 42.74% Shell 57.26%
alpine backup docker unison

nxtcldbackup's Introduction

nxtcldbackup - and more, actually

This is a mini docker image that uses busybox crond to perform daily, weekly and monthly backups from a source to a target directory. It has been created with the intent to backup nextcloud data, where the nextcloud share is mounted via davfs. As davfs is not ... blazingly fast, I am using unison to perform the synchronization, as rsync turned out to be too slow to be useful in this context. However, this is not necessarily limited to backing up nextcloud file shares - should work for every case where you need to take somewhat structured backups/synchronization points of a directory that is available in your file system.

What it does

When brought up, this container will start crond, which in turn will run daily, weekly and monthly backup scripts.

  • the daily script uses unison to synchronize $SOURCE to $BACKUP/daily, every night
  • the weekly script uses unison to synchronize $BACKUP>/daily to $BACKUP>/weekly, every week
  • the monthly script uses tar to create a compressed archive of $BACKUP>/daily to $BACKUP>/monthly

Usage

The $SOURCE and $BACKUP directories are declared via volume mounts when starting the docker container - e.g. like this when using docker compose:

version: '3'

services:
  nxtcldbackup:
    container_name: nxtcld-backup
    build:
      context: .
      dockerfile: alpine.dockerfile
    init: true
    volumes:
      - unison-conf:/root/.unison
      - /mnt/nextcloud:/mnt/source
      - /mnt/raid1/nextcloud:/mnt/backup
      
volumes:
  unison-conf:

ToDos

  • once this has proved to work reasonably well, add logic to remove monthly backups older than a certain (configurable) time period
  • if we're bored, might add a configuration switch to use either rsync or unison

nxtcldbackup's People

Contributors

anotherdaniel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.