Bring the kai-server systemd unit under repo control #50

Open
opened 2026-05-23 20:55:27 +00:00 by coilysiren · 0 comments
Owner

Originally filed by @coilysiren on 2026-05-12T07:20:55Z - https://github.com/coilysiren/repo-recall/issues/85

Problem

The systemd unit running repo-recall on kai-server lives at /etc/systemd/system/repo-recall.service and was hand-written. There is no copy in this repo, no template, and no rollout path. The brew formula's service do block generates a separate user-level unit, but kai-server runs the hand-written system unit instead, so the formula's env vars (notably REPO_RECALL_STATIC=opt_pkgshare/static) never reach the running process.

This bit us today: the hand-written unit was missing REPO_RECALL_STATIC, the binary fell back to its build-time CARGO_MANIFEST_DIR/static path (nonexistent on kai-server), and every /static/* request 404'd. Fix on the host was a one-line Environment= addition, but no source-of-truth update propagated back to the repo, so the next host will repeat the mistake.

Related: #84 (the binary should not silently depend on this env var in the first place).

Proposal

Pick one:

  1. Check the unit into the repo at deploy/systemd/repo-recall.service (or similar) and add a coily ssh deploy target that copies it into place and reloads systemd. Single source of truth, version-controlled.
  2. Drop the hand-written unit and use the brew-generated user service (brew services start repo-recall). Loses User=kai with system boot-time start unless we add a linger, but removes the drift surface.

Option 1 is the lower-risk path because it keeps the current boot behavior.

Acceptance

  • The unit file in production on kai-server matches a file in the repo (or a templated output of one).
  • A documented one-liner rolls a unit change to kai-server.
  • REPO_RECALL_STATIC is set in the version-controlled unit.
_Originally filed by @coilysiren on 2026-05-12T07:20:55Z - [https://github.com/coilysiren/repo-recall/issues/85](https://github.com/coilysiren/repo-recall/issues/85)_ ## Problem The systemd unit running repo-recall on kai-server lives at `/etc/systemd/system/repo-recall.service` and was hand-written. There is no copy in this repo, no template, and no rollout path. The brew formula's `service do` block generates a separate user-level unit, but kai-server runs the hand-written system unit instead, so the formula's env vars (notably `REPO_RECALL_STATIC=opt_pkgshare/static`) never reach the running process. This bit us today: the hand-written unit was missing `REPO_RECALL_STATIC`, the binary fell back to its build-time `CARGO_MANIFEST_DIR/static` path (nonexistent on kai-server), and every `/static/*` request 404'd. Fix on the host was a one-line `Environment=` addition, but no source-of-truth update propagated back to the repo, so the next host will repeat the mistake. Related: #84 (the binary should not silently depend on this env var in the first place). ## Proposal Pick one: 1. Check the unit into the repo at `deploy/systemd/repo-recall.service` (or similar) and add a `coily ssh deploy` target that copies it into place and reloads systemd. Single source of truth, version-controlled. 2. Drop the hand-written unit and use the brew-generated user service (`brew services start repo-recall`). Loses `User=kai` with system boot-time start unless we add a linger, but removes the drift surface. Option 1 is the lower-risk path because it keeps the current boot behavior. ## Acceptance - The unit file in production on kai-server matches a file in the repo (or a templated output of one). - A documented one-liner rolls a unit change to kai-server. - `REPO_RECALL_STATIC` is set in the version-controlled unit.
coilysiren added
P3
and removed
P2
labels 2026-05-31 07:01:13 +00:00
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/repo-recall#50
No description provided.