Repository navigation
Description
Summary
make clean runs docker compose … down -v on the production stack when production containers are up. On a production server that is a full outage: it stops and removes every production container. It then deletes the redis-data and traefik-certs volumes.
- Severity: Medium. A person must run the command on a production host. But the self-hosting guide installs with
makefrom a checkout on that host, and the help text gives no warning. - Area:
Makefile,README.md - Source: repository review of 2026-10-14
Where
Makefile:338–342: the production branch ofcleanrunsdocker compose -f docker-compose.prod.yml --env-file .env.production down -v.docker-compose.prod.yml:47setsname: docsplus. So theps -qcheck finds the production stack from any checkout on the host that holds.env.production. Without that file, Compose stops withcouldn't find env file, and the check finds nothing (measured).- Volumes the command deletes (
docker-compose.prod.yml:654–658):redis-dataholds the Redis append-only file, so it holds the BullMQ queues (see Require a password on production Redis #438). Pub/sub messages are never stored there.traefik-certsholds the TLS certificates. Traefik must reissue every certificate on the next start.
- The dev branch can reach production too.
docker-compose.dev.ymlanddocker-compose.local.ymlset noname:, so Compose names the project after the checkout folder. Measured: a folder nameddocs.plus, the default clone folder, gets the project namedocsplus. If that checkout also has.env.development, the dev branch runs first. Itsdownthen removes the production containers whose service names match:redis,rest-api,hocuspocus-server,hocuspocus-worker,webappandadmin-dashboard(read from code, not measured).traefikstays. The production volumes stay too, because the dev file does not declare them. Makefile:58describescleanas "Clean everything (auto-detects dev/prod/local)".README.md:224does say "DATA LOSS".docs/self-hosting/install.md:147and:165tell self-hosters to runmake buildandmake up-prodin their checkout. That checkout holds.env.production.docsy-postgres-prodanddocsy-redis-prodin thedocker volume rmlist (Makefile:350) are dead. A repo-wide search finds those names only on that line.
Fix plan
-
Make the production check the first branch of
clean, and make it refuse:@if docker compose -f docker-compose.prod.yml --env-file .env.production ps -q 2>/dev/null | grep -q .; then \ echo "⛔ The production stack is running. make clean does not touch it."; \ echo " To stop it on purpose: docker compose -f docker-compose.prod.yml --env-file .env.production down"; \ exit 1; \ elif … dev branch …
The dev and local branches stay as they are. Deleting the production branch is not enough. A running production stack would then fall through to the last branch. That branch prints "No running containers found" and tries to remove the production
:latestimages. -
Remove
docsy-postgres-prodanddocsy-redis-prodfrom thedocker volume rmlist. -
Change the help line at
Makefile:58to "Clean dev or local containers and volumes (DATA LOSS)". ChangeREADME.md:224to match.
Out of scope
- A confirmation prompt. The fix is a hard stop.
- Giving the dev and local compose files their own
name:. File it separately if wanted. Until then, adocs.pluscheckout that has.env.developmentbut no.env.productioncan still reach production through the dev branch. - Changes to the other
maketargets. - A laptop that holds
.env.productionand runs the backend-local stack (docker-compose.backend-local.override.yml, alsoname: docsplus). There, the refusal fires with the production message. Stop that stack first.
Acceptance criteria
- From a checkout that holds
.env.production, with the production stack up,make cleanexits non-zero and prints the refusal. Every production container and volume stays in place. -
make helpandREADME.md:224no longer say thatcleanhandles production. Thedocker volume rmlist no longer namesdocsy-postgres-prodordocsy-redis-prod. - With no production stack,
make cleantears down a running dev or local stack as before.
Verify
- Run
make -n clean. Check that the production check comes first and that its branch only prints and exits. - On a throwaway machine or VM only, start the production stack and run
make clean. Starting onlyredisis enough for the check:docker network create docsplus-network, thendocker compose -f docker-compose.prod.yml --env-file .env.production up -d redis. Check the exit code anddocker ps. Do not run this on a machine whose local data you need, because the local branch runsdown -v.
Related
- Fix the full-Docker dev stack: no webapp source in the container, and no host.docker.internal on Linux #482 fixes the dev compose file whose stack the
cleandev branch tears down. Neither issue edits the other's files.
Generated by Claude Code
Activity