Publish the standalone console on :8081, the family's port for this app
The family numbers its ports app / db / static, twenty apart per app (Galena 8012/8014/8021, Sygna 8032/8034/8041, Compass 8052/8054/8061, Counsel 8072/8074/8081), so the stacks run side by side on one machine; :80 collides with a sibling stack on the first `up`. On the platform the modules publish nothing and Atrium's front door alone keeps :80. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,7 +39,7 @@ at `/atrium` signs you in here — same origin, same cookie, same `session` row,
|
||||
signed in is not being let in: **no `module_permission` row naming `counsel` means no entry**, and
|
||||
that is decided once, in `deps.get_current_user`. Standalone
|
||||
at the origin root stays supported and is the **default** (`ROOT_PATH` and `IDENTITY_SCHEMA` empty,
|
||||
this repo's own `docker-compose.yml`, uvicorn on :80 with no proxy), and platform mode must never become a code
|
||||
this repo's own `docker-compose.yml`, uvicorn published on :8081 with no proxy), and platform mode must never become a code
|
||||
fork of it: every default reproduces the standalone behaviour, and `settings.shares_identity` is the
|
||||
one predicate anything branches on.
|
||||
|
||||
@@ -87,7 +87,7 @@ and the deployment runbook `db/managed/README.md`.
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
DREDD_CORE_TOKEN=... docker compose up -d --build # full stack: postgres → migrate(+seed) → backend on :80;
|
||||
DREDD_CORE_TOKEN=... docker compose up -d --build # full stack: postgres → migrate(+seed) → backend on :8081;
|
||||
# the token is a BuildKit build secret: shell only, never .env
|
||||
cd backend && pytest # DB-free unit tests; DB-backed ones auto-skip w/o DATABASE_URL,
|
||||
# and tests/test_platform_live.py also needs IDENTITY_SCHEMA
|
||||
|
||||
@@ -27,14 +27,14 @@ Built from the product/architecture spec in `../Counsel-Scorecard/`.
|
||||
|
||||
```bash
|
||||
cp .env.example .env # then edit every change_me_* value
|
||||
DREDD_CORE_TOKEN=github_pat_... docker compose up -d --build # postgres → migrate (+ seed) → backend on :80
|
||||
DREDD_CORE_TOKEN=github_pat_... docker compose up -d --build # postgres → migrate (+ seed) → backend on :8081
|
||||
```
|
||||
|
||||
The build installs the private `dredd-core` package, so it needs a GitHub token with read access to it, passed
|
||||
as a BuildKit build secret: keep it in the shell, never in `.env`.
|
||||
|
||||
Once the backend reports healthy (`docker compose ps`), open the **admin console** at
|
||||
<http://localhost/>, the API docs at <http://localhost/api/v1/docs>, and sign in with the
|
||||
<http://localhost:8081/>, the API docs at <http://localhost:8081/api/v1/docs>, and sign in with the
|
||||
bootstrap admin from your `.env`. Full walkthrough, observability, and local-dev paths are in
|
||||
**[Running it](#running-it)**.
|
||||
|
||||
@@ -118,7 +118,7 @@ See **[`CREDITS.md`](CREDITS.md)** for the full dependency list (what each piece
|
||||
flowchart TB
|
||||
user(["Internet / LAN"])
|
||||
|
||||
subgraph host["Host — only :80 is published"]
|
||||
subgraph host["Host — only :8081 is published"]
|
||||
backend["FastAPI backend<br/>console · API · security headers<br/>routers → services → models (ORM)"]
|
||||
end
|
||||
|
||||
@@ -132,7 +132,7 @@ flowchart TB
|
||||
end
|
||||
end
|
||||
|
||||
user -- "HTTP :80 (TLS: your own terminator)" --> backend
|
||||
user -- "HTTP :8081 (TLS: your own terminator)" --> backend
|
||||
backend --> pg
|
||||
backend -. "OTLP/gRPC" .-> otel
|
||||
otel --> ch
|
||||
@@ -283,21 +283,21 @@ Compose starts three services in dependency order, and `depends_on` conditions e
|
||||
3. **backend** — starts only after migrate **completes successfully**, then runs its own healthcheck against `/api/v1/health`. It is the only service published to the host: container port `8000` on host port `80`. It serves the API, the admin console and the security headers itself (there is no reverse proxy in this stack).
|
||||
|
||||
Postgres (`5432`) is `expose`-only — not reachable from the host. There is no TLS in this stack: for
|
||||
HTTPS put your own terminator in front of port 80 and set `FORWARDED_ALLOW_IPS` to its address, or run
|
||||
HTTPS put your own terminator in front of port 8081 and set `FORWARDED_ALLOW_IPS` to its address, or run
|
||||
Counsel as a module of the platform (below), where Atrium is the front door.
|
||||
|
||||
It's ready when the backend healthcheck passes:
|
||||
|
||||
```bash
|
||||
docker compose ps # backend should show (healthy)
|
||||
curl -s localhost/api/v1/health
|
||||
curl -s localhost:8081/api/v1/health
|
||||
```
|
||||
|
||||
### 3. What you can open
|
||||
|
||||
- **Admin console (UI):** `http://localhost/` — a single static HTML/JS file served same-origin by the backend (any unknown non-API path returns it, so deep links survive a reload).
|
||||
- **API:** `http://localhost/api/v1` — interactive docs at **`http://localhost/api/v1/docs`**.
|
||||
- **Liveness:** `http://localhost/healthz` (an empty 200, no database) and `http://localhost/api/v1/health` (checks the database).
|
||||
- **Admin console (UI):** `http://localhost:8081/` — a single static HTML/JS file served same-origin by the backend (any unknown non-API path returns it, so deep links survive a reload).
|
||||
- **API:** `http://localhost:8081/api/v1` — interactive docs at **`http://localhost:8081/api/v1/docs`**.
|
||||
- **Liveness:** `http://localhost:8081/healthz` (an empty 200, no database) and `http://localhost:8081/api/v1/health` (checks the database).
|
||||
|
||||
Sign in with the bootstrap admin (`BOOTSTRAP_ADMIN_EMAIL` / `BOOTSTRAP_ADMIN_PASSWORD` from your `.env`). Served by the backend the console targets `/api/v1` automatically (relative, same-origin — no CORS, nothing to configure).
|
||||
|
||||
@@ -313,7 +313,7 @@ The seed already created an **open review cycle** (`Q2 2026`) and a **default qu
|
||||
> the platform you would create the person in Atrium instead, and give them their Counsel role here
|
||||
> (step 3 becomes *Users → Edit role*).
|
||||
|
||||
1. Open `http://localhost/` and **sign in** as the bootstrap admin (`admin@example.com` + your bootstrap password).
|
||||
1. Open `http://localhost:8081/` and **sign in** as the bootstrap admin (`admin@example.com` + your bootstrap password).
|
||||
2. **Firms** (sidebar → *Directory*) → **New firm** → enter a Name, status `active` → **Create firm**.
|
||||
3. **Users** (sidebar → *Admin*) → **Create user** → set Email, Full name, Password and Role `matter_owner` → **Create user**.
|
||||
4. **Matters** (sidebar → *Directory*) → **New matter** → set Title, pick the Firm / Practice area / Jurisdiction, set **Owner** = the `matter_owner` user (the Owner selector is admin-only), choose Type/Complexity → **Create matter**.
|
||||
@@ -336,7 +336,7 @@ The console targets its own origin by default, deriving the base from the page i
|
||||
|
||||
### 6. Troubleshooting
|
||||
|
||||
- **Port 80 already in use** — another service holds host port 80. Stop it, or change the backend's `ports:` mapping (e.g. `"8080:8000"`). Postgres doesn't publish to the host, so only the backend's `80` can collide.
|
||||
- **Port 8081 already in use** — another service holds host port 8081. The family numbers ports app / db / static per app (Galena 8012 / 8014 / 8021, Sygna 8032 / 8034 / 8041, Compass 8052 / 8054 / 8061, Counsel 8072 / 8074 / 8081) so sibling stacks don't collide; stop the other service, or change the backend's `ports:` mapping (not to 8080, which is HyperDX's UI). Postgres doesn't publish to the host, so only the backend's `8081` can collide.
|
||||
- **403 when submitting an evaluation** — you're signed in as someone who administers Counsel (or as `legal_ops`/`viewer`). Only the `matter_owner` who owns the matter can submit; switch to that user.
|
||||
- **Login fails for the bootstrap admin** — the password is wrong or `change_me_*` was never replaced. Confirm `BOOTSTRAP_ADMIN_EMAIL` / `BOOTSTRAP_ADMIN_PASSWORD` in `.env`; the seed creates the admin idempotently from those values.
|
||||
- **"Invalid email or password" after several tries** — app-level lockout engaged. After `LOGIN_MAX_ATTEMPTS` (default 5) consecutive failures the account locks for `LOGIN_LOCKOUT_MINUTES` (default 15). Wait it out or sign in as a different administrator. (On the platform, signing in happens at the hub and so does the lockout.)
|
||||
@@ -628,7 +628,7 @@ Postgres 16, `alembic upgrade head && python -m app.seed`, then `pytest`.
|
||||
```
|
||||
.
|
||||
├── README.md · CREDITS.md · CLAUDE.md · SHOWCASE.md docs · credits/licenses · guidance · screenshots
|
||||
├── docker-compose.yml app stack (postgres · migrate · backend on :80)
|
||||
├── docker-compose.yml app stack (postgres · migrate · backend on :8081)
|
||||
├── docker-compose.managed-db.yml override for a managed PostgreSQL database (no local postgres)
|
||||
├── .env.example · .gitattributes config template · LF normalization
|
||||
├── .github/workflows/ci.yml Postgres 16/17 tests · managed-database job · license gate
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
"""What Caddy used to do in front of this backend: security headers, the body cap, the console.
|
||||
|
||||
The platform no longer runs Caddy. Atrium's backend is the front door and forwards `/counsel/*` here
|
||||
with the prefix stripped (exactly as `handle_path /counsel/*` did), and a standalone install runs
|
||||
uvicorn on :80 with nothing in front. Either way this process now answers for everything a browser
|
||||
with the prefix stripped (exactly as `handle_path /counsel/*` did), and a standalone install publishes
|
||||
uvicorn on host port 8081 with nothing in front. Either way this process now answers for everything a browser
|
||||
gets, so the rules Counsel's Caddyfile applied live here, unchanged in substance.
|
||||
|
||||
**Every path comparison reads the ROUTE path** (`starlette._utils.get_route_path`), never
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
The backend now serves its own console, sets its own security headers and answers /healthz, both as
|
||||
a platform module (Atrium forwards /counsel/* with the prefix stripped, uvicorn re-adds it via
|
||||
--root-path) and standalone (uvicorn on :80, nothing in front).
|
||||
--root-path) and standalone (uvicorn published on :8081, nothing in front).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
+10
-2
@@ -1,9 +1,17 @@
|
||||
# Counsel Scorecard — application stack (backend + Postgres + migrate).
|
||||
#
|
||||
# No reverse proxy: the backend serves the API, the console and its own security headers, and is
|
||||
# published on host port 80. For TLS put your own terminator in front (and list its address in
|
||||
# published on host port 8081. For TLS put your own terminator in front (and list its address in
|
||||
# FORWARDED_ALLOW_IPS below), or run Counsel as a module of the platform, where Atrium is the front door.
|
||||
#
|
||||
# ── Host ports ────────────────────────────────────────────────────────────────
|
||||
# The family numbers its development ports app / db / static, twenty apart per app:
|
||||
# Galena 8012 / 8014 / 8021, Sygna 8032 / 8034 / 8041, Compass 8052 / 8054 / 8061,
|
||||
# Counsel 8072 / 8074 / 8081. The stacks therefore run side by side; taking :80 would collide
|
||||
# with a sibling stack on the first `up`. Counsel's console + API are published once, on 8081 (8080 stays
|
||||
# HyperDX's UI).
|
||||
# On the platform the modules publish nothing and Atrium's front door keeps :80.
|
||||
#
|
||||
# cp .env.example .env # then edit the change_me_* values
|
||||
# DREDD_CORE_TOKEN=github_pat_... docker compose up -d --build
|
||||
#
|
||||
@@ -68,7 +76,7 @@ services:
|
||||
frontend: ./frontend
|
||||
secrets: [dredd_core_token]
|
||||
restart: unless-stopped
|
||||
ports: ["80:8000"]
|
||||
ports: ["8081:8000"]
|
||||
env_file: .env
|
||||
environment:
|
||||
# Nothing sits in front of the backend here, so no hop may set X-Forwarded-For: empty = the
|
||||
|
||||
Reference in New Issue
Block a user