A1: Django skeleton with web and worker processes (ADR-54, ADR-55, WEB-01, WEB-07, ARC-70..74)
Django 5.2 project (config/, apps/accounts with a custom User and case-insensitive usernames, apps/lottery with the run_worker command, apps/web with a placeholder home and /health/live, apps/ops), SQLite in WAL with IMMEDIATE transactions, secrets and hosts from the environment. The compose stack is now web + worker + caddy and serves https://localhost; the old FastAPI service is out of the stack until roadmap D1. The three old infrastructure tests follow the new Dockerfile and compose. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79f7ebe53e
commit
fc23a75c9b
43 files changed
+709
-61
No files matched your search
@@ -8,7 +8,7 @@ The user communicates in Italian in chat — reply to them in Italian. Everythin
|
||||
|
||||
## Project status
|
||||
|
||||
All 10 stages of the original build order are code-complete and unit-tested — 758 tests, all under `tests/unit/` (`tests/integration/` is an empty package). Beyond them: Docker + Caddy deployment, admin dashboard (`/admin`), static test UI (`/`), pending-inclusive balance display, an SSE push channel layered over the original polling, self-service password change + admin password reset, and the reconciliation/corroboration machinery below.
|
||||
All 10 stages of the original build order are code-complete and unit-tested — 775 tests, the old stack's under `tests/unit/` and the Django ones under `tests/django/` (`tests/integration/` is an empty package). Beyond them: Docker + Caddy deployment, admin dashboard (`/admin`), static test UI (`/`), pending-inclusive balance display, an SSE push channel layered over the original polling, self-service password change + admin password reset, and the reconciliation/corroboration machinery below.
|
||||
|
||||
Verified on mainnet with real money: registration + address derivation, deposit crediting (at the time, 1-conf; deposits now need `deposit_confirmations`), a real 10 PLM bet (broadcast → confirmed → change credited back), and one full round cycle (close → draw on a real block hash → 70/30 payout with sat math checked against the broadcast tx → confirmation → close → next round auto-opened). **Withdrawal and the RBF bump path have never been exercised against a live broadcast** — unit-tested only.
|
||||
|
||||
@@ -34,6 +34,18 @@ Human-facing guides are in [docs/](docs/), in Italian by explicit request (an ex
|
||||
| Accepted limits | [docs/limiti-noti.md](docs/limiti-noti.md) |
|
||||
| Fix order for open B-nn | [docs/piano-correzioni.md](docs/piano-correzioni.md) |
|
||||
|
||||
## Django migration in progress (branch `django-migration`)
|
||||
|
||||
The repo is being moved from FastAPI to Django — plan in [roadmap.md](roadmap.md), decisions in ADR-54…60, requirements in [docs/sito-e-app.md](docs/sito-e-app.md) (`WEB`). Until roadmap D1 removes it, the sections below describe the **old FastAPI stack**: its code (`app/`) and its `tests/unit/` suite stay in the repo and must keep passing, but it is **no longer part of `docker-compose.yml` or the Docker image**.
|
||||
|
||||
New layout: `config/` (settings, urls, wsgi), `apps/accounts` (custom `User`), `apps/lottery` (round engine and the `run_worker` command), `apps/web` (public site and player app), `apps/ops` (staff console), tests in `tests/django/` (settings `config.settings_test`, pytest-django). The stack is `web` (gunicorn) + `worker` (`manage.py run_worker`) + `caddy` on one SQLite file in WAL mode (ADR-55); it needs `DJANGO_SECRET_KEY` in `.env` (≥ 50 chars) and serves `https://localhost` with no domain (WEB-07).
|
||||
|
||||
```bash
|
||||
DJANGO_DEBUG=true python manage.py runserver # quick local run, no Docker (http://localhost:8000)
|
||||
python manage.py makemigrations # after editing a Django model; tests fail if one is missing
|
||||
python -m pytest # old suite + tests/django together
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
The server always runs via Docker, in dev and prod alike — there is no supported way to run `uvicorn` directly. The venv (`.venv/`) is only for local tooling: tests, Alembic migrations, and the one-time key/secret scripts.
|
||||
@@ -49,7 +61,7 @@ PYTHONPATH=. python scripts/decrypt_master_key.py # ops recovery: decrypt+pr
|
||||
PYTHONPATH=. python scripts/encrypt_master_key.py # ops bootstrap: import an externally-generated xprv (--overwrite to replace)
|
||||
PYTHONPATH=. python scripts/electrum_smoke_test.py # manual check: connect, handshake, subscribe to headers, print the tip
|
||||
|
||||
python -m pytest # all 758 tests
|
||||
python -m pytest # all 775 tests
|
||||
python -m pytest tests/unit/test_hd.py # one file
|
||||
python -m pytest tests/unit/test_hd.py::test_derivation_is_deterministic # one test
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user