Skip to content

fix(compose): give all-in-one its own checkout cache volume - #60

Merged
gangtao merged 2 commits into
mainfrom
fix/allinone-checkouts-volume
Aug 17, 2026
Merged

fix(compose): give all-in-one its own checkout cache volume#60
gangtao merged 2 commits into
mainfrom
fix/allinone-checkouts-volume

Conversation

@gangtao

@gangtao gangtao commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Problem

Running the all-in-one stack and then the DB + App stack, ingest fails with:

git fetch failed: fatal: detected dubious ownership in repository at
'/opt/tpk/.checkouts/proton-enterprise/v3.3.1'

Root cause

The all-in-one container runs as UID 101 (proton); the DB + App app container runs as root. Both docker-compose.yml and docker-compose.allinone.yml declared a tpk-checkouts volume, 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 + App app (root) later runs git fetch on them, git's safe.directory protection 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-checkouts volume (mirroring the existing tpk-proton-data split), so the two deployments keep independent, consistently-owned checkout caches.

Upgrading an existing environment

A pre-existing shared tpk-checkouts volume stays owned by whichever stack wrote it first. Clear it once, or chown it to the DB+App app user:

# either (re-clones on next ingest):
docker compose down && docker volume rm timeplus-knowledge_tpk-checkouts && docker compose up -d
# or (keeps the cache, no re-clone):
docker compose exec app chown -R root:root /opt/tpk/.checkouts

🤖 Generated with Claude Code

gangtao and others added 2 commits August 16, 2026 20:52
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
@gangtao
gangtao merged commit b12810a into main Aug 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant