This commit is contained in:
2022-10-09 14:15:23 +01:00
parent 6b2ea052e2
commit 2a8f3daf08
3 changed files with 38 additions and 11 deletions

View File

@@ -1,4 +1,10 @@
# duplicati
# Duplicati
## Custom Docker Images
### Duplicati with mySql Client
[+ Information](../docker/../duplicati/docker/sqlclient/README.md)
## Scripts

View File

@@ -0,0 +1,21 @@
# Duplicati / mySql Client
## Build
```bash
#example where docker root folder build command is the git repository root folder
docker build -t duplicati-sqlclient:latest -f ./docker/sqlclient/Dockerfile .
```
### Portainer
Images -> Build a new Image -> URL
**Name**:duplicati-sqlclient:latest
**URL:**
https://git.limbosolutions.com/kb/duplicati.git
**Dockerfile path:**
/docker/sqlclient/Dockerfile

View File

@@ -3,10 +3,10 @@
# executed by duplicati run-script-before-required
# required environment variables:
# DESTINATION
# DB_HOST
# DB_USER
# DB_PASSWORD
# DB_NAME
# MYSQL_HOST
# MYSQL_USER
# MYSQL_PASSWORD
# MYSQL_NAME
# download directly from git
# curl https://git.limbosolutions.com/kb/duplicati/raw/branch/main/docker/scripts/backupdb.sh > backupdb.sh | chmod +x backupdb.sh
@@ -23,12 +23,12 @@ fi
if [ -z ${DESTINATION} ]
then
echo "\$DESTINATION cannot be empty empty"
echo "\$DESTINATION environment variable cannot be empty empty"
#5: Error don't run operation
exit 5
fi
TARGETFILENAME=${DB_NAME}_dump_$(date -d "today" +"%Y%m%d%H%M%S").sql
TARGETFILENAME=${MYSQL_NAME}_dump_$(date -d "today" +"%Y%m%d%H%M%S").sql
echo "dump file name:$TARGETFILENAME"
if [ -f /tmp/${TARGETFILENAME} ]
@@ -37,14 +37,14 @@ then
fi
mysqldump -h ${DB_HOST} --user=${DB_USER} -p"${DB_PASSWORD}" ${DB_NAME} > /tmp/${TARGETFILENAME}
mysqldump -h ${MYSQL_HOST} --user=${MYSQL_USER} -p"${MYSQL_PASSWORD}" ${MYSQL_NAME} > /tmp/${TARGETFILENAME}
if [ x$(find "$DB_BACKUP_TARGETFOLDER" -prune -empty) = x"$DB_BACKUP_TARGETFOLDER" ]; then
if [ x$(find "$DESTINATION" -prune -empty) = x"$DESTINATION" ]; then
echo "folder is empty... ignoring clean db dump folder"
else
rm -r ${DB_BACKUP_TARGETFOLDER} /*
rm -r ${DESTINATION} /*
fi
mv /tmp/${TARGETFILENAME} ${DB_BACKUP_TARGETFOLDER}/${TARGETFILENAME}
mv /tmp/${TARGETFILENAME} ${DESTINATION}/${TARGETFILENAME}
return 0