Code Monkey home page Code Monkey logo

docker-cron-backup's Introduction

Docker-cron-backup

This docker image is a simple way to backup files and databases

Usage

Run image and mount everythings you want in /backups ! You can use cron expression to plan backups or use external runner like crontab, kubernetes cronjobs, etc...

Backup every home

Mount /home to /backups then it will create a user.tar.gz for each users

docker run -d \
       -v /home:/backups
       beaukode/cron-backup

Backup every home and send them to remote sFTP

This exemple use openssh key from ~/.ssh/id_rsa

docker run -d \
       -v /home:/backups
       -v `echo $HOME`/.ssh/id_rsa:/id_rsa
       --env SFTP_HOST=127.0.0.1
       --env SFTP_USERNAME=backup
       --env SFTP_PRIVKEY=/id_rsa
       beaukode/cron-backup

Backup random directories

Mount them in /backups and it will create 2 archives (etc.tar.gz & webroot.tar.gz) every day at midnight

docker run -d \
       -v /etc:/backups/etc
       -v /var/www:/backups/webroot
       --env BACKUP_CRON=0 0 * * * \
       beaukode/cron-backup

Variables

  • BACKUP_CRON : Cron expression to plan backups, leave empty to run once then exit
  • BACKUP_SOURCE (Default: /backups) : Directory to backup. ONLY each subdirectory will be saved as tar.gz archives. Files and dots directories on this root directory is ignored

MySQL / MariaDB

  • MYSQL_HOST : Database server host
  • MYSQL_PORT (Default: 3306) : Database server port
  • MYSQL_USERNAME : Database account username
  • MYSQL_PASSWORD : Database account password

FTP

  • FTP_HOST : Send archives to this FTP host in a directory named FTP_PATH/DATE_TIME/
  • FTP_PORT (Default: 21) : FTP server port
  • FTP_PATH (Default: /) : Path on FTP to put backup in
  • FTP_USERNAME : FTP account username
  • FTP_PASSWORD : FTP account password

SFTP

  • SFTP_HOST : Send archives to this SFTP host in a directory named SFTP_PATH/DATE_TIME/
  • SFTP_PORT (Default: 22) : SFTP server port
  • SFTP_PATH (Default: .) : Path on SFTP to put backup in
  • SFTP_USERNAME : SFTP account username
  • SFTP_PASSWORD : SFTP account password
  • SFTP_PRIVKEY : Unencrypted OpenSSH private key (without passphrase !)

Openstack Swift

  • OS_AUTH_URL : Openstack auth URL (Auth version 2)
  • OS_USERNAME : Openstack account username
  • OS_PASSWORD : Openstack account password
  • OS_PROJECT_NAME : Openstack project or tenant name
  • OS_REGION_NAME : Openstack region name
  • OS_DELETE_AFTER : Openstack will delete file after X seconds (Leave blank to keep file forever)
  • OS_CONTAINER (Default: backups) : Openstack target container
  • OS_PATH (Default: /) : Openstack path for backups inside container

Contributions

You are welcome to contribute code and docs Please write tests and open pull request to integrate your work Spellchecking and more examples to this readme would be nice, english is not my primary language

Issues

Please report issues at GitHub https://github.com/beaukode/docker-cron-backup/issues

Todo

  • Database backups : mongodb
  • Openstack swift target
  • Amazon : S3, Glacier
  • Google cloud storage

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.