Vykar provides hooks, command dumps, and source directories as universal building blocks. Rather than adding dedicated flags for each database or container runtime, the same patterns work for any application.
These recipes are starting points — adapt the commands to your setup.
Databases should never be backed up by copying their data files while running. Use the database’s own dump tool to produce a consistent export.
Where possible, use command dumps — they stream stdout directly into the backup without temporary files. For tools that can’t stream to stdout, use hooks to dump to a temporary directory, back it up, then clean up.
If you need to run additional steps around the dump (e.g. custom authentication, pre/post scripts), use hooks instead. Note that this saves the dump to disk instead of reading it directly with the command_dump feature.
For volumes that hold files not actively written to by a running process — configuration, uploaded media, static assets — back up the host path directly.
sources:
- label: myapp
path: /var/lib/docker/volumes/myapp_data/_data
Note: The default volume path /var/lib/docker/volumes/ applies to standard Docker installs on Linux. It differs for Docker Desktop on macOS/Windows, rootless Docker, Podman (/var/lib/containers/storage/volumes/ for root, ~/.local/share/containers/storage/volumes/ for rootless), and custom data-root configurations. Run docker volume inspect <n> or podman volume inspect <n> to find the actual path.
Virtual machine disk images are an excellent use case for deduplicated backups. Large portions of a VM’s disk remain unchanged between snapshots, so Vykar’s content-defined chunking achieves high deduplication ratios — often reducing storage to a fraction of the raw image size.
The guest VM must have the QEMU guest agent installed and running, and QEMU must be started with a guest agent socket (e.g. -chardev socket,path=/tmp/qga.sock,server=on,wait=off,id=qga0). Install socat on the host if not already present.
Use hooks to freeze the guest filesystem before backing up the disk image, then thaw it afterwards:
sources:
- label: vm-images
path: /var/lib/libvirt/images
hooks:
before: >
echo '{"execute":"guest-fsfreeze-freeze"}' |
socat - unix-connect:/tmp/qga.sock
finally: >
echo '{"execute":"guest-fsfreeze-thaw"}' |
socat - unix-connect:/tmp/qga.sock
The freeze ensures the filesystem is in a clean state while Vykar reads the image. For incremental backups (every run after the first), only changed chunks are processed, so the freeze window is short.
Raw images dedup better than qcow2. The qcow2 format uses internal copy-on-write structures that can shuffle data, reducing byte-level similarity between snapshots. If practical, convert with qemu-img convert -f qcow2 -O raw.
Multiple VMs in one repo provides cross-VM deduplication. VMs running the same OS share many common chunks.
For environments that cannot tolerate any guest I/O pause, use QEMU external snapshots instead. This redirects writes to an overlay file via QMP blockdev-snapshot-sync, allowing the base image to be backed up with zero interruption. This is the approach used by Proxmox VE and libvirt.
For filesystems that support snapshots, the safest approach is to snapshot first, back up the snapshot, then delete it. This gives you a consistent point-in-time view without stopping any services.
Important: The .zfs/snapshot directory is only accessible if snapdir is set to visible on the dataset. This is not the default. Set it before using this recipe:
If backups should run in the background with minimal impact on interactive work, use conservative resource limits. This will usually increase backup duration.
compression:
algorithm: lz4
limits:
threads: 1
nice: 19
connections: 1
upload_mib_per_sec: 2
download_mib_per_sec: 4
threads: 1 runs one transform worker, so the backup uses mostly one core.
nice: 19 lowers CPU scheduling priority on Unix; it is ignored on Windows.
The value is applied to every thread and never lowered again (that needs
CAP_SYS_NICE or a raised RLIMIT_NICE on Linux, root on macOS), so the
daemon and GUI keep it for the rest of their lifetime, and with several
repositories the highest configured value wins. To keep the daemon or GUI at
its own priority between runs, leave nice at 0 and run backups as separate
vykar backup processes under nice -n 19 or a systemd Nice= setting.
A before_backup hook that exits 75skips the run without reporting an error: no failed hooks, exit code 0, no red status in the GUI. This lets you restrict backups to specific networks without any changes to Vykar itself. Any other non-zero exit also stops the backup, but counts as a failure.
Operator precedence:|| binds to the whole pipeline before it, so a | grep -q b || exit 75 works as expected. Two forms need care:
! a | grep -q b || exit 75 is fine: ! negates the whole pipeline.
[ x ] && [ y ] || exit 75 also exits 75 when the && list fails at any point, which is what these recipes want. Anything added after exit 75 with ; or && changes that, so wrap the test in { ...; } if you extend it.
Android hotspots and tethered connections advertise metered status via DHCP. Linux network managers read this automatically, so you can skip backups on metered connections without maintaining an SSID list.
NetworkManager reports four values: yes (explicitly metered), guess-yes (heuristic, e.g. Android hotspot), no, and unknown. The hook above skips on both yes and guess-yes.
systemd-networkd:
hooks:
before_backup: >-
! networkctl status
| grep -qi 'metered.*yes'
|| exit 75
Note: macOS has no CLI-exposed metered attribute. Use SSID filtering instead.
Apprise sends notifications to 100+ services (Gotify, Slack, Discord, Telegram, ntfy, email, and more) from the command line. Since vykar hooks run arbitrary shell commands, you can use the apprise CLI directly — no built-in integration needed.
Install it with:
Terminal window
pipinstallapprise
If you use the Docker image, the apprise variant has it pre-installed — use the latest-apprise tag (or e.g. 0.12.6-apprise). See Docker installation.
hooks:
after_backup:
- >-
apprise -t "Backup complete"
-b "vykar $VYKAR_COMMAND finished for $VYKAR_REPOSITORY"
"gotify://hostname/token"
"slack://tokenA/tokenB/tokenC"
failed:
- >-
apprise -t "Backup failed"
-b "vykar $VYKAR_COMMAND failed for $VYKAR_REPOSITORY: $VYKAR_ERROR"
"gotify://hostname/token"
The message bodies use the hook variables, kept inside double quotes.
Common service URL examples:
Service
URL format
Gotify
gotify://hostname/token
Slack
slack://tokenA/tokenB/tokenC
Discord
discord://webhook_id/webhook_token
Telegram
tgram://bot_token/chat_id
ntfy
ntfy://topic
Email
mailto://user:pass@gmail.com
You can pass multiple URLs in a single command to notify several services at once. See the Apprise wiki for the full list of supported services and URL formats.