Commit dfbcb970a3
dfbcb970a33ff6ff1d731c12f41a073da8bbd1b0
parent: dfd79e9c40
Verified · cmc ci/build: success ci/test: success ci/vuln: success
cmc <hello@cleberg.net> · 2026-09-02 03:57 UTC
deploy: resumable copies, and a runner drop-in that cannot starve the host
Deploys stalled at 1% whenever the runner was in the e2e suite: sixty
daemon instances on a VPS sized for one, with nothing holding the
build back, and a plain scp that threw the transfer away on a stall.
install.sh and make deploy-runner copy with rsync --partial --inplace
-z, so a stalled transfer resumes and the binary is compressed on the
wire; install.sh falls back to scp -C where the host has no rsync.
deploy/gitbay-runner.override.conf is a systemd drop-in with Nice=10,
CPUWeight=30 and IOWeight=30, installed by make deploy-runner under
gitbay-runner.service.d. The runner's unit itself was written by hand
on the host and is not in the repository; a drop-in fits whatever it
says.
Layout: unified · split
Makefile
+4 −1
| @@ -71,9 +71,12 @@ deploy-runner: preflight |
| 71 | @echo "==> building $(RUNNER_BIN)" |
71 | @echo "==> building $(RUNNER_BIN)" |
| 72 | $(CROSS) go build -trimpath -ldflags='$(LDFLAGS)' -o $(RUNNER_BIN) ./cmd/gitbay-runner |
72 | $(CROSS) go build -trimpath -ldflags='$(LDFLAGS)' -o $(RUNNER_BIN) ./cmd/gitbay-runner |
| 73 | @echo "==> pushing runner to $(HOST)" |
73 | @echo "==> pushing runner to $(HOST)" |
| 74 | scp -P $(PORT) $(RUNNER_BIN) root@$(HOST):/usr/local/bin/gitbay-runner.new |
74 | rsync --partial --inplace -z -e "ssh -p $(PORT)" $(RUNNER_BIN) root@$(HOST):/usr/local/bin/gitbay-runner.new |
| |
75 | ssh -p $(PORT) root@$(HOST) 'mkdir -p /etc/systemd/system/gitbay-runner.service.d' |
| |
76 | rsync -z -e "ssh -p $(PORT)" deploy/gitbay-runner.override.conf root@$(HOST):/etc/systemd/system/gitbay-runner.service.d/override.conf |
| 75 | ssh -p $(PORT) root@$(HOST) 'set -eu; \ |
77 | ssh -p $(PORT) root@$(HOST) 'set -eu; \ |
| 76 | chmod 755 /usr/local/bin/gitbay-runner.new; \ |
78 | chmod 755 /usr/local/bin/gitbay-runner.new; \ |
| 77 | mv /usr/local/bin/gitbay-runner.new /usr/local/bin/gitbay-runner; \ |
79 | mv /usr/local/bin/gitbay-runner.new /usr/local/bin/gitbay-runner; \ |
| |
80 | systemctl daemon-reload; \ |
| 78 | systemctl restart gitbay-runner; \ |
81 | systemctl restart gitbay-runner; \ |
| 79 | systemctl --no-pager --lines=3 status gitbay-runner' |
82 | systemctl --no-pager --lines=3 status gitbay-runner' |
deploy/gitbay-runner.override.conf
added
+11
| @@ -0,0 +1,11 @@ |
| |
1 | # Drop-in for gitbay-runner.service, installed by `make deploy-runner` to |
| |
2 | # /etc/systemd/system/gitbay-runner.service.d/override.conf. |
| |
3 | # |
| |
4 | # A build must never starve the host: the e2e suite alone starts sixty |
| |
5 | # daemon instances, and with nothing holding it back a deploy's scp on |
| |
6 | # the admin sshd stalled at 1%. Lower CPU and IO weight keep sshd, |
| |
7 | # gitbayd and the backup timers responsive while a build runs. |
| |
8 | [Service] |
| |
9 | Nice=10 |
| |
10 | CPUWeight=30 |
| |
11 | IOWeight=30 |
deploy/install.sh
+7 −1
| @@ -8,7 +8,13 @@ bin=dist/gitbayd-linux-amd64 |
| 8 | |
8 | |
| 9 | [ -f "$bin" ] || { echo "build first: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $bin ./cmd/gitbayd" >&2; exit 1; } |
9 | [ -f "$bin" ] || { echo "build first: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $bin ./cmd/gitbayd" >&2; exit 1; } |
| 10 | |
10 | |
| 11 | scp -P "$port" "$bin" "root@$host:/usr/local/bin/gitbayd.new" |
11 | # rsync resumes a transfer the host's load stalled and compresses the |
| |
12 | # binary on the wire; scp -C is the fallback where the host has no rsync. |
| |
13 | if ssh -p "$port" "root@$host" 'command -v rsync >/dev/null'; then |
| |
14 | rsync --partial --inplace -z -e "ssh -p $port" "$bin" "root@$host:/usr/local/bin/gitbayd.new" |
| |
15 | else |
| |
16 | scp -C -P "$port" "$bin" "root@$host:/usr/local/bin/gitbayd.new" |
| |
17 | fi |
| 12 | ssh -p "$port" "root@$host" ' |
18 | ssh -p "$port" "root@$host" ' |
| 13 | set -eu |
19 | set -eu |
| 14 | chmod 755 /usr/local/bin/gitbayd.new |
20 | chmod 755 /usr/local/bin/gitbayd.new |