0775537d4c
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
35 lines
1.5 KiB
Bash
Executable File
35 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# E2E server: fresh ecomm_e2e database, LogMailer (codes land in .backend.log),
|
|
# backend on :8765 serving the built SPA (the deployed topology, SD-0001 §6.2).
|
|
set -euo pipefail
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
if [ ! -f "$repo_root/frontend/dist/index.html" ]; then
|
|
( cd "$repo_root/frontend" && npm run build )
|
|
fi
|
|
|
|
"$repo_root/.venv/bin/python" - <<'PY'
|
|
import psycopg
|
|
admin = psycopg.connect("postgresql://ecomm:ecomm@localhost:5432/postgres", autocommit=True)
|
|
admin.execute("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='ecomm_e2e' AND pid <> pg_backend_pid()")
|
|
admin.execute("DROP DATABASE IF EXISTS ecomm_e2e")
|
|
admin.execute("CREATE DATABASE ecomm_e2e")
|
|
PY
|
|
|
|
export ECOMM_DATABASE_URL="postgresql://ecomm:ecomm@localhost:5432/ecomm_e2e"
|
|
export ECOMM_MAILER=log
|
|
|
|
# Image pipeline (SLICE-7): local objectstore + a fixture image host on :8799.
|
|
# ECOMM_IMAGE_FETCH_ALLOW_PRIVATE lets the SSRF guard reach 127.0.0.1 — TEST-ONLY,
|
|
# never set in the deployed overlay. The &-backgrounded node host is a child of
|
|
# this serve process; Playwright tears the whole webServer group down between runs.
|
|
export ECOMM_OBJECTSTORE_KIND=local
|
|
export ECOMM_OBJECTSTORE_DIR="$repo_root/e2e/.objectstore"
|
|
export ECOMM_IMAGE_FETCH_ALLOW_PRIVATE=1
|
|
rm -rf "$repo_root/e2e/.objectstore"
|
|
node "$repo_root/e2e/image-host.mjs" &
|
|
|
|
cd "$repo_root/backend"
|
|
exec "$repo_root/.venv/bin/python" -m uvicorn app.main:app --port 8765 \
|
|
> "$repo_root/e2e/.backend.log" 2>&1
|