Score the recreated newz repo's M4 (Docker Compose developer environment) at 20 (17/29 base + 3 bonus), overall level 1 as delivered: fixed 172.28.0.0/16 subnet conflicts on this host, the frontend healthcheck fails, and no default .env is committed. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
6.8 KiB
M4: Setup Developer Environment - Score Report
Model: qwen3.8-27b
Repository scored: ../newz (/home/daniel/Gitea/daniel/newz), committed origin/develop at ed7b304 (M4 commit, after 9144411 sample-data fix)
Rubric: milestone/m4-setup-developer-environment-scoring.md
Total Score: 20 (17 / 29 base + 3 bonus) - Overall level 1 as delivered
Overall level 1 as delivered. On this machine, make dev (docker compose up -d --build) fails in the repo's own directory. The compose file hardcodes subnet 172.28.0.0/16 for newzy-network, and that range is already used by the running newz_newzy-network network from your working copy. Docker reports Pool overlaps with other one on this address space, so the stack does not start. The stack does work once the subnet line is removed (tested in a temp copy, see below). The rubric's level 2 also asks for a .env file with defaults, and the repo has only .env.example.
Verification Performed
All checks ran on a clean git archive export of origin/develop in a temp directory. I did not touch the running newz stack.
| Check | Result |
|---|---|
docker compose config -q |
Passes. |
make help and make -n for dev, stop, restart, backend-start, frontend-start, clean |
Targets expand as documented. |
docker compose up -d --build (as committed) |
Fails: Pool overlaps with other one on this address space for 172.28.0.0/16. |
| Existing host state | A newz compose project is already running from /home/daniel/Gitea/daniel/newz, holding ports 3000 and 8000. I did not stop it. |
Same stack with the ipam block removed and host ports 13000/18000 (temp copy only) |
Starts. Backend healthy. Via the frontend proxy: / and /articles return the SPA (200); /api/v1/version and /api/v1/health return 200 through nginx. |
| Frontend container healthcheck | Fails with exit code 1 on every run. wget http://localhost/ tries [::1]:80, but nginx listens on IPv4 only. The container reports unhealthy. (Confirmed on the running newz-frontend-1 container as well.) |
Backend pytest (temp export) |
19 passed, 95% coverage. |
Frontend npm run test (temp export) |
23 passed in 5 files. |
Frontend npm run e2e -- --project=chromium (temp export) |
9 passed. |
| Data directory after compose run | ./data/db and newzy.db are created owned by root, so a non-root rm -rf data/ (make clean) fails with Permission denied. |
Scoring by Criterion
| Criterion | Score | Max | Notes |
|---|---|---|---|
| docker-compose Configuration | 3 | 4 | Both services with the right build contexts, ports 3000 and 8000, a bridge network, the ./data/db volume, depends_on with service_healthy, and restart policies. Backend has a working healthcheck. Frontend healthcheck is broken (see above). The hardcoded subnet stops the stack from starting on hosts where that range is taken. |
| Environment Configuration | 2 | 3 | .env.example documents each variable with comments and defaults. .env is not in the repo; the README asks users to copy the template. .env* is git-ignored, with !.env.example. |
| Development Commands | 3 | 4 | dev, stop, restart, backend-start, frontend-start, build, logs, status, shells, and help are present. make test runs frontend unit and backend tests, but E2E is a separate make e2e target, so test does not cover both. clean runs rm -rf data/, which fails on the root-owned database directory. docker image prune -f removes only dangling images. |
| Security & Best Practices | 2 | 3 | .env, .env.*, and data/ are git-ignored. data/.gitignore keeps the directory structure while excluding the database. .dockerignore files exist for both services. Deduction: the backend image runs as root (no USER). |
| Documentation | 3 | 3 | README section covers prerequisites, quick start, services, ports, networking and storage, environment variables, Makefile reference, troubleshooting (including the data/ ownership fix), and running without Docker. Subnet conflicts are not documented. |
| Service Communication | 1 | 2 | Bridge network with frontend → backend proxying verified through nginx. Deduction: the fixed subnet prevents startup on hosts with an overlapping network, and the frontend healthcheck fails, so services are reported as not healthy. |
| Build Optimization | 3 | 3 | Backend uses python:3.11-slim, pip --no-cache-dir, PYTHONDONTWRITEBYTECODE, and PYTHONUNBUFFERED. Frontend is multi-stage (node:20-alpine build, nginx:1.27-alpine serve) with npm ci. Both services have .dockerignore. |
| Base total | 17 | 29 |
Bonus
- +1 Logs command and restart policies: awarded.
make logsandrestart: unless-stoppedon both services. - +2 README Docker troubleshooting and
.dockerignorefiles: awarded. Troubleshooting section present, and both.dockerignorefiles exclude build artifacts. - +3 Full test automation and clean that removes images: not awarded.
make testskips E2E, andcleandoes not remove all images.
Bonus total: +3.
Critical Requirements Checklist (from rubric)
docker-compose.ymldefines both backend and frontend services- Ports 3000 and 8000 configured
- Docker network defined (but its fixed subnet clashes on this host)
.env.examplepresent (.envnot committed)
Other Issues Found
- Hardcoded subnet
172.28.0.0/16. Remove theipamblock (let Docker pick a range), or make the subnet configurable. Currentlymake devfails on any host where that range is taken, including this one. - Frontend healthcheck fails. Change the Dockerfile
HEALTHCHECKtowget -qO- http://127.0.0.1/(or make nginx listen on[::]:80as well). The container otherwise serves correctly. - Root-owned
data/after first run. The backend container creates./data/dbas root. Use a non-rootuser:in compose, or pre-create the directory in the Makefile. Otherwisemake cleanfails for ordinary users. make testdoes not include E2E. Either adde2eto thetesttarget, or document thatmake testis unit-only.- No
.envdefault file. The M4 prompt asks for one. A committed.envwith dev defaults, or amake envtarget that copies the template, would satisfy it. - Backend runs as root. Add a non-root
USERtobackend/Dockerfile. - Running stack from your working copy is still up on ports 3000 and 8000, and its frontend container is
unhealthy(see item 2).
Path to a Higher Score
- Remove the fixed subnet from
docker-compose.yml. - Fix the frontend
HEALTHCHECKtarget to127.0.0.1. - Make the database directory writable by the host user, and confirm
make cleanworks from a non-root shell. - Add
e2etomake testand add a.envdefault or a copy target. - Run the backend container as a non-root user.