straylight: restore llama HTTPS every 5s after serve reset
The OpenCode TLS session keeps running , which drops https://straylight.scylla-hammerhead.ts.net. Loop the serve config so the API comes back in seconds.
This commit is contained in:
+14
-15
@@ -202,25 +202,24 @@ in
|
|||||||
|
|
||||||
# TLS for the llama.cpp API over the tailnet. Clients using
|
# TLS for the llama.cpp API over the tailnet. Clients using
|
||||||
# https://straylight.scylla-hammerhead.ts.net/v1 hit Tailscale Serve on
|
# https://straylight.scylla-hammerhead.ts.net/v1 hit Tailscale Serve on
|
||||||
# :443, which proxies to llama-server on localhost:11434. A boot oneshot
|
# :443, which proxies to llama-server on localhost:11434. Re-apply every
|
||||||
# is not enough: `tailscale serve reset` clears the config without
|
# 5s so `tailscale serve reset` cannot leave the API dark.
|
||||||
# stopping this unit, so a timer re-applies it.
|
|
||||||
systemd.services.tailscale-serve-llama = {
|
systemd.services.tailscale-serve-llama = {
|
||||||
description = "Tailscale HTTPS proxy for llama-server";
|
description = "Keep Tailscale HTTPS proxy for llama-server";
|
||||||
after = [ "tailscaled.service" "llama-server.service" ];
|
after = [ "tailscaled.service" "llama-server.service" ];
|
||||||
wants = [ "tailscaled.service" ];
|
wants = [ "tailscaled.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "simple";
|
||||||
ExecStart = "${pkgs.tailscale}/bin/tailscale serve --bg --https=443 http://127.0.0.1:11434";
|
Restart = "always";
|
||||||
};
|
RestartSec = "5s";
|
||||||
};
|
ExecStart = pkgs.writeShellScript "tailscale-serve-llama" ''
|
||||||
systemd.timers.tailscale-serve-llama = {
|
set -eu
|
||||||
description = "Re-apply Tailscale HTTPS proxy for llama-server";
|
while true; do
|
||||||
wantedBy = [ "timers.target" ];
|
${pkgs.tailscale}/bin/tailscale serve --bg --https=443 http://127.0.0.1:11434 >/dev/null || true
|
||||||
timerConfig = {
|
sleep 5
|
||||||
OnBootSec = "15s";
|
done
|
||||||
OnUnitActiveSec = "1min";
|
'';
|
||||||
Unit = "tailscale-serve-llama.service";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user