Files
evig/scripts/ci/ops-box-paths.sh
b9248b21e1 fix(ops): the systemd units follow the box to /opt/evig (#432)
`revampit-cron@timecard-reminders.service` failed at 08:01 UTC today with
status=203/EXEC: "Unable to locate executable /opt/revampit/ops/run-cron.sh".

#430 renamed the box directory /opt/revampit -> /opt/evig at 07:44 UTC and
deliberately left the revampit-cron@* and revampit-backup units for a separate
pass. But those units name their program as a literal path — systemd cannot
interpolate a variable into ExecStart — so from 07:44 they all pointed at a
directory that no longer exists. timecard-reminders was simply the first timer
to fire afterwards; wake-recurring-tasks had run at 07:01, before the rename,
which is why only one unit looks broken.

It is not one job:

  - all five revampit-cron@* timers are dead from their next fire onward
  - revampit-backup.service — the ONLY off-box copy of prod Postgres — dies at
    03:32 UTC, and a 203/EXEC failure leaves no dump behind to notice
  - revampit-transcription.service still has WorkingDirectory=/opt/revampit and
    survives only because it has not been restarted since

and fixing the units alone would not have been enough: run-cron.sh itself
defaults APP_ENV to /opt/revampit/app/.env, so it would have read no
CRON_SECRET and every call would have come back 401.

Repoints every /opt path under scripts/ops/ at /opt/evig. Unit *names* stay
revampit-* — renaming a live schedule is still the separate, deliberate step
#430 called it.

Also here, because the same drift hid them:

  - revampit-cron@timecard-reminders.timer existed on the box but not in this
    repo, which claims to be the source of truth for scripts/ops/. Added,
    byte-identical to the installed copy.
  - release-escrow is the reverse: in this repo, never enabled on the box, so
    /api/cron/release-escrow has never once run on a schedule. Documented as a
    money-side go/no-go rather than switched on by an install loop.

The automation that ends the class: scripts/ci/ops-box-paths.sh compares every
/opt/<name> literal under scripts/ops/ against NAME= in the deploy script — the
one place that decides where the app lives — and fails when they disagree. Wired
into verify as `lint:ops`. Verified it fails on the pre-fix tree. The next box
rename now breaks CI instead of breaking the backups at 03:32 UTC.

.prettierignore gains .venv: a local python virtualenv (services/transcription)
made `npm run verify` fail locally on vendored site-packages while CI, which
never has one, stayed green — the precise local/CI split verify exists to
prevent.


Claude-Session: https://claude.ai/code/session_01LmyE2aLaXKB2V7WA3XQprm

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 09:41:31 +00:00

39 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# The box paths baked into scripts/ops/ must match where the deploy actually puts
# the app.
#
# 2026-09-02: renaming /opt/revampit -> /opt/evig on the box updated the deploy
# script but not the systemd units, whose ExecStart is a literal path (systemd
# cannot interpolate one). Every unit kept spawning /opt/revampit/ops/run-cron.sh,
# which no longer existed: all five cron timers and the nightly off-box DB backup
# died with status=203/EXEC, and nothing said so until a timer happened to fire.
#
# The deploy script is the single source of truth for the box root. This compares
# every /opt/<name> literal under scripts/ops/ against it, so the next rename
# fails CI instead of failing silently at 03:32 UTC.
set -uo pipefail
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" || exit 1
DEPLOY=scripts/selfhost-deploy-evig.sh
[ -f "$DEPLOY" ] || { echo "FAIL: $DEPLOY not found — did the deploy script get renamed?"; exit 1; }
NAME="$(grep -oP '^NAME=\K\S+' "$DEPLOY" | head -1)"
[ -n "$NAME" ] || { echo "FAIL: no NAME= in $DEPLOY"; exit 1; }
EXPECTED="/opt/$NAME"
bad=0
while IFS= read -r hit; do
echo " $hit"
bad=$((bad + 1))
done < <(grep -rn '/opt/[a-z0-9_-]\+' scripts/ops/ | grep -v "$EXPECTED")
if [ "$bad" -gt 0 ]; then
echo
echo "FAIL: $bad path(s) in scripts/ops/ do not point at $EXPECTED (from NAME= in $DEPLOY)."
echo " A unit whose ExecStart names a directory that does not exist fails 203/EXEC."
exit 1
fi
echo "ops box paths: OK — every /opt path under scripts/ops/ is $EXPECTED"