Files
espresso_frame/server/.claude/skills/run-server/start-server.sh
T
Thomas Faour 20c7620393
Build and push server image / test (push) Successful in 23s
Build and push server image / build-and-push (push) Successful in 2m0s
Build and push server image / deploy (push) Successful in 58s
Add a run-server skill for launching + browser-driving the FastAPI app
This sandbox ships with no Python/Node/Docker/browser and no sudo, so
the bulk of this is setup.sh: bootstrap Python via uv, then get
Playwright's Chromium (and tmux, also missing) working by extracting
their .deb dependencies non-root instead of apt-get install. driver.py
is a small Playwright REPL standing in for chromium-cli, which isn't
available here either.

Also carves out .claude/skills/ from the blanket .claude/ gitignore --
skills are shared project tooling, not personal/local state.
2026-07-25 01:12:53 +00:00

30 lines
958 B
Bash
Executable File

#!/usr/bin/env bash
# Background-launch the server against a scratch DB/config -- never the
# real deployment's data (see CLAUDE.md). Waits for readiness, prints
# the PID and log path. Usage: ./start-server.sh [scratch-dir] [port]
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"/../../.. # -> server/
SCRATCH="${1:-/tmp/run-server-scratch}"
PORT="${2:-8420}"
mkdir -p "$SCRATCH"
DATABASE_URL="sqlite:///$SCRATCH/test.db" \
CONFIG_PATH="$SCRATCH/config.json" \
.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port "$PORT" \
> "$SCRATCH/server.log" 2>&1 &
PID=$!
echo "$PID" > "$SCRATCH/server.pid"
for _ in $(seq 1 30); do
curl -sf -o /dev/null "http://127.0.0.1:$PORT/" && break
sleep 0.5
done
if ! curl -sf -o /dev/null "http://127.0.0.1:$PORT/"; then
echo "server did not become ready -- check $SCRATCH/server.log" >&2
exit 1
fi
echo "server PID $PID up on http://127.0.0.1:$PORT (log: $SCRATCH/server.log, db: $SCRATCH/test.db)"