Skip to content

Commit

Permalink
headscale: fix reacting to SIGTERM
Browse files Browse the repository at this point in the history
The current version of headscale does not react to SIGTERMs and so it
can only be terminated by a SIGKILL at the moment. This commit provides
a patch to fix this.
  • Loading branch information
NetaliDev authored and K900 committed Aug 21, 2024
1 parent ae84fdb commit 37947d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkgs/servers/headscale/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ buildGoModule rec {
patches = [
# backport of https://github.com/juanfont/headscale/pull/1697
./trim-oidc-secret-path.patch

# fix for headscale not reacting to SIGTERM
# see https://github.com/juanfont/headscale/pull/1480 and https://github.com/juanfont/headscale/issues/1461
./sigterm-fix.patch
];

ldflags = ["-s" "-w" "-X github.com/juanfont/headscale/cmd/headscale/cli.Version=v${version}"];
Expand Down
12 changes: 12 additions & 0 deletions pkgs/servers/headscale/sigterm-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/hscontrol/app.go b/hscontrol/app.go
index b8dceba..4bcf019 100644
--- a/hscontrol/app.go
+++ b/hscontrol/app.go
@@ -821,6 +821,7 @@ func (h *Headscale) Serve() error {

// And we're done:
cancel()
+ return
}
}
}

0 comments on commit 37947d5

Please sign in to comment.