Skip to content

Docker Image for Cron backups of docker volumes - Canonical Repo at https://gitlab.com/librehealth/lsc/lh-docker-cron-backup

License

Notifications You must be signed in to change notification settings

LibreHealthIO/lh-docker-cron-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A docker image to perform cron backups of data in Docker containers

pipeline status

This is based off of OpenMRS Docker Cron Backup Image.

It retains the history, but the fork relationship is removed. The decision to push our own image is so that we have control over the image.

It tars directories DIR1, DIR2, etc. defined in the DIRS environment variable in the format DIR1:NAME1,DIR2:NAME2,... under /backup/NAME1-Y-m-d_H-M-S.tar.gz by defined SCHEDULE.

Example of use with docker-compose:

  backup:
    image: registry.gitlab.com/librehealth/lsc/lh-docker-cron-backup:latest
    depends_on:
      - api
    volumes:
      - mongo_data:/mongo_data
      - solr_data:/solr_data
      - ${BACKUP_DIR-./backups}:/backup
    environment:
      - DIRS=/mongo_data:mongo,/solr_data:solr
      - SCHEDULE=0 0 * * *
    restart: always
    healthcheck:
      test: "exit 0"

In order to backup on-demand run:

docker-compose run --rm backup bash backup.sh backup

In order to restore backups from the BACKUP_DIR run:

docker-compose run --rm backup bash backup.sh restore 2017-09-27_00-00-01

It's also possible to call scripts:

  backup:
    image: registry.gitlab.com/librehealth/lsc/lh-docker-cron-backup:latest
    volumes:
      - scripts:/scripts
    environment:
      - SCRIPT=/scripts/my_backup_script.sh
      - SCHEDULE=0 0 * * *
    restart: always
    healthcheck:
      test: "exit 0"

Releases

No releases published

Packages

No packages published