[1] Local runnable product shell #36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Objective
Make the complete application stack boot locally, even before ingestion behavior is complete.
This is a vertical product foundation issue: after it is done, contributors should be able to start the system, reach the web app, confirm database readiness, and run later ingestion work inside the same shape of deployment that production will use.
Scope
.env.example, ignore rules, andJustfilecommands.Out of scope
Done when
just upor equivalent starts the full local Compose stack.Implementation plan from scaffold audit
This plan covers the remaining gaps for completing #36: a local runnable product shell where the full Compose stack starts, Flyway runs, the web service is reachable and healthy, and scheduler/worker placeholders prove database connectivity.
Current scaffold status
postgres,flyway,data-ingest-scheduler,data-ingest-worker, andweb.services/flyway/sqlafter PostgreSQL is healthy.webpublishes a host port in the rendered Compose config..env.example,.gitignore, andJustfileexist.docker compose --env-file .env.example configuv run pytestinservices/data-ingestpnpm testinservices/webFunctional gaps to close
http://127.0.0.1:3000/health, but the implemented route is/api/health. This likely leaves the web container unhealthy even when the app is serving correctly.lawnet-ingestcurrently only printsHello worldand has no database dependency or connection check.data-ingest-scheduleranddata-ingest-workercommands passscheduler/workerarguments, but the CLI ignores arguments, so there is no role-specific startup behavior or validation.127.0.0.1:3406, while.env.examplesetsWEB_HOST_PORT=12345. Local startup docs are therefore not reproducible as written.just upin this audit. Static config and unit tests pass, but the done criteria require runtime verification..output,.venv,__pycache__,.pytest_cache,node_modules). They are ignored, but the repo should be checked before publishing to ensure none are tracked.Implementation checklist
Align the web health route and Compose healthcheck.
/api/health./healthroute that delegates to the same health handler and keep Compose unchanged.Add data-ingest runtime configuration.
DATABASE_URLfrom the environment.DATABASE_URLis missing or malformed enough to prevent connection.Add PostgreSQL connectivity to data-ingest placeholders.
psycopg[binary]orpsycopgplus the required runtime package.DATABASE_URLand executes a trivial query such asSELECT 1.Implement role-aware data-ingest CLI commands.
lawnet-ingest schedulerandlawnet-ingest workerexplicitly.SELECT 1, log success, and exit successfully.--helppath.&& exec sleep infinityto keep placeholders alive after the successful probe.Add data-ingest tests.
DATABASE_URLhandling.scheduler,worker, and invalid commands.Fix local documentation drift.
.env.example, README, and any smoke commands agree.http://127.0.0.1:<WEB_HOST_PORT>/api/health.just downpreserves the database volume anddocker compose down -vremoves it.Strengthen
Justfilelocal commands if needed.just upas the primary local startup command.just healthorjust smokecommand if useful, using the configured host port from.env.just migratestill works after any Flyway command changes.Verify Compose networking and host exposure.
docker compose --env-file .env.example configand confirm onlywebhasports:.postgres,flyway,data-ingest-scheduler, anddata-ingest-workerremain on internal/backend networks without host publication.egressnetwork.Run the full local stack smoke test.
cp .env.example .envif needed.just up.data-ingest-scheduleranddata-ingest-workerlogs show successful PostgreSQL probes.{"status":"ok"}.just downafter verification.Update CI coverage for the scaffold.
lbookmark changes.lper repository workflow.Acceptance verification commands
Recommended local commands after implementation:
If
WEB_HOST_PORTis not exported in the shell, use the concrete value from.env.example.Done criteria mapping
just upstarts the full local stack: verify withdocker compose psand host web request.curlagainst the documented health URL..env.example, andJustfileagree and include teardown/log commands.Non-goals for this issue
Review Findings
Thorough review of the Phase 1 implementation uncovered 3 critical bugs and several improvements. PR: #46
Critical Bugs Found
PostgreSQL volume path (
compose.yaml:22): Mounted at/var/lib/postgresqlinstead of/var/lib/postgresql/data. The PostgreSQL 18 image stores data in thedatasubdirectory — without this fix, data would not persist across container restarts.Web health check URL mismatch (
compose.yaml:90): Health check fetches/healthbut the TanStack Start route is defined at/api/health(routes/api/health.ts). This would cause the container to fail health checks and trigger continuous restarts.COMPOSE_PROJECT_NAMEfrom env file doesn't take effect (Justfile:58): Docker Compose's--env-fileonly performs variable substitution — it does not setCOMPOSE_PROJECT_NAMEas an environment variable for compose's own config. Without this fix, production and staging deployments would use the same project name from the compose file'sname:field, sharing containers, networks, and volumes.Improvements
scheduler/workersubcommands with PostgreSQL connectivity check (psycopg)web-edgenetwork (port binds to loopback).env.exampleport aligned with README (3406)Verified
just test— all 6 tests passjust lint— ruff + eslint passjust typecheck— ty + tsc passjust check-compose— valid compose config