diff --git a/.autorestic.yaml b/.autorestic.yaml new file mode 100644 index 0000000..7a8d19c --- /dev/null +++ b/.autorestic.yaml @@ -0,0 +1,11 @@ +version: 2 + +locations: + joplin: + from: /source/joplin/data + to: joplin-nfs + +backends: + joplin-nfs: + type: local + path: /backups/joplin diff --git a/.gitignore b/.gitignore index adbb97d..43c96a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -data/ \ No newline at end of file +data/ +.env \ No newline at end of file diff --git a/README.md b/README.md index 62dda4a..a981c9f 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,20 @@ - Joplin data - InfluxDB data +## Implementation + +- 1 restic repo per service getting backed up +- NFS share from NAS is mounted at `/mnt/backups` into the LXC + - Reference: [[Tutorial] Mounting NFS share to an unprivileged LXC](https://forum.proxmox.com/threads/tutorial-mounting-nfs-share-to-an-unprivileged-lxc.138506/) +- Needed to create the repo with the `restic/restic` image before running the `autorestic` service + - Create at `/mnt/backups/` with `create_restic_repo.sh` + ## Tools ### [restic / **restic**](https://github.com/restic/restic) -[Documentation](https://restic.readthedocs.io/en/stable/index.html) +- [Documentation](https://restic.readthedocs.io/en/stable/index.html) +- [DockerHub](https://hub.docker.com/r/restic/restic) ### [cupcakearmy / **autorestic**](https://github.com/cupcakearmy/autorestic) diff --git a/create_restic_repo.sh b/create_restic_repo.sh new file mode 100755 index 0000000..7eb28dd --- /dev/null +++ b/create_restic_repo.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "$(tput setaf 1)No repo name specified$(tput sgr0)" + echo "Usage: $0 " + exit 1 +else + # Assign the directory to a variable + REPO_PATH=/mnt/backups/$1 + echo -e "Creating $(tput setaf 4)$REPO_PATH$(tput sgr0)" +fi + +docker run -it --rm \ +-v /mnt/backups:/mnt/backups \ +restic/restic \ +init --repo $REPO_PATH \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..242e389 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.9' + +services: + autorestic: + image: cupcakearmy/autorestic:latest + env_file: + - .env + volumes: + - .autorestic.yaml:/.autorestic.yaml + - ../:/source:ro + - backups:/backups + - /var/run/docker.sock:/var/run/docker.sock + command: [ + "autorestic", + "backup", + "-va", + "-c", "/.autorestic.yaml" + ] + +volumes: + backups: + driver: local + driver_opts: + type: none + o: bind + device: /mnt/backups \ No newline at end of file