diff --git a/modules/nixos/guests/mastodon/default.nix b/modules/nixos/guests/mastodon/default.nix index 35bc7cf..b279932 100755 --- a/modules/nixos/guests/mastodon/default.nix +++ b/modules/nixos/guests/mastodon/default.nix @@ -270,6 +270,23 @@ in mastodon-sidekiq-mailers.serviceConfig.PrivateMounts = lib.mkForce false; mastodon-sidekiq-push-pull.serviceConfig.PrivateMounts = lib.mkForce false; + mastodon-elastic-search = { + description = "Recache elastic search"; + after = [ + "network-online.target" + "mastodon-web.service" + ]; + wants = [ "network-online.target" ]; + serviceConfig = { + WorkingDirectory = "/var/lib/${serviceCfg.name}"; + Type = "oneshot"; + # Remove RemainAfterExit for recurring tasks + }; + script = '' + mastodon-tootctl search deploy --only-mapping --only=instances accounts tags statuses public_statuses + ''; + }; + mastodon-copy-secrets = { description = "Copy secrets from virtiofs to local filesystem"; before = [ "mastodon-init-dirs.service" ]; @@ -364,16 +381,27 @@ in ''; }; }; - timers.fedifetcher = { - description = "Timer for FediFetcher"; - wantedBy = [ "timers.target" ]; + timers = { + mastodon-elastic-search = { + description = "Timer for Mastodon elastic search recaching"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "10min"; + OnUnitActiveSec = "60min"; + Unit = "mastodon-elastic-search.service"; + }; + }; - timerConfig = { - OnBootSec = "10min"; - OnUnitActiveSec = "15min"; - Unit = "fedifetcher.service"; - Persistent = true; - AccuracySec = "1min"; + fedifetcher = { + description = "Timer for FediFetcher"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "10min"; + OnUnitActiveSec = "15min"; + Unit = "fedifetcher.service"; + Persistent = true; + AccuracySec = "1min"; + }; }; };