pull/5/head
Grant Bevis 2017-08-16 12:37:29 +01:00
commit 609e879ffd
4 zmienionych plików z 106 dodań i 0 usunięć

29
Dockerfile 100644
Wyświetl plik

@ -0,0 +1,29 @@
FROM alpine:latest
MAINTAINER b3vis
COPY entry.sh /entry.sh
RUN apk upgrade --no-cache \
&& apk add --no-cache \
curl \
sshfs \
python3 \
py3-msgpack \
ca-certificates \
openssl-dev \
lz4-dev \
musl-dev \
gcc \
python3-dev \
acl-dev \
&& pip3 install --upgrade pip \
&& pip3 install --upgrade borgbackup \
&& pip3 install --upgrade borgmatic \
&& mkdir /config /cache /source /repository \
&& rm -rf /var/cache/apk/* \
&& chmod 755 /entry.sh
VOLUME /config
VOLUME /cache
VOLUME /source
VOLUME /repository
# Set Envars
ENV BORG_CACHE_DIR /cache
CMD ["/entry.sh"]

71
README.md 100644
Wyświetl plik

@ -0,0 +1,71 @@
# Borgmatic Container
<img src="https://camo.githubusercontent.com/24287203ea7c7906b72341780f067ad44408ff99/68747470733a2f2f63646e2e7261776769742e636f6d2f77697474656e2f626f72676d617469632f6d61737465722f7374617469632f626f72676d617469632e737667" width="200" height="200" />
### Description
A little container I wrote to automate my [Borgbackup](https://github.com/borgbackup)'s using the excellent [Borgmatic](https://github.com/witten/borgmatic).
It uses cron to run the backups at a time you can configure in `crontab.txt`.
### Usage
You will need to create crontab.txt and your borgmatic config.yml and mount these files into your /config directory. When the container starts it creates the crontab from /config/crontab.txt and starts crond.
### Example run command
```
docker run -d \
-v /home:/source/home:ro \
-v /mnt/borg:/repository \
-v /srv/borgmatic/config:/config \
-v /srv/borgmatic/cache:/cache \
b3vis/borgmatic
```
### Layout
#### /config
Where you need to create crontab.txt and your borgmatic config.yml
#### crontab.txt example
In this file set the time you wish for your backups to take place default is 1am every day. In here you can add any other tasks you want ran
```
0 1 * * * root PATH=$PATH:/usr/bin /usr/bin/borgmatic -c /config -v 1 2>&1
```
#### /cache
A non volatile place to store the borg chunk cache
#### /source
Your data you wish to backup
#### /repository
Mount your borg backup repository here
### Dockerfile
```
FROM alpine:latest
MAINTAINER b3vis
COPY entry.sh /entry.sh
RUN apk upgrade --no-cache \
&& apk add --no-cache \
curl \
sshfs \
python3 \
py3-msgpack \
ca-certificates \
openssl-dev \
lz4-dev \
musl-dev \
gcc \
python3-dev \
acl-dev \
&& pip3 install --upgrade pip \
&& pip3 install --upgrade borgbackup \
&& pip3 install --upgrade borgmatic \
&& mkdir /config /cache /source /repository \
&& rm -rf /var/cache/apk/* \
&& chmod 755 /entry.sh
VOLUME /config
VOLUME /cache
VOLUME /source
VOLUME /repository
# Set Envars
ENV BORG_CACHE_DIR /cache
CMD ["/entry.sh"]
```

1
crontab.txt 100644
Wyświetl plik

@ -0,0 +1 @@
0 1 * * * root PATH=$PATH:/usr/bin /usr/bin/borgmatic -c /config -v 1 2>&1

5
entry.sh 100644
Wyświetl plik

@ -0,0 +1,5 @@
#!/bin/sh
# Import your cron file
/usr/bin/crontab /config/crontab.txt
# Start cron
/usr/sbin/crond -f -L /config/crond.log