Update hosts/docker/configuration.nix
This commit is contained in:
@@ -82,6 +82,35 @@ systemd.timers.update-containers = {
|
||||
};
|
||||
};
|
||||
|
||||
# Create Gotify Docker monitoring script task
|
||||
{
|
||||
systemd.services.docker-health-to-gotify = {
|
||||
description = "Alert Gotify when Docker containers become unhealthy";
|
||||
after = [ "docker.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
# Run as root so it can read /etc/secrets and access docker socket
|
||||
# User = "root";
|
||||
#EnvironmentFile = "-/etc/secrets/docker-health-alert.env";
|
||||
ExecStart = "mnt/docker-persistent-data/docker/gotify/docker-health-to-gotify.sh";
|
||||
StandardOutput = "journal";
|
||||
StandardError = "journal";
|
||||
};
|
||||
path = with pkgs; [ docker curl coreutils gnused ];
|
||||
};
|
||||
|
||||
systemd.timers.docker-health-to-gotify = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnBootSec = "2min";
|
||||
OnUnitActiveSec = "1min";
|
||||
AccuracySec = "15s";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#Add sym links to data on users home folder
|
||||
system.userActivationScripts.createDockerSymlink.text = ''
|
||||
ln -sf /mnt/docker-persistent-data/docker /home/nixos/docker
|
||||
|
||||
Reference in New Issue
Block a user