fix(compose): give all-in-one its own checkout cache volume - #60
Merged
Conversation
Every tpk stream (kg_nodes/kg_edges/kg_repos/kg_ingest_log/kg_users/ kg_roles/kg_sessions/chat_audit_log) is now created and queried under a dedicated database — `tpk` by default — instead of the server's `default` database. This keeps tpk's objects out of `default`, lets them be granted or dropped as a unit, and avoids collisions when tpk shares a Timeplus instance (e.g. the k8s app-only mode against an existing Timeplus Enterprise). - config: add `database()` (env TIMEPLUS_DATABASE > [db].database > "tpk"), validated as an identifier. - db: add `qualified(name, prefix)` -> `<database>.<prefix><name>`; ensure_schema runs `CREATE DATABASE IF NOT EXISTS` first; all DDL and drop_schema qualify names. get_client stays unscoped (connects to the always-present default DB) to avoid a bootstrap chicken-and-egg — connecting with database= fails if it doesn't exist yet. - Route every stream identifier through db.qualified(): tools, corpus, auth, audit, ingest, api, cli (status), transfer. TPK_STREAM_PREFIX still namespaces within the database. - tests: qualified()/database() precedence + updated backend DDL assertions. Verified end-to-end on live proton (create/upsert/read/delete/drop). - docs: README Configuration matrix + a `tpk` database section with the migration note (existing `default` data isn't moved — re-ingest or export/import, or set TIMEPLUS_DATABASE=default); repos.toml/.env.example. Migration: existing deployments' streams stay in `default`; after upgrade tpk reads from `tpk` (empty) until re-ingested or export/import'd. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XPzYZXxyTdj5G25KoujpHb
The all-in-one container runs as UID 101 (proton) while the DB + App `app`
container runs as root. Both compose files declared the same `tpk-checkouts`
volume, and because they share a compose project name they resolve to one
volume — so checkouts written by one stack are owned by a user the other
can't operate on, and git rejects them:
fatal: detected dubious ownership in repository at
'/opt/tpk/.checkouts/proton-enterprise/v3.3.1'
Same root cause as the shared-data-volume issue fixed earlier (#53); apply the
same split: the all-in-one file now uses `tpk-proton-checkouts`, so the two
deployments keep independent, consistently-owned checkout caches.
Note: an existing shared `tpk-checkouts` volume stays owned by whichever stack
wrote it first; clear it once (`docker volume rm <project>_tpk-checkouts`) or
chown it to the DB+App app user (root) after upgrading.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XPzYZXxyTdj5G25KoujpHb
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.
Problem
Running the all-in-one stack and then the DB + App stack, ingest fails with:
Root cause
The all-in-one container runs as UID 101 (proton); the DB + App
appcontainer runs as root. Bothdocker-compose.ymlanddocker-compose.allinone.ymldeclared atpk-checkoutsvolume, and since they share the compose project name they resolve to the same volume (<project>_tpk-checkouts). So the all-in-one run populates the shared cache with 101-owned git checkouts, and when the DB + Appapp(root) later runsgit fetchon them, git'ssafe.directoryprotection rejects the ownership mismatch.This is the same class of bug as the shared data volume fixed in #53 — the fix is the same split.
Fix
The all-in-one file now uses a distinct
tpk-proton-checkoutsvolume (mirroring the existingtpk-proton-datasplit), so the two deployments keep independent, consistently-owned checkout caches.Upgrading an existing environment
A pre-existing shared
tpk-checkoutsvolume stays owned by whichever stack wrote it first. Clear it once, or chown it to the DB+App app user:🤖 Generated with Claude Code