From 2b7605fac066462b6d111a646fb538809b88020f Mon Sep 17 00:00:00 2001 From: Teodor Calin Date: Thu, 2 Jul 2026 15:08:50 +0300 Subject: [PATCH] fix(deploy): self-updater uses sudo systemctl (runs as unprivileged ubuntu) The service runs as User=ubuntu, so bare 'systemctl restart' would fail with insufficient privilege. ubuntu has passwordless sudo on the box; use sudo for the restart + rollback-restart. Also note: the box needs 'jq' installed (self-updater dependency). Co-Authored-By: Claude Fable 5 --- deploy/scripts/cosift-self-update.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deploy/scripts/cosift-self-update.sh b/deploy/scripts/cosift-self-update.sh index 6a3df33..c77991b 100755 --- a/deploy/scripts/cosift-self-update.sh +++ b/deploy/scripts/cosift-self-update.sh @@ -183,8 +183,10 @@ mv -f "$new" "$BIN" # atomic rename over the live path log "swapped in $latest_tag (previous kept at $prev)" # --- Restart ------------------------------------------------------------- +# Runs as an unprivileged user (User=ubuntu); systemctl needs privilege, and +# ubuntu has passwordless sudo on the box. log "restarting $SERVICE" -systemctl restart "$SERVICE" +sudo systemctl restart "$SERVICE" # --- HEALTH GATE --------------------------------------------------------- # The listener only binds AFTER the ~4-5 min synchronous HNSW load, so a @@ -209,7 +211,7 @@ fi err "new version $latest_tag did not become healthy within ${HEALTH_TIMEOUT_S}s — rolling back to $running" if [[ -f "$prev" ]]; then mv -f "$prev" "$BIN" - systemctl restart "$SERVICE" + sudo systemctl restart "$SERVICE" # Give the rolled-back process a chance to come back so the box isn't # left dark. Best-effort; we still exit non-zero to flag the failure. rb_deadline=$(( $(date +%s) + HEALTH_TIMEOUT_S ))