29 lines
794 B
Nix
29 lines
794 B
Nix
{ pkgs, siteConfig, ... }:
|
|
{
|
|
systemd.services.mediawiki-image-sync = {
|
|
description = "Sync MediaWiki uploads to the replica";
|
|
after = [ "tailscale-autoconnect.service" ];
|
|
wants = [ "tailscale-autoconnect.service" ];
|
|
path = [ pkgs.rsync ];
|
|
serviceConfig.Type = "oneshot";
|
|
script = ''
|
|
set -euo pipefail
|
|
|
|
${pkgs.rsync}/bin/rsync \
|
|
-az \
|
|
--delete \
|
|
/var/lib/mediawiki/images/ \
|
|
"rsync://${siteConfig.hosts.replica.tailscaleName}/mediawiki-images/"
|
|
'';
|
|
};
|
|
|
|
systemd.timers.mediawiki-image-sync = {
|
|
description = "Periodic upload sync from primary to replica";
|
|
wantedBy = [ "timers.target" ];
|
|
timerConfig = {
|
|
OnCalendar = "hourly";
|
|
Persistent = true;
|
|
RandomizedDelaySec = "10m";
|
|
};
|
|
};
|
|
}
|