Stop installing the dev docker-compose unit on production hosts - #16
Merged
Conversation
Fixes #14. A production install provisions PostgreSQL and Redis natively — install.sh enables the distro services and creates the role and database with psql. But it also ran `make install-services`, which links the DEV unit set, and that includes `danbyte-infra`: `docker compose up -d postgres redis`. Then danbyte-web and danbyte-workers both declared `Wants=danbyte-infra.service`, so enabling them started the container stack. The result on a host that already ran PostgreSQL: an idle container with an empty database, publishing 5432 against the server Danbyte is actually using. Harmless as observed, but the two compete for the port and whichever starts first wins it — so a reboot could have pointed Danbyte at the empty container, migrated into it, and looked exactly like total data loss. - Makefile: split the unit list into DEV_SERVICES (mockups, infra, backend) and SHARED_SERVICES (workers, docs). PROD_SERVICES is now the full production set, and install-prod-services links and enables the timers too, since install.sh no longer calls install-services for them. - install.sh: link PROD_SERVICES only. - danbyte-web, danbyte-workers: drop `Wants=danbyte-infra.service`. It is a dev convenience and has no business in a unit shipped to production; danbyte-backend (dev-only) keeps it, and `make up` starts infra explicitly. - Docs: state that production uses native PostgreSQL/Redis and that compose is development only, how to point an install at an existing server, and how to remove the stray unit and container from an install made before this fix. Existing installs are unaffected until re-run; the docs note covers cleanup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14.
A production install provisions PostgreSQL and Redis natively —
install.shenables the distro services and creates the role and database withpsql. But it also ranmake install-services, which links the dev unit set, and that includesdanbyte-infra:docker compose up -d postgres redis. Thendanbyte-webanddanbyte-workersboth declaredWants=danbyte-infra.service, so enabling them started the container stack.On a host that already ran PostgreSQL that left an idle container with an empty database, publishing 5432 against the server Danbyte is actually using.
Worth calling out: harmless as observed, but the two compete for the port and whichever starts first wins it. A reboot could have pointed Danbyte at the empty container, migrated into it, and looked exactly like total data loss — while the real data sat unreachable in the host cluster.
Changes
Makefile— split the unit list intoDEV_SERVICES(mockups, infra, backend) andSHARED_SERVICES(workers, docs).PROD_SERVICESis now the full production set, andinstall-prod-serviceslinks and enables the timers too, sinceinstall.shno longer callsinstall-servicesfor them.scripts/install.sh— linkPROD_SERVICESonly.services/danbyte-web.service,services/danbyte-workers.service— dropWants=danbyte-infra.service. It's a dev convenience with no business in a unit shipped to production.danbyte-backend(dev-only) keeps it, andmake upstarts infra explicitly, so the dev workflow is unchanged.docs/getting-started/installation.md— state that production uses native PostgreSQL/Redis and that compose is development only, how to point an install at an existing server, and how to remove the stray unit and container from an install made before this fix.Notes
Existing installs are unaffected until they re-run the installer; the docs note covers manual cleanup.
make docs-buildis clean andbash -n scripts/install.shpasses.