[microvm] automatic update from master every 20mins
All checks were successful
Evaluate Hydra Jobs / eval-hydra-jobs (push) Successful in 2m47s
All checks were successful
Evaluate Hydra Jobs / eval-hydra-jobs (push) Successful in 2m47s
This commit is contained in:
@@ -85,5 +85,36 @@ in
|
|||||||
}; };
|
}; };
|
||||||
in
|
in
|
||||||
builtins.listToAttrs (map mapperFunc cfg.deployHosts);
|
builtins.listToAttrs (map mapperFunc cfg.deployHosts);
|
||||||
|
|
||||||
|
systemd.services = builtins.foldl' (services: name: services // {
|
||||||
|
"microvm-update@${name}" = {
|
||||||
|
description = "Update MicroVMs automatically";
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
unitConfig.ConditionPathExists = "/var/lib/microvms/${name}";
|
||||||
|
serviceConfig = {
|
||||||
|
LimitNOFILE = "1048576";
|
||||||
|
Type = "oneshot";
|
||||||
|
};
|
||||||
|
path = with pkgs; [ nix git ];
|
||||||
|
environment.HOME = config.users.users.root.home;
|
||||||
|
scriptArgs = "%i";
|
||||||
|
script = ''
|
||||||
|
/run/current-system/sw/bin/microvm -Ru ${name}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}) {} (cfg.deployHosts);
|
||||||
|
|
||||||
|
systemd.timers = builtins.foldl' (timers: name: timers // {
|
||||||
|
"microvm-update-${name}" = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
Unit = "microvm-update@${name}.service";
|
||||||
|
# three times per hour
|
||||||
|
OnCalendar = "*:0,20,40:00";
|
||||||
|
Persistent = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}) {} (cfg.deployHosts);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user