.
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
# duplicati
|
# Duplicati
|
||||||
|
|
||||||
|
## Custom Docker Images
|
||||||
|
|
||||||
|
### Duplicati with mySql Client
|
||||||
|
|
||||||
|
[+ Information](../docker/../duplicati/docker/sqlclient/README.md)
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
|
|
||||||
|
|||||||
21
docker/sqlclient/README.md
Normal file
21
docker/sqlclient/README.md
Normal 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
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
# executed by duplicati run-script-before-required
|
# executed by duplicati run-script-before-required
|
||||||
# required environment variables:
|
# required environment variables:
|
||||||
# DESTINATION
|
# DESTINATION
|
||||||
# DB_HOST
|
# MYSQL_HOST
|
||||||
# DB_USER
|
# MYSQL_USER
|
||||||
# DB_PASSWORD
|
# MYSQL_PASSWORD
|
||||||
# DB_NAME
|
# MYSQL_NAME
|
||||||
# download directly from git
|
# download directly from git
|
||||||
# curl https://git.limbosolutions.com/kb/duplicati/raw/branch/main/docker/scripts/backupdb.sh > backupdb.sh | chmod +x backupdb.sh
|
# 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} ]
|
if [ -z ${DESTINATION} ]
|
||||||
then
|
then
|
||||||
echo "\$DESTINATION cannot be empty empty"
|
echo "\$DESTINATION environment variable cannot be empty empty"
|
||||||
#5: Error don't run operation
|
#5: Error don't run operation
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
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"
|
echo "dump file name:$TARGETFILENAME"
|
||||||
|
|
||||||
if [ -f /tmp/${TARGETFILENAME} ]
|
if [ -f /tmp/${TARGETFILENAME} ]
|
||||||
@@ -37,14 +37,14 @@ then
|
|||||||
fi
|
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"
|
echo "folder is empty... ignoring clean db dump folder"
|
||||||
else
|
else
|
||||||
rm -r ${DB_BACKUP_TARGETFOLDER} /*
|
rm -r ${DESTINATION} /*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv /tmp/${TARGETFILENAME} ${DB_BACKUP_TARGETFOLDER}/${TARGETFILENAME}
|
mv /tmp/${TARGETFILENAME} ${DESTINATION}/${TARGETFILENAME}
|
||||||
return 0
|
return 0
|
||||||
Reference in New Issue
Block a user