From f1c1d13e661ac902cd05478ef4c98c2626e1cf34 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 31 Oct 2026 07:40:24 +0000 Subject: [PATCH] install agent worker where cron can read it --- .github/workflows/ci.yml | 1 + bin/install.conf | 1 + bin/install.sh | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3d308c..f7672ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,3 +13,4 @@ jobs: - run: bun x tsc --noEmit - run: bun test - run: node --test test/agent-phone.test.mjs + - run: bash -n bin/install.sh diff --git a/bin/install.conf b/bin/install.conf index 18bc802..3544644 100644 --- a/bin/install.conf +++ b/bin/install.conf @@ -19,3 +19,4 @@ PORT=8810 HEALTH_PATH=/health DOMAINS= ACCESS_LOG=off +AGENT_PHONE_USER=anthony diff --git a/bin/install.sh b/bin/install.sh index 23ad8d2..0d9a66e 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -274,12 +274,35 @@ phase_setup() { log "setup ok: runtime=$RUNTIME state=$STATE_DIR" } +install_agent_phone() { + [ "$APP" = group-call ] || return 0 + [ -f "$SRC_DIR/ops/agent-phone.mjs" ] || return 0 + local worker_user worker_home worker_group worker_node + worker_user="${AGENT_PHONE_USER:-anthony}" + worker_home="$(getent passwd "$worker_user" | cut -d: -f6)" + [ -n "$worker_home" ] || die "AGENT_PHONE_USER '$worker_user' has no home directory" + worker_group="$(id -gn "$worker_user")" + worker_node="$worker_home/.local/share/mise/shims/node" + [ -x "$worker_node" ] || die "agent worker node runtime missing: $worker_node" + install -d -o "$worker_user" -g "$worker_group" -m 0750 "$worker_home/.local/share/agent-phone" "$worker_home/.local/bin" + install -o "$worker_user" -g "$worker_group" -m 0750 "$SRC_DIR/ops/agent-phone.mjs" "$worker_home/.local/share/agent-phone/agent-phone.mjs" + cat > "$worker_home/.local/bin/agent-phone.tmp" <