Compare commits

...

2 Commits

Author SHA1 Message Date
1b8e7fde9b . 2023-06-10 05:02:55 +01:00
f5c52389e6 . 2023-06-10 05:02:31 +01:00
5 changed files with 122 additions and 23 deletions

View File

@@ -1,5 +1,10 @@
# Duplicati
## Scripts
## Custom Docker Images
### Duplicati with mySql Client
@@ -32,24 +37,6 @@ duplicati-cli send-mail --send-mail-password="pass" --send-mail-to="target@mail.
```
## Scripts
### Transfer To another system
1. Copy docker compose and execute on another system
2. Check volumes and service started succesfully
3. Stop all compose services
4. Change volume on duplicati service to user a temporary volume example (duclicati_tmpdata)
5. Check if all volumes are writable on duplication service
6. Start only the duplicati service (with temporary volume) on target system
7. On source system Stop app services on docker compose except duplicati
8. Execute a full backup ou source system
9. On target system execute a manual restore to original destination
10. Stop duplicati
11. Change duplicati to use original volume
12. And change volumes on duplicati to RO
13. Start all services
14. Check everything ok
### Environment Variables
_Source: https://github.com/duplicati/duplicati/blob/master/Duplicati/Library/Modules/Builtin/run-script-example.sh_
- DUPLICATI__EVENTNAME

View File

@@ -1,9 +1,10 @@
#check ../README.md for more information
FROM duplicati/duplicati
RUN apt update && apt install -y default-mysql-client && rm -rf /var/lib/apt/lists/*
RUN mkdir duplicati-mysqlclient
RUN mkdir duplicati-mysqlclient/scripts
COPY /docker/mysqlclient/scripts/* /duplicati-mysqlclient/scripts/
RUN chmod +x /duplicati-mysqlclient/scripts/*
COPY /scripts/* /usr/local/bin
RUN chmod +x /usr/local/bin/duplicati-influxdb-notify
RUN chmod +x /usr/local/bin/duplicati-mysql-backup
EXPOSE 8200

View File

@@ -58,3 +58,20 @@ volumes:
duplicati-data:
db-dumps:
````
### Transfer To another system
1. Copy docker compose and execute on another system
2. Check volumes and service started succesfully
3. Stop all compose services
4. Change volume on duplicati service to user a temporary volume example (duclicati_tmpdata)
5. Check if all volumes are writable on duplication service
6. Start only the duplicati service (with temporary volume) on target system
7. On source system Stop app services on docker compose except duplicati
8. Execute a full backup ou source system
9. On target system execute a manual restore to original destination
10. Stop duplicati
11. Change duplicati to use original volume
12. And change volumes on duplicati to RO
13. Start all services
14. Check everything ok
### Environment Variables

View File

@@ -0,0 +1,94 @@
#!/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
export $(cat /etc/default/duplicati-influxdb)
fi
if [ -f "~/.config/duplicati-influxdb" ]; then
export $(cat ~/default/duplicati-influxdb)
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=""
MESSAGE_FIELD_VALUE=""
UNSCAPED=""
ESCAPED=""
escape_tag_str () {
ESCAPED=${UNSCAPED//[ ]/\\ }
}
if [[ ! -z "$HOSTNAME" ]]; then
UNSCAPED=$HOSTNAME
escape_tag_str
TAGS="${TAGS},host=${ESCAPED}"
MESSAGE_FIELD_VALUE="${MESSAGE_FIELD_VALUE} ${HOSTNAME}"
fi
if [[ ! -z "$DUPLICATI__EVENTNAME" ]]; then
UNSCAPED=$DUPLICATI__EVENTNAME
escape_tag_str
TAGS="${TAGS},eventName=\"${ESCAPED}\""
fi
if [[ ! -z "$DUPLICATI__OPERATIONNAME" ]]; then
UNSCAPED=$DUPLICATI__OPERATIONNAME
escape_tag_str
TAGS="${TAGS},operationName=${ESCAPED}"
MESSAGE_FIELD_VALUE="${MESSAGE_FIELD_VALUE} ${DUPLICATI__OPERATIONNAME}"
fi
if [[ ! -z "$DUPLICATI__backup_name" ]]; then
UNSCAPED=$DUPLICATI__backup_name
escape_tag_str
TAGS="${TAGS},backupName=${ESCAPED}"
MESSAGE_FIELD_VALUE="${MESSAGE_FIELD_VALUE} ${DUPLICATI__backup_name}"
fi
if [[ ! -z "$DUPLICATI__PARSED_RESULT" ]]; then
UNSCAPED=$DUPLICATI__PARSED_RESULT
escape_tag_str
TAGS="${TAGS},status=${ESCAPED}"
MESSAGE_FIELD_VALUE="${MESSAGE_FIELD_VALUE} ${DUPLICATI__PARSED_RESULT}"
fi
if [[ ! -z "$DUPLICATI__RESULTFILE" ]]; then
UNSCAPED=$DUPLICATI__RESULTFILE
escape_tag_str
TAGS="${TAGS},resultFile=${ESCAPED}"
fi
if [[ ! -z "$DUPLICATI__LOCALPATH" ]]; then
UNSCAPED=$DUPLICATI__LOCALPATH
escape_tag_str
TAGS="${TAGS},localPath=${ESCAPED}"
fi
FIELDS="message=\"Duplicati ${MESSAGE_FIELD_VALUE}\""
#echo $TAGS
curl --request POST \
"$INFLUXDB_SERVER/write?db=$INFLUXDB_BUCKET&ORG=$INFLUXDB_ORG" \
--header "Authorization: Token $INFLUXDB_TOKEN" \
--header "Content-Type: text/plain; charset=utf-8" \
--header "Accept: application/json" \
--data-raw "duplicati${TAGS} ${FIELDS}" > /dev/null 2>&1
exit 0