Repository navigation
fix(add): name the local stack's Compose project after the repository - #273
Merged
Merged
Conversation
seamless add --local wrote seamless/docker-compose.yml without a top-level name, so Compose named every repository's stack after the seamless/ folder and they shared containers, the database and the signing keys. The file now names its project <repo>-seamless, keeps an existing name on a re-run, and add prints how to stop the old seamless project when it replaces an unnamed stack. Closes #270
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.
Closes #270
Problem
seamless add --localwroteseamless/docker-compose.ymlwithout a top-levelname:, so Compose named the project after the folder holding the file:seamless, in every repository. Two repositories on one machine shared containers and theseamless_pgdataandseamless_auth-keysvolumes, so users, sessions and signing keys leaked between unrelated projects.Change
generateAuthStackwritesname: <repo>-seamless.composeProjectNamederives<repo>from the repository directory: NFKD-normalized with combining marks dropped, lowercased, every run of characters outside[a-z0-9_-]turned into one dash, and leading non-alphanumerics and trailing dashes or underscores trimmed. A name with nothing left (for example日本語) falls back toapp-seamless. Volumes become<repo>-seamless_pgdataand<repo>-seamless_auth-keys.--force) keeps thename:already in the file, so a stack keeps its volumes, and a hand-edited name survives.addreplaces a compose file that has noname:(one written by 0.23.0 or earlier), it prints one line saying the old stack ran as projectseamlessand how to stop it:docker compose -p seamless -f seamless/docker-compose.yml down. Its containers would otherwise keep holding port 5312.Wrote seamless/line names the Compose project.seamless help addand the README say how the project is named.seamless_*volumes may hold other repositories' data, so remove them once nothing uses them.Known limit: two repositories with the same directory name (for example two checkouts both called
api) still get the same project name. The name stays readable on purpose, and a hand edit toname:is kept on later runs.seamless initNot changed.
initwritesdocker-compose.ymlat the root of the new app directory, so Compose already names the project after the app (my-app_pgdata). The problem here came fromaddalways using a folder namedseamless. Aname:in the init file would only restate that default. Separately, the init stack pinscontainer_name(seamless-db,seamless-auth), so two init stacks cannot run at the same time. Compose refuses the second one, so nothing is silently shared.Tests
composeProjectName: different repositories give different names, and odd directory names are cleaned up (spaces, uppercase, a leading dot or dash or underscore, accented and non-Latin unicode, parentheses, dots). Every result matches^[a-z0-9][a-z0-9_-]*$.generateAuthStack: writesname:, keeps it across re-runs and after a hand edit, and reports when it replaces an unnamed stack.add: two repositories get distinct project names.--forcekeeps the name, and the notice prints only when an unnamed stack is replaced.Verification
npm run build,npm test(63 files, 1289 passed, 4 skipped),npm run check:types-current,npm run check:templates-pin, and the pre-commit coverage run all pass.Real run of the built CLI (
add --local --yes --skip-install --email=you@example.com </dev/null) in two scratch repositories,Shop Appand.blog, thendocker compose -f seamless/docker-compose.yml config(Docker 29.8.2):A
--forcere-run keptshop-app-seamless. Aftername:was deleted from the file, a--forcerun printed the notice and wroteshop-app-seamlessagain.Docs to update after release (fells-code/seamless-auth-docs)
src/content/docs/operate/add-to-existing-app.mdxL102: sample output now readsWrote seamless/: docker-compose.yml (Compose project <repo>-seamless), .env, .gitignore.seamless/docker-compose.ymlrow) and L123-126 (re-runningadd --local): add that the compose project is<repo>-seamlessand is kept on a re-run, plus the upgrade note for stacks written by 0.23.0 or earlier.src/content/docs/reference/cli-commands.mdxL284-286 (seamless/docker-compose.ymlbullet under### --local): mention thename: <repo>-seamlessproject and the volume names.