feat: replace watchtower with podman auto-update

This commit is contained in:
Felix Schröter 2023-08-10 12:46:51 +02:00
parent 59d27f4367
commit 7beebf6a6a
Signed by: felschr
GPG key ID: 671E39E6744C807D
3 changed files with 23 additions and 24 deletions

View file

@ -25,7 +25,6 @@ in with builtins; {
./services/wkd.nix
./services/home-assistant
./services/matrix
./services/watchtower.nix
./services/immich.nix
./services/miniflux.nix
./services/paperless.nix

View file

@ -1,20 +0,0 @@
{ config, lib, pkgs, ... }:
# watchtower keeps images & containers up-to-date
{
virtualisation.oci-containers.containers = {
watchtower = {
image = "containrrr/watchtower";
volumes = [
"/var/run/podman/podman.sock:/var/run/docker.sock"
"/etc/localtime:/etc/localtime:ro"
];
environment = {
# some containers take really long to shut down
WATCHTOWER_TIMEOUT = "120s";
WATCHTOWER_CLEANUP = "true";
WATCHTOWER_INCLUDE_STOPPED = "true";
};
};
};
}

View file

@ -1,11 +1,31 @@
{ config, pkgs, ... }:
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [ podman-compose ];
virtualisation.podman.enable = true;
virtualisation.podman.dockerCompat = true;
virtualisation.podman.dockerSocket.enable = true;
virtualisation.podman.extraPackages = with pkgs; [ ];
virtualisation.podman.defaultNetwork.settings.dns_enabled = true;
virtualisation.podman.autoPrune.enable = true;
virtualisation.podman.autoPrune.dates = "weekly";
virtualisation.podman.autoPrune.flags = [ "--all" ];
systemd.services.podman-auto-update = {
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.podman}/bin/podman auto-update";
ExecStartPost = "${pkgs.podman}/bin/podman image prune -f";
};
};
systemd.timers.podman-auto-update = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "03:30";
Persistent = true;
};
};
}