Use this image to load your data from a provider into your binded folder. This folder will be used as input for restic. Restic creates a backup and upload it to your sftp host. You can configure a cron job to run the backup every day at a specific time and telegram will be used to send status reports. All of it in a container based manner.
These things are needed:
1. Bind
Restic looks for a folder /source to back up data. The behavior of this folder depends on the mode you select at the beginning of the script:
Bind Mounting:
/source.Internal Folder:
/source directory exists within the container./source directory will be lost.2. Provider
The provider mode dynamically writes data into the /source directory before restic creates a backup. This mode is useful when the data is generated by another service or application.
Providers currently supported:
/source./source./source.3. Environment Variables
There is a .env file where you can set all needed variables.
It describes every variable and provides an example value.
When used with Hetzner Storagebox, follow this guide
Currently, the private key should not have a password, it is not supported yet.
curl -O https://raw.githubusercontent.com/realAP/backup/main/run_backup.shcurl -O https://raw.githubusercontent.com/realAP/backup/main/.envchmod +x run_backup.shFill all needed variables in the .env file, it is provided with example values.
ENV_TELEGRAM_TOKEN token see hereENV_TELEGRAM_CHAT_ID see hereENV_SSH_PRIVATE_KEY_BASE64 you can use the following command to get the base64 encoded private key in the .env file
echo "ENV_SSH_PRIVATE_KEY_BASE64=$(cat <insert path of private key> | base64 -w 0)" >> .env.env file afterwardJust run the script ./run_backup.sh the backup will immediately start and repeat every day at 1am (default).
For the first run, the script will initialize the restic repository.
Just work as you would do it with restic.
Example: to get the latest snapshot from your data
./run_backup.sh restore latest --target /restore
/restore folder in the container which is binded to the hostas target use
/restoreto restore the data to the binded folder. For more information read the .env file example
You can use the script in two ways:
./run_backup.sh.env file. Remember /restore is always binded to the host. And /source folder is binded to the host when not set to none.
./run_backup.sh snapshots./run_backup.sh initAttention: the script will run the container which will be deleted after the command is executed. The data in the container is lost.
When you want to debug the container you can run the container in interactive mode.
Just run the script as follows ./run_backup.sh DEBUG and the container will start in interactive mode.
This is just used in the development phase.
You can bind the /var/log folder to your host to get the logs. For this set the SCRIPT_LOG_PATH variable in the .env file.
When the variable is not set then log files will be stored in the container.
This is just for debugging purposes.
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.
Content type
Image
Digest
sha256:6d9c2ab90…
Size
281.6 MB
Last updated
over 1 year ago
docker pull devp1337/backup