#!/usr/bin/env bash # Local bring-up for the ecomm network-service seed (SD-0001 PUC-10). From a clean # checkout this: # 1. starts the dev Postgres container and waits for it to be healthy (owns its # lifecycle — Docker is the one prerequisite, docs/BOOTSTRAP.md); # 2. ensures the backend venv + deps; # 3. runs the FastAPI backend (:8000, self-migrating an empty DB). # Ctrl-C stops the backend; the container keeps running (stop it with # `docker compose down`, or `docker compose down -v` to reset to empty). # The storefront SPA was removed in the network-seed reset — there is no frontend dev # server yet (the network admin UI is a future build). set -euo pipefail repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$repo_root" export ECOMM_DATABASE_URL="${ECOMM_DATABASE_URL:-postgresql://ecomm:ecomm@localhost:5432/ecomm}" echo "==> dev Postgres (docker compose up --wait)" docker compose up -d --wait db if [ ! -x "$repo_root/.venv/bin/python" ]; then echo "==> creating backend venv" python3 -m venv "$repo_root/.venv" "$repo_root/.venv/bin/python" -m pip install --upgrade pip "$repo_root/.venv/bin/python" -m pip install -r "$repo_root/backend/requirements.txt" fi echo "==> starting backend (:8000) — Ctrl-C to stop" # exec hands the terminal (and Ctrl-C) straight to uvicorn; no child-process juggling. exec "$repo_root/.venv/bin/python" -m uvicorn app.main:app --app-dir "$repo_root/backend" --port 8000 --reload