Use this image to sync your nextcloud to a local directory. This will be mounted in your container and used as input for restic. Restic creates a backup and upload it to your sftp host. All of it in a container based manner.
There are two modes.
- Default mode is running the script without any arguments.
- e.g.
./run_backup.sh
- e.g.
- Argument mode. Use the script as you would use restic. The script will run the container in which restic is started and places every argument behind it.
You have access to all the environment variables set in the
.env
file../run_backup.sh snapshots
./run_backup.sh init
- and more...
These things are needed:
- Nextcloud Server
- SFTP Server
- Docker
- a device where the backup is running
Place your public key at the sftp server and use the private key to log into it.
Currently, the private key should not have a password, it is not supported yet. This is not ideal, in further versions private key with passwords are supported and recommended to use.
- clone the repository
https://github.com/realAP/backup.git
cd backup/docker
- build the docker image
docker build . -t restic
Fill all variables in the .env
file, it is provided with example values.
In first place a repository has to be created on the remote (sftp).
./run_backup.sh init
this will initialize a repository- exit the container
Just run the script ./run_backup.sh
it will immediately sync the nextcloud and creates a backup, the status report will be sent via telegram.
This repeats every day at 1am (default), feel free to adjust the cron
variable in the run_backup.sh
Just work as you would do it with restic.
When cloned the repo there is an empty folder called restore
which is mounted into the container under /restore.
This folder can be used as target for your restored data.
Example: to get the latest snapshot from your data
./run_backup.sh restore latest --target /restore
The run_backup.sh
has a flag
"DEBUG"=0
which disables"DEBUG"=1
which enables debugging- the container will start and opens a bash terminal
The log
folder is mounted to /var/log
which enables to have access to different kinds of log files.
TBD
I have used https://duplicati.com/ which i can recommend. My problem is duplicati is not supported for my hardware anymore. This is the reason for this project.
I have nextcloud hosted by hetzner (https://www.hetzner.com/storage/storage-share/) and storagebox (https://www.hetzner.com/storage/storage-box/) a sftp hosted platform. The backup should work without hetzner it just needs a nextcloud server and sftp access.