Duplicacy is a powerful, feature-rich backup tool designed for efficiency, flexibility, and data integrity, making it perfect for self-hosting enthusiasts who value control over their data. Its deduplication, incremental backups, and cross-platform compatibility make it an excellent choice for developers and system administrators. In this guide, we will walk through deploying Duplicacy, configuring it with Nginx as a reverse proxy, managing logs, automating backups, keeping the app updated, and using its unique features.
Installing Duplicacy
π¦ Docker/Docker Compose Setup
To deploy Duplicacy with Docker, create a docker-compose.yml
file with proper volume mappings for storing backups and configuration files. Hereβs an example setup:
version: '3.7'
services:
duplicacy:
image: gilbertchen/duplicacy-web:latest
container_name: duplicacy
ports:
- "3875:3875" # Duplicacy Web UI
volumes:
- /path/to/duplicacy/config:/config
- /path/to/duplicacy/storage:/storage
- /path/to/duplicacy/backups:/backups
environment:
- TZ=UTC # Set timezone
restart: unless-stopped
Run the following commands to deploy Duplicacy using Docker Compose:
mkdir -p /path/to/duplicacy/{config,storage,backups}
cd /path/to/docker-compose-file
docker-compose up -d
This will start the Duplicacy Web UI on port 3875, accessible at http://<server-ip>:3875
.
π Manual Installation
For manual installation on a Linux server, follow these steps:
- Download the latest Duplicacy Web Edition binary:
wget https://github.com/gilbertchen/duplicacy-web/releases/latest/download/duplicacy_web_linux_x64 -O duplicacy_web
- Make the binary executable:
chmod +x duplicacy_web
- Create directories for configuration and logs, then start the app:
mkdir -p /etc/duplicacy /var/log/duplicacy
./duplicacy_web -log-dir /var/log/duplicacy -config-dir /etc/duplicacy &
The Duplicacy Web UI will now be accessible at http://<server-ip>:3875
.
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
To serve Duplicacy behind an Nginx reverse proxy, create a new server block file (e.g., /etc/nginx/sites-available/duplicacy
):
server {
listen 80;
server_name duplicacy.example.com;
location / {
proxy_pass http://127.0.0.1:3875;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Enable this configuration by creating a symlink and restarting Nginx:
ln -s /etc/nginx/sites-available/duplicacy /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
π SSL/TLS Setup
To secure your Duplicacy instance with Let's Encrypt, use Certbot:
apt install certbot python3-certbot-nginx
certbot --nginx -d duplicacy.example.com
Certbot will automatically configure SSL for your Nginx site. Test the renewal process:
certbot renew --dry-run
π οΈ Testing and Reloading Nginx
Verify the Nginx configuration and reload to apply changes:
nginx -t
systemctl reload nginx
Visit https://duplicacy.example.com
to confirm everything works.
Logging and Debugging Duplicacy
ποΈ Enabling Debug Logs
To enable debug-level logging in Duplicacy, modify the startup command by appending the -debug
flag:
./duplicacy_web -log-dir /var/log/duplicacy -config-dir /etc/duplicacy -debug &
π Viewing Logs
Docker users can view logs with:
docker logs duplicacy
For manual installations, check the logs in /var/log/duplicacy
:
tail -f /var/log/duplicacy/duplicacy_web.log
π οΈ Troubleshooting Common Issues
If backups fail or the Web UI doesnβt load, inspect logs for errors such as permissions or network issues. Common fixes include adjusting file permissions:
chown -R duplicacy_user:duplicacy_group /path/to/duplicacy
π€ Exporting Logs
Export logs to an external system like ELK Stack by configuring a filebeat instance to monitor /var/log/duplicacy/*
.
Backup and Restore
ποΈ File-Based Backups
To create a backup of a directory, use the CLI:
duplicacy init backup_id /path/to/backup
duplicacy backup
π Database Backups
If your application includes a database, create a dump before backing up. For MySQL:
mysqldump -u root -p database_name > /path/to/backup/database.sql
duplicacy backup
π Automated Backup Scripts
Automate backups using a cron job. Edit the crontab:
crontab -e
Add a schedule, e.g., daily at midnight:
0 0 * * * /path/to/duplicacy backup >> /var/log/duplicacy/cron.log 2>&1
Updating and Upgrading Duplicacy
β¬οΈ Updating Docker Images
Pull the latest image and redeploy:
docker-compose pull
docker-compose down
docker-compose up -d
π οΈ Manual Updates
For manual installations, download the latest binary and replace the existing one:
wget https://github.com/gilbertchen/duplicacy-web/releases/latest/download/duplicacy_web_linux_x64 -O duplicacy_web
chmod +x duplicacy_web
Restart the app to apply updates.
π Checking for Updates
To check for updates, visit the Duplicacy GitHub releases page.
Leveraging Duplicacyβs Unique Features
π§ Enabling APIs
Duplicacy Web Edition supports APIs for automation. Enable them by starting the server with the -enable-api
flag:
./duplicacy_web -log-dir /var/log/duplicacy -config-dir /etc/duplicacy -enable-api &
Use curl
to interact with the API:
curl -X POST http://localhost:3875/api/backup/start
π Advanced Configurations
To customize retention policies, modify the preferences
file in the .duplicacy
directory:
{
"name": "default",
"max_storage": 5,
"retain_days": 30
}
Restart Duplicacy to apply changes.
Wrapping Up
In this guide, weβve covered deploying, configuring, and managing Duplicacy, along with leveraging its powerful features like automated backups and API integrations. Self-hosting Duplicacy offers unparalleled flexibility and control, making it an ideal choice for developers and system administrators. With the actionable steps provided, youβre ready to implement and maximize the potential of Duplicacy in your environment.