orchard
mirrorEvery site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.
blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics
1package main
2
3import (
4 "os/exec"
5 "syscall"
6)
7
8// setProcessGroup gives the child its own group so a timeout can reach the
9// browser lighthouse starts: exec.CommandContext only signals its direct child.
10// Linux only.
11func setProcessGroup(cmd *exec.Cmd) {
12 cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
13}
14
15// killProcessGroup signals the whole group; kill(2) reads a negative pid as
16// "every process in this group". Safe after a clean exit, where it gets ESRCH.
17func killProcessGroup(cmd *exec.Cmd) {
18 if cmd.Process == nil {
19 return
20 }
21 _ = syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
22}