A small helpdesk system: an office Pixel running a patched GrapheneOS Dialer answers technician calls, records both call legs as separate channels, and a Ruby backend transcribes them through Whisper and files an AI summary against the caller. Squashed to a single commit for sharing. No credentials are included; secrets live outside the repo in /etc/helpdesk/env on the server or a gitignored .claude/env.local locally. See .claude/env.local.example for the shape. Start at README.md, then docs/architecture.md.
34 lines
1.7 KiB
Bash
Executable file
34 lines
1.7 KiB
Bash
Executable file
#!/bin/bash
|
|
# CI end-to-end: boot the backend on the throwaway helpdesk_test DB + alt port, drive it with the
|
|
# HTTP simulator (device HMAC), then tear down. Deterministic — transcription is skipped by the caller
|
|
# (HELPDESK_TRANSCRIBE=0) so the recording step doesn't race a missing Whisper backend.
|
|
# needs: HELPDESK_TEST_DATABASE_URL (postgres://helpdesk:<pw>@127.0.0.1/helpdesk_test)
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/../components/backend"
|
|
export LANG=C.UTF-8 LC_ALL=C.UTF-8
|
|
: "${HELPDESK_TEST_DATABASE_URL:?set HELPDESK_TEST_DATABASE_URL}"
|
|
PORT="${E2E_PORT:-4100}"
|
|
REC_DIR="$(mktemp -d)" # job-local recordings dir; avoids the shared, possibly-unwritable /tmp/helpdesk-recordings
|
|
|
|
# clean slate on the test DB
|
|
psql "$HELPDESK_TEST_DATABASE_URL" -q -c "TRUNCATE orgs,campaigns,dids,people,phone_numbers,events,quarantine;
|
|
ALTER SEQUENCE org_id_seq RESTART; ALTER SEQUENCE campaign_id_seq RESTART; ALTER SEQUENCE person_id_seq RESTART;
|
|
ALTER SEQUENCE event_id_seq RESTART; ALTER SEQUENCE ledger_seq RESTART;"
|
|
|
|
HELPDESK_DEV=1 HELPDESK_DATABASE_URL="$HELPDESK_TEST_DATABASE_URL" PORT="$PORT" HELPDESK_REC_DIR="$REC_DIR" \
|
|
ruby server.rb > /tmp/helpdesk-e2e.log 2>&1 &
|
|
SRV=$!
|
|
trap 'kill "$SRV" 2>/dev/null || true; rm -rf "$REC_DIR"' EXIT
|
|
|
|
# wait for health
|
|
up=0
|
|
for _ in $(seq 1 20); do
|
|
sleep 1
|
|
if curl -fsS -m3 "http://127.0.0.1:$PORT/healthz" >/dev/null 2>&1; then up=1; break; fi
|
|
done
|
|
if [ "$up" != 1 ]; then echo "server did not come up:"; tail -30 /tmp/helpdesk-e2e.log; exit 1; fi
|
|
|
|
# The simulator reads HELPDESK_URL (not BASE) — pointing it at :4100 keeps it off the live :4000 service.
|
|
HELPDESK_URL="http://127.0.0.1:$PORT" \
|
|
HELPDESK_DEVICE_TOKEN=dev-device-token HELPDESK_DEVICE_SECRET=dev-device-secret \
|
|
ruby sim/simulator.rb
|