Files
weirsoe-party-protocol/docs/DEVELOPMENT.md
Asger Geel Weirsøe a81bc1250c
Some checks failed
CI / test-and-quality (push) Failing after 4m4s
Big visual overhaul docker compsoe file etc
2026-03-23 14:11:30 +01:00

90 lines
3.2 KiB
Markdown

# Development Setup
## MVP Runtime Path
The current MVP runtime path is the legacy Django host/player UI with `USE_SPA_UI=false`.
## Docker Compose
The fastest MVP path is the legacy UI with MySQL and Redis behind Django:
```bash
docker compose up --build
```
App URLs:
- `http://localhost:8000/admin/login/`
- `http://localhost:8000/lobby/ui/host`
- `http://localhost:8000/lobby/ui/player`
Compose uses `infra/env/.env.dev.example` and overrides `DB_HOST`/`CHANNEL_REDIS_HOST` inside containers so the same file also works for host-side commands.
If port `8000` is already in use, run with `APP_PORT=18000 docker compose up --build` and use `http://localhost:18000/...` instead.
The app container now waits for the database and Redis endpoints before running migrations, so transient Docker DNS startup races do not kill the local stack.
## Bootstrap
Create deterministic demo credentials and sample questions with:
```bash
docker compose exec app python manage.py bootstrap_mvp
```
Default output:
- host username: `demo-host`
- host password: `demo-pass`
- category slug: `general`
- questions: `3`
You can override the host/category names with `--username`, `--password`, `--category-slug`, and `--category-name`.
For a quick seeded regression flow, run:
```bash
docker compose exec app python manage.py smoke_staging --artifact /tmp/wpp-smoke.json
```
That creates `smoke-host` / `smoke-pass`, ensures one active smoke question exists, and exercises one full round. Use `bootstrap_mvp` for the reusable local try-out account.
## Local MVP Smoke
For a one-command local MVP proof, run:
```bash
./scripts/run_local_mvp_smoke.sh
```
That starts the compose stack, waits for `/healthz`, runs `bootstrap_mvp`, executes `smoke_staging`, and writes a JSON artifact under `artifacts/local/`.
If port `8000` is busy on your machine, use `APP_PORT=18000 ./scripts/run_local_mvp_smoke.sh`.
By default the stack stays up after the smoke so you can continue in the browser. Use `KEEP_STACK_RUNNING=0` if you want the script to shut the stack down on exit.
## Release Gate
Run the full local MVP release gate with:
```bash
./scripts/verify_mvp_release.sh
```
That runs repo lint, shared i18n drift checks, Django checks/tests, both frontend test/build pipelines, and a `docker compose config` sanity pass.
## Optional SPA Shell
To serve the Angular shell as the UI path instead of the legacy templates:
```bash
USE_SPA_UI=true docker compose --profile spa up --build
```
Use these entry points:
- `http://localhost:4200/` for the SPA landing page with host login, host session creation, and player join
- `http://localhost:4200/host?session=ABC123` for the host shell after a session exists
- `http://localhost:4200/player?session=ABC123` for the player shell after join
- `http://localhost:8000/lobby/ui/host` and `http://localhost:8000/lobby/ui/player` if you want Django to render the SPA shell with `USE_SPA_UI=true`
The raw SPA container serves the compiled Angular app at `/` and also proxies `/accounts/*`, `/lobby/*`, and other Django endpoints back to `http://localhost:8000`.
`WPP_SPA_ASSET_BASE` still points at `http://localhost:4200/browser` because Django-rendered SPA pages load their static bundles from the compiled Angular `browser/` directory.