This guide explains how to set up an automated daily climweb backup system using:
- Docker
- rsync
- SSH key authentication
- cron scheduling
The system runs on a source server and sends backups to a destination server every day at midnight.
Source Server
Docker container
cron
↓
rsync
↓ (SSH)
Destination Server
/data/backups/
The backup system:
- runs daily at midnight
- creates daily snapshot backups
- keeps only the last 3 backups
- uses SSH keys (no password required)
- Docker Engine & Docker Compose Plugin : Ensure that Docker Engine is installed and running on the machine where you plan to execute the docker-compose command https://docs.docker.com/engine/install/. Docker Engine is the runtime environment for containers.
git clone https://github.com/wmo-raf/climweb-backup-sync.git
cd climweb-backup-sync
Login to the source server (where climweb is installed).
Check if SSH keys already exist:
ls -al ~/.sshTypical output:
id_ed25519
id_ed25519.pub
authorized_keys
known_hosts
If id_ed25519 and id_ed25519.pub exist, you already have SSH keys.
Generate a new key pair:
ssh-keygen -t ed25519Press Enter for all defaults.
This creates:
~/.ssh/id_ed25519
~/.ssh/id_ed25519.pub
| File | Purpose |
|---|---|
| id_ed25519 | Private key (keep secret) |
| id_ed25519.pub | Public key (copied to destination server) |
From the source server, copy the key to the destination server:
ssh-copy-id user@destination_ipExample:
ssh-copy-id backup@192.168.1.20This adds your key to:
~/.ssh/authorized_keys
on the destination server.
Test login from the source server:
ssh user@destination_ipIf login works without a password, the SSH key setup is correct.
Exit the session:
exitLogin to the destination server:
ssh user@destination_ipCreate the backup directory:
mkdir -p /data/backups && mkdir -p /data/backups/latestSet permissions:
chmod 755 /data/backupsCreate a .env file:
cp .env.sample .envedit the .env file with correct variables
nano .envBACKUP_DIR=/home/user/climweb/climweb/backup
DEST_PATH=user@destination_ip:/data/backups| Variable | Purpose |
|---|---|
| BACKUP_DIR | Directory to climweb backup |
| DEST_PATH | Destination server path |
| SSH_KEY_PATH (Optional if your key is not saved at ~/.ssh) | Destination server path |
Build container and start the service:
docker compose up -d --build climweb-backup-rsyncVerify container is running:
docker psView container logs:
docker logs climweb-backup-rsyncOr inside the container:
tail -f /var/log/backup.logRun the backup manually:
docker exec -it climweb-backup-rsync /app/rsync_daily.shVerify on the destination server:
ssh user@destination_ip
ls /data/backupsExpected output:
/data/backups
├── 2026-03-05
└── latest -> 2026-03-05