initial work on the reloader/watcher services for the site

this doesn't seem to entirely be working but it reloads?

I got an older version on the actual site even though the file did
change

not sure what's wrong will try to fix this later
This commit is contained in:
jacekpoz 2024-07-18 02:09:23 +02:00
parent 2d212c043a
commit 270d4ae4c0
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -1,9 +1,15 @@
{ {
inputs, inputs,
lib,
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) getExe';
systemctl = getExe' pkgs.systemd "systemctl";
port = 4827; port = 4827;
sitePath = "/srv/web/jacekpoz.pl";
in { in {
services.caddy = { services.caddy = {
enable = true; enable = true;
@ -28,22 +34,46 @@ in {
group = "site"; group = "site";
}; };
systemd.services.pozback = { systemd = {
description = "The backend for jacekpoz.pl"; services = {
wantedBy = ["default.target"]; pozback = {
description = "The backend for jacekpoz.pl";
after = ["network.target"];
wantedBy = ["multi-user.target"];
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
ExecStart = "${inputs.pozsite.packages.${pkgs.system}.pozback}/bin/back"; ExecStart = "${inputs.pozsite.packages.${pkgs.system}.pozback}/bin/back";
Restart = "on-failure"; Restart = "on-failure";
Environment = ''POZ_PORT="${toString port}" POZ_DIR="/srv/web/jacekpoz.pl"''; Environment = ''POZ_PORT="${toString port}" POZ_DIR="${sitePath}"'';
User = "site"; User = "site";
Group = "site"; Group = "site";
};
path = with pkgs; [
fastfetch
colorized-logs
];
};
pozback-watcher = {
description = "Restarter for the backend";
after = ["network.target"];
wantedBy = ["multi-user.target"];
serviceConfig = {
Type = "oneshot";
ExecStart = "${systemctl} restart pozback.service";
};
};
}; };
paths.pozback-watcher = {
wantedBy = ["multi-user.target"];
path = with pkgs; [ pathConfig = {
fastfetch PathModified = sitePath;
colorized-logs Unit = "pozback-watcher.service";
]; };
};
}; };
} }