coreos-home-server/config/common/systemd/container-volume@.service
Alex Palaistras 41328342b3 Implement basic volume backup and restore mechanism
This commit implements three new services, specifically:

  - The `container-volume` service, which applies to a specific volume
    name and ensures this exists. This is mainly useful as a dependency
    to other services, as Podman will create named volumes itself if
    needed.

  - The `container-volume-backup` service, which creates a `tar.gz`
    snapshot of the given volume's contents in `/var/lib/backups`.

  - The `container-volume-restore` service, which populates an empty
    volume from a pre-existing file in `/var/lib/backups`, presumably
    created by `container-volume-backup`.

These are then be used to automatically create volume snapshots every 12
hours, rolling over every 7 days.
2021-08-14 22:38:17 +01:00

12 lines
296 B
Desktop File

[Unit]
Description=Container volume for %I
Wants=container-volume-restore@%i.service container-volume-backup@%i.timer
After=container-volume-restore@%i.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'podman volume exists %i || podman volume create %i'
[Install]
WantedBy=multi-user.target