feature/influxdb reporting #2
97
README.md
97
README.md
@@ -1,44 +1,46 @@
|
|||||||
# Duplicati
|
# Duplicati
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
## Scripts
|
### Duplicati/mySql Client - image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Custom Docker Images
|
|
||||||
|
|
||||||
### Duplicati with mySql Client
|
|
||||||
|
|
||||||
[+ Information](docker/mysqlclient/README.md)
|
[+ Information](docker/mysqlclient/README.md)
|
||||||
|
|
||||||
|
|
||||||
## 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"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Global Settings
|
|
||||||
|
|
||||||
```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
|
|
||||||
|
|
||||||
```
|
|
||||||
## Scripts
|
## Scripts
|
||||||
|
|
||||||
_Source: https://github.com/duplicati/duplicati/blob/master/Duplicati/Library/Modules/Builtin/run-script-example.sh_
|
_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=/root/repos/duplicate/scripts/uplicati-mysql-backup
|
||||||
|
|
||||||
|
[script](scripts/duplicati-mysql-backup)
|
||||||
|
|
||||||
|
|
||||||
|
### Influxdb Reporting
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#/etc/default/duplicati-influxdb
|
||||||
|
INFLUXDB_SERVER=http://influxdb01.lan:8086
|
||||||
|
INFLUXDB_BUCKET=bucketname
|
||||||
|
INFLUXDB_ORG=orgname
|
||||||
|
INFLUXDB_TOKEN=influxdbname
|
||||||
|
```
|
||||||
|
|
||||||
|
Add [script](scripts/duplicati-influxdb-notify) to default settings.
|
||||||
|
Example:
|
||||||
|
--run-script-after=/root/repos/duplicate/scripts/duplicati-influxdb-notify
|
||||||
|
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
Source: https://github.com/duplicati/duplicati/blob/master/Duplicati/Library/Modules/Builtin/run-script-example.sh_
|
||||||
|
|
||||||
- DUPLICATI__EVENTNAME
|
- 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!
|
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!
|
||||||
@@ -65,8 +67,7 @@ _Source: https://github.com/duplicati/duplicati/blob/master/Duplicati/Library/Mo
|
|||||||
|
|
||||||
### Exit Codes
|
### Exit Codes
|
||||||
|
|
||||||
_Source: https://github.com/duplicati/duplicati/blob/master/Duplicati/Library/Modules/Builtin/run-script-example.sh_
|
|
||||||
|
|
||||||
The following exit codes are supported:
|
The following exit codes are supported:
|
||||||
|
|
||||||
- 0: OK, run operation
|
- 0: OK, run operation
|
||||||
@@ -76,3 +77,35 @@ The following exit codes are supported:
|
|||||||
- 4: Error, run operation
|
- 4: Error, run operation
|
||||||
- 5: Error don't run operation
|
- 5: Error don't run operation
|
||||||
- other: 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
|
||||||
|
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#check ../README.md for more information
|
|
||||||
FROM duplicati/duplicati
|
FROM duplicati/duplicati
|
||||||
RUN apt update && apt install -y default-mysql-client && rm -rf /var/lib/apt/lists/*
|
RUN apt update && apt install -y default-mysql-client && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,20 @@
|
|||||||
# Duplicati / mySql Client
|
# Duplicati / mySql Client
|
||||||
|
|
||||||
Using option run-script-before-required on duplicati job set value to /duplicati-mysqlclient/scripts/backupdb.sh.
|
|
||||||
And job will create a database dump configured using docker environment variables
|
|
||||||
|
|
||||||
## Build Image
|
|
||||||
|
|
||||||
### docker
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
#Executed on repository root folder
|
#Executed on repository root folder
|
||||||
docker build -t duplicati-mysqlclient:latest -f docker/mysqlclient/Dockerfile .
|
docker build -t duplicati-mysqlclient:latest -f docker/mysqlclient/Dockerfile .
|
||||||
|
|
||||||
```
|
```
|
||||||
### tar
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
#Executed on repository root folder
|
#Executed on repository root folder
|
||||||
sudo docker build -t duplicati-mysqlclient:latest -f docker/mysqlclient/Dockerfile --output type=tar,dest=build/duplicati-mysqlclient.tar .
|
sudo docker build -t duplicati-mysqlclient:latest -f docker/mysqlclient/Dockerfile --output type=tar,dest=build/duplicati-mysqlclient.tar .
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Portainer
|
## Portainer
|
||||||
|
|
||||||
Images -> Build a new Image -> URL
|
Images -> Build a new Image -> URL
|
||||||
|
|
||||||
@@ -33,9 +25,8 @@ Images -> Build a new Image -> URL
|
|||||||
**Dockerfile path:** docker/mysqlclient/Dockerfile
|
**Dockerfile path:** docker/mysqlclient/Dockerfile
|
||||||
|
|
||||||
|
|
||||||
## Run Container
|
|
||||||
|
|
||||||
### Docker Compose
|
## Docker Compose
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
version: "3"
|
||||||
@@ -48,6 +39,10 @@ services:
|
|||||||
- MYSQL_USER=${MYSQL_USER}
|
- MYSQL_USER=${MYSQL_USER}
|
||||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||||
- DESTINATION=/db-dumps
|
- DESTINATION=/db-dumps
|
||||||
|
- INFLUXDB_SERVER=${INFLUXDB_SERVER}
|
||||||
|
- INFLUXDB_BUCKET=${INFLUXDB_BUCKET}
|
||||||
|
- INFLUXDB_ORG=${INFLUXDB_ORG}
|
||||||
|
- INFLUXDB_TOKEN=:{INFLUXDB_TOKEN}
|
||||||
volumes:
|
volumes:
|
||||||
- duplicati-data:/data
|
- duplicati-data:/data
|
||||||
- db-dumps:/db-dumps
|
- db-dumps:/db-dumps
|
||||||
@@ -57,7 +52,8 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
duplicati-data:
|
duplicati-data:
|
||||||
db-dumps:
|
db-dumps:
|
||||||
````
|
```
|
||||||
|
|
||||||
### Transfer To another system
|
### Transfer To another system
|
||||||
1. Copy docker compose and execute on another system
|
1. Copy docker compose and execute on another system
|
||||||
2. Check volumes and service started succesfully
|
2. Check volumes and service started succesfully
|
||||||
@@ -74,4 +70,3 @@ volumes:
|
|||||||
13. Start all services
|
13. Start all services
|
||||||
14. Check everything ok
|
14. Check everything ok
|
||||||
|
|
||||||
### Environment Variables
|
|
||||||
15
scripts/duplicati-influxdb-notify
Normal file → Executable file
15
scripts/duplicati-influxdb-notify
Normal file → Executable file
@@ -1,10 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#/etc/default/influxdb-connection example
|
|
||||||
#INFLUDB_SERVER=http://192.168.1.201:8086
|
|
||||||
#INFLUDB_BUCKET=bucketname
|
|
||||||
#INFLUDB_ORG=orgname
|
|
||||||
#INFLUDB_TOKEN=Token xxxx
|
|
||||||
if [ -f "/etc/default/duplicati-influxdb" ]; then
|
if [ -f "/etc/default/duplicati-influxdb" ]; then
|
||||||
export $(cat /etc/default/duplicati-influxdb)
|
export $(cat /etc/default/duplicati-influxdb)
|
||||||
fi
|
fi
|
||||||
@@ -13,15 +9,6 @@ if [ -f "~/.config/duplicati-influxdb" ]; then
|
|||||||
export $(cat ~/default/duplicati-influxdb)
|
export $(cat ~/default/duplicati-influxdb)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#duplicati
|
|
||||||
#DUPLICATI__EVENTNAME="zbf dc fbz"
|
|
||||||
#DUPLICATI__OPERATIONNAME="yy"
|
|
||||||
#DUPLICATI__PARSED_RESULT="p gfh uasd"
|
|
||||||
#DUPLICATI__backup_name="puggb"
|
|
||||||
#DUPLICATI__RESULTFILE="sd gasd"
|
|
||||||
#DUPLICATI__LOCALPATH="sagd"
|
|
||||||
#
|
|
||||||
|
|
||||||
TAGS=""
|
TAGS=""
|
||||||
MESSAGE_FIELD_VALUE=""
|
MESSAGE_FIELD_VALUE=""
|
||||||
|
|
||||||
|
|||||||
1
scripts/duplicati-mysql-backup
Normal file → Executable file
1
scripts/duplicati-mysql-backup
Normal file → Executable file
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# mysql database backup.
|
# mysql database backup.
|
||||||
# executed by duplicati run-script-before-required
|
# executed by duplicati run-script-before-required
|
||||||
# required environment variables:
|
# required environment variables:
|
||||||
|
|||||||
Reference in New Issue
Block a user