Sign inSign up

fvanderbiest/volume-git-backup

By fvanderbiest

Updated over 8 years ago

Git commit docker volume content on file modified

Image
1

10K+

fvanderbiest/volume-git-backup repository overview

This image was developed with the GeoServer configuration directory (aka the ill-named "datadir") in mind, but should prove useful in other cases too.

When the configuration is updated through GeoServer admin UI, several files are modified in the "datadir", and the updateSequence parameter (in file global.xml) is incremented.

This image fits perfectly the use case:

  • it checks for updates on a file (through the use of inotify)
  • when changes are detected, the whole folder mounted onto /var/local/data is committed
  • the commit message stems from an evaluated command
  • commits are optionally pushed to a git repository

Example usage:

sync:
  image: fvanderbiest/volume-git-backup
  environment:
    WATCH_FILE: global.xml
    GIT_COMMIT_MESSAGE: printf "updateSequence "; grep updateSequence global.xml|sed -e 's#.*ce>\(.*\)</up.*#\1#'
    GIT_USERNAME: fvanderbiest
    GIT_EMAIL: [email protected]
  volumes:
    - geoserver_datadir:/var/local/data:rw

If the additional REMOTE_URL, REMOTE_NAME & TOKEN environment variables are set, commits are pushed (--force) to the master branch of the given repository. WARNING: this might result in data loss !

More on https://github.com/fvanderbiest/docker-volume-git-backup

Tag summary

Content type

Image

Digest

Size

75.6 MB

Last updated

over 8 years ago

docker pull fvanderbiest/volume-git-backup