This commit is contained in:
2022-10-09 14:59:39 +01:00
parent 2a8f3daf08
commit da49757a64
3 changed files with 36 additions and 9 deletions

View File

@@ -1,5 +1,4 @@
#Build example where docker build command root folder is the git repository root older
#docker build -t duplicati-sqlclient:latest -f ./docker/sqlclient/Dockerfile .
#check ../README.md for more information
FROM duplicati/duplicati
RUN apt update && apt install -y default-mysql-client && rm -rf /var/lib/apt/lists/*

View File

@@ -1,10 +1,13 @@
# Duplicati / mySql Client
## Build
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
```bash
#example where docker root folder build command is the git repository root folder
docker build -t duplicati-sqlclient:latest -f ./docker/sqlclient/Dockerfile .
#Executed on repository root folder
#docker build -t duplicati-sqlclient:latest -f docker/sqlclient/Dockerfile .
```
### Portainer
@@ -13,9 +16,34 @@ Images -> Build a new Image -> URL
**Name**:duplicati-sqlclient:latest
**URL:**
https://git.limbosolutions.com/kb/duplicati.git
**Dockerfile path:**
/docker/sqlclient/Dockerfile
/docker/sqlclient/Dockerfile
## Run Container
### Docker Compose
```yaml
version: "3"
services:
duplicati:
image: duplicati-sqlclient
environment:
- MYSQL_HOST=${MYSQL_HOST}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- DESTINATION=/db-dumps
volumes:
- duplicati-data:/data
- db-dumps:/db-dumps
ports:
- 8200:8200
restart: unless-stopped
volumes:
duplicati-data:
db-dumps:
````

View File

@@ -6,7 +6,7 @@
# MYSQL_HOST
# MYSQL_USER
# MYSQL_PASSWORD
# MYSQL_NAME
# MYSQL_DATABASE
# download directly from git
# curl https://git.limbosolutions.com/kb/duplicati/raw/branch/main/docker/scripts/backupdb.sh > backupdb.sh | chmod +x backupdb.sh
@@ -37,7 +37,7 @@ then
fi
mysqldump -h ${MYSQL_HOST} --user=${MYSQL_USER} -p"${MYSQL_PASSWORD}" ${MYSQL_NAME} > /tmp/${TARGETFILENAME}
mysqldump -h ${MYSQL_HOST} --user=${MYSQL_USER} -p"${MYSQL_PASSWORD}" ${MYSQL_DATABASE} > /tmp/${TARGETFILENAME}
if [ x$(find "$DESTINATION" -prune -empty) = x"$DESTINATION" ]; then