Backup Domoticz with Duplicati
Step-by-step how-to guide install and configure Duplicati with the latest Raspbian Buster image and Domoticz.
Duplicati is a fantastic and very intuitive backup solution that support a wide range of backup targets. Combined with a webinterface, this makes it perfect for a backup solution for our beloved Domoticz installation.
Duplicati supports not only various online backup services like OneDrive, Amazon S3, Backblaze, Rackspace Cloud Files, Tahoe LAFS, and Google Drive, but also any servers that support SSH/SFTP, WebDAV, or FTP.
It does however need the mono framework as it is mainly written for the Windows platform and this makes it a bit heavy for Linux. Nonetheless, it’s one of my favorite open-source backup products.
Tip: Duplicati is more about making a backup of the most important files. If you are looking for a complete system backup solution, perhaps this is more what you are looking for:
This how-to is part of a bigger series of Domoticz how-to’s on sancla.com!
This tutorial has been verified with:
- Running Domoticz installation with stable Raspbian Buster release and SSH access. See my previous post for a how-to:
- Raspberry Pi 4 (MEM 2GB with 16GB sd-card)
- Raspbian Buster Lite 4.19, Februari 2020
- Domoticz Stable 2020.1 (compile date 22-3-2020)
- Duplicati BETA v22.214.171.124-126.96.36.199_beta_2020-01-18
Step 1: Install the Mono Framework
This step can take a bit of time…
sudo apt install mono-complete ca-certificates-mono -y
Step 2: Sync the certificates
sudo cert-sync /etc/ssl/certs/ca-certificates.crt
Step 3: Install Duplicati
wget https://github.com/duplicati/duplicati/releases/download/v188.8.131.52-184.108.40.206_beta_2020-01-18/duplicati_220.127.116.11-1_all.deb sudo apt-get install ./duplicati_18.104.22.168-1_all.deb -y
Step 4: Install missing dependencies
Sometimes Raspbian is still missing some required dependencies.
Just to be sure, run the following command so we are not missing out on any:
sudo apt -f install -y
Step 5: Configure the service file
We need to edit the service file in order to make it possible to run this as a service. So go open the file with the nano text editor with the following command:
sudo nano /etc/systemd/system/duplicati.service
Copy-paste the following configuration and save the file.
To exit and save the changes, press CTRL+X first and confirm to save the file with “Y”).
[Unit] Description=Duplicati web-server After=network.target [Service] Nice=19 IOSchedulingClass=idle EnvironmentFile=-/etc/default/duplicati ExecStart=/usr/bin/duplicati-server $DAEMON_OPTS Restart=always [Install] WantedBy=multi-user.target
Step 6: Configure the initscript file
Next is to edit the initscript file with the following command:
sudo nano /etc/default/duplicati
It should resemble the below configuration. You have to add the last “DAEMON_OPTS…” line to the file and save the changes. To exit and save the changes, press CTRL+X first and confirm to save the file with “Y”).
# Defaults for duplicati initscript # sourced by /etc/init.d/duplicati # installed at /etc/default/duplicati by the maintainer scripts # # This is a POSIX shell fragment # # Additional options that are passed to the Daemon. DAEMON_OPTS="--webservice-interface=any --webservice-port=8200 --portable-mode"
Step 7: Enable Duplicati service
Now its time to enable and start the service.
Execute the following commands:
sudo systemctl enable duplicati.service sudo systemctl daemon-reload sudo systemctl start duplicati.service sudo systemctl status duplicati.service
You should now have Duplicati up-and-running and see the below results of a running service:
Step 8: Open the Duplicati web-gui
Next is to navigate to the web interface/gui. It is configured in the initscript file to run on port 8200. In my case, the IP address of my Raspberry Pi is 10.1.3.51. So in order the reach the web gui, I have to open the following address in my browser:
The first time you open the Duplicati interface, choose the first option “No, my machine has only a single account”.
You should now be able to configure a backup job!
A couple of tips when creating a backup job (see screenshots below for further guidance):
- Include one of these directories:
- Enable automatic backup in the Domoticz setup menu so you get consistent backups of your database.
- Keep your encryption password in a safe place that you can find back should you ever need it (or just do not use an encryption password)!!
- You can also run scripts in advance or after the backup
- Configure backup retention to automatically clean up old backups.
- Enable e-mail notifications to keep track of your backups.
See this forum post for the proper steps using Google Mail:
Should you need to restore…
If you ever need to restore, you can do so easily by clicking on the job and selecting to restore files, as seen in the screenshot below.
Follow the steps with these instructions:
However, in the worst-case scenario, a F.U.B.A.R. situation, you don’t have a running pi anymore. For example, your SD-card or USB stick died…
First 2 steps are to get your pi running again with a fresh installation of raspbian and Domoticz. Next is to install Duplicati again the guide below. Another option is to just install Duplicati on your own system to retrieve your files. See this link for more information and instructions
For more information on Duplicati, how to create a proper backup job and other documentation, you can visit this site: