init
This commit is contained in:
commit
642869ce9b
27 changed files with 1414 additions and 0 deletions
29
modules/wiki-primary/mediawiki.nix
Normal file
29
modules/wiki-primary/mediawiki.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ 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";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue