Files
duplicati/README.md
Márcio Fernandes 4b7d6b8cd4
Some checks failed
/ build-docker-image (push) Failing after 12s
continous integration
2024-09-16 19:45:00 +01:00

154 lines
4.3 KiB
Markdown

# Duplicati
- [Docker](#docker)
- [Duplicati/mySql Client - image](#duplicatimysql-client---image)
- [Scripts](#scripts)
- [Backup mySql Database](#backup-mysql-database)
- [Influxdb Reporting](#influxdb-reporting)
- [Docker log](#docker-log)
- [Environment Variables](#environment-variables)
- [Exit Codes](#exit-codes)
- [cli](#cli)
- [Send Mail](#send-mail)
- [Settings](#settings)
- [Send Email](#send-email)
- [nginx](#nginx)
## Docker
### Duplicati/mySql Client - image
Image contains all scripts
[+ Information](docker/mysqlclient/README.md)
## Scripts
_Source: https://github.com/duplicati/duplicati/blob/master/Duplicati/Library/Modules/Builtin/run-script-example.sh_
### Backup mySql Database
Using option run-script-before-required on duplicati job set value to [script](scripts/duplicati-mysql-backup).
And job will create a database dump configured using environment variables.
Example:
--run-script-after=/duplicati-mysql-backup
[script](scripts/duplicati-mysql-backup)
```bash
#/etc/default/duplicati-mysql
MYSQL_HOST="mysqlserver"
MYSQL_USER="msqluser"
MYSQL_PASSWORD="msqlpassord"
MYSQL_DATABASE="msqlpassword"
MYSQL_BACKUP_FOLDER="/var/db-dumps"
```
### Influxdb Reporting
```bash
#/etc/default/duplicati-influxdb
INFLUXDB_SERVER=http://influxdb01.lan:8086
INFLUXDB_BUCKET=bucketname
INFLUXDB_ORG=orgname
INFLUXDB_TOKEN=influxdbname
#by default it uses client hostname in measurement field host
#to override uncomment
#INFLUXDB_CLIENT_HOSTNAME=xxx
```
Add [script](scripts/duplicati-influxdb-notify) to default settings.
Example:
--run-script-after=duplicati-influxdb-notify
### Docker log
Add [script](docker/scripts/dockerlog) to default settings.
Example:
--run-script-after=dockerlog
### Environment Variables
Source: https://github.com/duplicati/duplicati/blob/master/Duplicati/Library/Modules/Builtin/run-script-example.sh_
- DUPLICATI__EVENTNAME
Eventname is BEFORE if invoked as --run-script-before, and AFTER if invoked as --run-script-after. This value cannot be changed by writing it back!
- DUPLICATI__OPERATIONNAME
Operation name can be any of the operations that Duplicati supports. For example it can be "Backup", "Cleanup", "Restore", or "DeleteAllButN". This value cannot be changed by writing it back!
- DUPLICATI__RESULTFILE
If invoked as --run-script-after this will contain the name of the file where result data is placed. This value cannot be changed by writing it back!
- DUPLICATI__REMOTEURL
This is the remote url for the target backend. This value can be changed by echoing --remoteurl = "new value".
- DUPLICATI__LOCALPATH
This is the path to the folders being backed up or restored. This variable is empty operations other than backup or restore. The local path can contain : to separate multiple folders. This value can be changed by echoing --localpath = "new value".
- DUPLICATI__PARSED_RESULT
This is a value indicating how well the operation was performed. It can take the values: Unknown, Success, Warning, Error, Fatal.
### Exit Codes
The following exit codes are supported:
- 0: OK, run operation
- 1: OK, don't run operation
- 2: Warning, run operation
- 3: Warning, don't run operation
- 4: Error, run operation
- 5: Error don't run operation
- other: Error don't run operation
## cli
## Send Mail
```bash
#for testing
duplicati-cli send-mail --send-mail-password="pass" --send-mail-to="target@mail.lan" --send-mail-username="suer@mail.lan" --send-mail-url="smtp://serveraddress:25"
```
## Settings
### Send Email
```bash
--send-mail-any-operation=true
--send-mail-body=%RESULT%
--send-mail-level=all
--send-mail-subject=Duplicati %OPERATIONNAME% report for -> %backup-name%
--send-mail-to=destination@mail.lan
--send-http-result-output-format=Duplicati
--send-mail-url=smtp://serveraddress:25
--send-mail-password=password
--send-mail-username=user@mail.lan
```
## nginx
Example running on _duplicati sub folder
```bash
location /_duplicati/ {
proxy_pass http://<duplicatiserver>:8200/;
proxy_redirect ~^/(.*) $scheme://$http_host/_duplicati/$1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Url-Scheme $scheme;
}
```