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
#Executed on repository root folder
docker build -t duplicati-mysqlclient:latest -f docker/mysqlclient/Dockerfile .
tar
#Executed on repository root folder
sudo docker build -t duplicati-mysqlclient:latest -f docker/mysqlclient/Dockerfile --output type=tar,dest=build/duplicati-mysqlclient.tar .
Portainer
Images -> Build a new Image -> URL
Name: duplicati-mysqlclient:latest
URL: https://git.limbosolutions.com/kb/duplicati.git
Dockerfile path: docker/mysqlclient/Dockerfile
Run Container
Docker Compose
version: "3"
services:
duplicati:
image: duplicati-mysqlclient
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:
Transfer To another system
- Copy docker compose and execute on another system
- Check volumes and service started succesfully
- Stop all compose services
- Change volume on duplicati service to user a temporary volume example (duclicati_tmpdata)
- Check if all volumes are writable on duplication service
- Start only the duplicati service (with temporary volume) on target system
- On source system Stop app services on docker compose except duplicati
- Execute a full backup ou source system
- On target system execute a manual restore to original destination
- Stop duplicati
- Change duplicati to use original volume
- And change volumes on duplicati to RO
- Start all services
- Check everything ok