Skip to content

Commit

Permalink
trying to link the services with ts-proxy instances so when the proxy…
Browse files Browse the repository at this point in the history
… is stopped the services are stopped too

Signed-off-by: lucasew <lucas59356@gmail.com>
  • Loading branch information
lucasew committed Dec 15, 2024
1 parent 00bab2d commit 53614ba
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions nix/nodes/common/services/cf-torrent.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ in
cf-torrent = {
address = "127.0.0.1:${toString cfg.port}";
enableTLS = true;
proxies = [ "cf-torrent.service" ];
};
};

Expand Down
1 change: 1 addition & 0 deletions nix/nodes/common/services/minecraft.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ in
enableRaw = true;
enableFunnel = true;
address = "127.0.0.1:${toString port}";
proxies = [ "minecraft-server.service" ];
listen = 10000;
};
};
Expand Down
1 change: 1 addition & 0 deletions nix/nodes/common/services/ngircd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ in
enableTLS = true;
enableRaw = true;
address = "127.0.0.1:${toString config.networking.ports.ircd.port}";
proxies = [ "ngircd.service" ];
listen = 6697;
};
};
Expand Down
1 change: 1 addition & 0 deletions nix/nodes/common/services/ollama.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ in
ollama = {
# enableTLS = true;
address = "127.0.0.1:${toString config.networking.ports.ollama.port}";
proxies = [ "ollama.service" ];
};
};

Expand Down
1 change: 1 addition & 0 deletions nix/nodes/common/services/phputils/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ in
enableTLS = true;
enableFunnel = true;
network = "unix";
proxies = [ "phputils.socket" ];
address = cfg.socket;
};
};
Expand Down
12 changes: 11 additions & 1 deletion nix/nodes/common/services/ts-proxy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ in
default = name;
};

proxies = lib.mkOption {
description = "Which units this ts-proxy instance is proxying.";
type = lib.types.listOf lib.types.str;
default = [];
};

unitName = lib.mkOption {
description = "Systemd unit of the proxy";
type = lib.types.str;
Expand Down Expand Up @@ -119,7 +125,11 @@ in
${host.unitName} = {

description = "ts-proxy service for ${host.name}";
wantedBy = [ "multi-user.target" ];
wantedBy = lib.mkIf (host.proxies == []) [ "multi-user.target" ];

after = host.proxies;
partOf = host.proxies;
wants = host.proxies;

restartIfChanged = true;

Expand Down

0 comments on commit 53614ba

Please sign in to comment.