Project-scoped search sidecars (one per project, not per instance)#63
Merged
elliottregan merged 7 commits intomainfrom Apr 22, 2026
Merged
Project-scoped search sidecars (one per project, not per instance)#63elliottregan merged 7 commits intomainfrom
elliottregan merged 7 commits intomainfrom
Conversation
New compose template that declares the five search sidecars (qdrant, llama-server, llama-clustering, reduce-api, hdbscan-api) at project scope instead of per-instance. Each service joins the project network with a plain-name alias so instances resolve them at the same URLs (http://qdrant:6333, http://llama-server:8080, etc.). Per-project named volumes (cspace-<project>-qdrant, cspace-<project>- llama-models) maintain the single-writer invariant from commit 19293ee while sharing one index across all instances. Part of #62. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the five search sidecar service definitions (qdrant, llama-server, llama-clustering, reduce-api, hdbscan-api) from docker-compose.core.yml — they now live in docker-compose.project.yml at project scope. Also remove the qdrant-storage and llama-models volume declarations from core.yml (now per-project named volumes in the project stack). Update docker-compose.search.yml: drop depends_on (qdrant and llama-server are no longer in the same compose project) and add the project network so the per-instance search-mcp sidecar can reach the project-scoped sidecars via their network aliases. Part of #62. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New internal/compose/project.go with: - ProjectStackEnv: env vars for docker-compose.project.yml - ProjectStackUp/Down: start/stop the project sidecar stack - ProjectStackRunning: check if any project stack container is up - ProjectStackDownDirect: teardown by compose name (for --everywhere) New config.ProjectStackName() returns "cspace-<project>-stack". Add CSPACE_PROJECT_STACK_NAME to both ProjectStackEnv and the instance ComposeEnv so the variable is available to all compose templates. Part of #62. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Insert "Starting search stack" as phase 6 (between "Creating network" and "Starting reverse proxy"). All subsequent phases shift by 1, taking the total from 16 to 17. The new phase calls compose.ProjectStackUp(cfg), which is idempotent — if the project stack is already running from a prior instance's boot, this is a harmless no-op. Failure is a warning, not fatal, since the search stack is optional infrastructure. Part of #62. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New --project flag tears down all instances for the current project AND the project-scoped search sidecar stack (plus its volumes and the project network). This is the full project cleanup command. Updated --everywhere to also discover and tear down project stacks (compose projects matching cspace-*-stack) and clean up project networks for each unique project found. Part of #62. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update TestPhasesReference: 16 -> 17 phases, verify new "Starting search stack" at index 5 - Add TestProjectStackEnv: verify all env vars for the project stack - Add TestProjectStackEnvMatchesInstanceEnv: verify shared keys (CSPACE_PROJECT_NETWORK, CSPACE_HOME, CSPACE_PROJECT_STACK_NAME) are consistent between project and instance envs - Add ProjectStackName and ProjectNetwork to TestHelpers - Add CSPACE_PROJECT_STACK_NAME to TestComposeEnv Part of #62. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update the phase count assertion from 16 to 17 and the index from Phases[15] to Phases[16] to match the new phase structure. Part of #62. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for cspace-cli canceled.
|
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.
Summary
Closes #62
docker-compose.project.yml— a new compose template declaring the five sidecars at project scope, with per-project named volumes (cspace-<project>-qdrant,cspace-<project>-llama-models) and Docker network aliases on the project network.cspace down --projectflag to tear down all instances AND the shared search stack for the current project.Architecture
Each instance resolves sidecars via network aliases (
qdrant,llama-server, etc.) — the sidecar URLs insearch/config/default.yamlare unchanged.Changes
lib/templates/docker-compose.project.ymllib/templates/docker-compose.core.ymllib/templates/docker-compose.search.ymldepends_on(sidecars in separate compose project), addedprojectnetworkinternal/compose/project.goProjectStackUp/Down/Running/DownDirect,ProjectStackEnvinternal/compose/compose.goCSPACE_PROJECT_STACK_NAMEtoComposeEnvinternal/config/config.goProjectStackName()helper (cspace-<project>-stack)internal/provision/provision.gointernal/provision/reporter.goPhasessliceinternal/cli/down.go--projectflag; global teardown now discovers and removes project stacksProjectStackEnv/ProjectStackNametestsLifecycle
cspace up <instance>— brings the project stack up first (idempotent), then the instancecspace down <instance>— removes only the instance; project stack stays runningcspace down --project— removes all instances + project stack + volumes + networkMigration
Users on v0.9.5 or earlier with per-instance sidecars:
cspace rebuild --reindexforces fresh provisioning, joining the new architecturedocker volume pruneGuardrails preserved
enabled: trueinsearch.yaml) untouchedTest plan
go test ./internal/provision/— phase count updated to 17, all assertions passgo test ./internal/compose/—ProjectStackEnv,ComposeEnvwithCSPACE_PROJECT_STACK_NAMEgo test ./internal/config/—ProjectStackNamehelpergo vet ./...— cleangofmt -l— cleandocker compose configrenders project template correctly with network aliases and named volumes