borg
This commit is contained in:
parent
a2e27c5316
commit
d173dd6e4a
3 changed files with 32 additions and 0 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,2 +1,14 @@
|
|||
FROM sutty/monit:latest
|
||||
MAINTAINER "f <f@sutty.nl>"
|
||||
|
||||
ENV BORG_HOST_ID borg
|
||||
ENV BORG_PASSPHRASE ""
|
||||
ENV KEEP 30
|
||||
|
||||
COPY ./monit.conf /etc/monit.d/borg.conf
|
||||
COPY ./backup.sh /usr/local/bin/backup
|
||||
|
||||
RUN apk add --no-cache borgbackup
|
||||
|
||||
VOLUME /srv/data
|
||||
VOLUME /srv/backups
|
||||
|
|
16
backup.sh
Normal file
16
backup.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Password can't be empty
|
||||
test -n "${BORG_PASSPHRASE}"
|
||||
|
||||
date="$(date +%F)"
|
||||
orig=/srv/data
|
||||
dest=/srv/backups
|
||||
|
||||
test -f "${dest}/config" || borg init --encryption=repokey "${dest}"
|
||||
|
||||
borg create -v --stats "${dest}::${date}" "${orig}"
|
||||
borg prune -v --stats --keep-daily ${KEEP} "${dest}"
|
||||
|
||||
exit $?
|
4
monit.conf
Normal file
4
monit.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
check program backup
|
||||
with path "/usr/local/bin/backup"
|
||||
if status != 0 then alert
|
||||
every "53 3 * * *"
|
Loading…
Reference in a new issue