Skip to content

Use one shared OpenSearch and Elasticsearch container for all projects - #129

Open
peterjaap wants to merge 1 commit into
mainfrom
worktree-shared-search-containers
Open

Use one shared OpenSearch and Elasticsearch container for all projects#129
peterjaap wants to merge 1 commit into
mainfrom
worktree-shared-search-containers

Conversation

@peterjaap

Copy link
Copy Markdown
Collaborator

What

MageBox now runs one shared OpenSearch container and one shared Elasticsearch container for the whole machine, instead of one container per requested version.

Previously the global compose file was generated per search version — each version got its own container, container name, volumes, and a version-derived host port (OpenSearch 9259 for 2.19, Elasticsearch 9657 for 7.17, etc.). Different projects on different versions each spun up a separate search container.

Behavior now

  • Fixed host ports: OpenSearch 9200, Elasticsearch 9500 (distinct so both engines can run simultaneously).
  • Unversioned names: service opensearch/elasticsearch, container magebox-opensearch/magebox-elasticsearch, volumes opensearch_data/opensearch_plugins (and ES equivalents).
  • Version selection when projects disagree: the version from global config (magebox config) wins; otherwise the highest requested version is used. The container is provisioned with the largest memory any project requests.
  • GetOpenSearchPort/GetElasticsearchPort now return the fixed ports and drop the version argument; the old version→port helpers are removed.
  • magebox status, service-name matching, magebox new, and magebox check updated to the fixed names/ports.

Migration note

Existing environments have per-version search containers/volumes (magebox-opensearch-2.19, opensearch219_data). After this change MageBox generates the new unversioned magebox-opensearch container with a fresh opensearch_data volume; the old containers/volumes become orphaned and the search index needs a reindex. Search data is rebuildable, so no real data loss.

Tests

  • TestSelectSearchService — version selection (single / highest / global-default-wins / largest-memory).
  • TestGenerateGlobalServices_SharedSearchContainer — two projects on different OpenSearch versions + one Elasticsearch collapse to exactly one container per engine on the fixed ports.
  • Updated existing service/port tests to the fixed-port, single-container model.
  • make lint clean, full go test ./... green.

Docs updated: reference/ports.md, reference/config-options.md, guide/search.md, services/opensearch.md.

https://claude.ai/code/session_01TysGzdAeGf96J3WvTKFrht

…jects

Previously the global docker-compose was generated with one search container
per requested version, giving each version its own container, container name,
volumes, and version-derived host port (e.g. 9259 for OpenSearch 2.19).

Now MageBox runs at most one OpenSearch and one Elasticsearch container for the
whole machine, shared across every project:

- Fixed host ports: OpenSearch 9200, Elasticsearch 9500 (distinct so both
  engines can run at once).
- Unversioned service names (opensearch/elasticsearch), container names
  (magebox-opensearch/magebox-elasticsearch), and volumes (opensearch_data,
  opensearch_plugins, ...).
- When projects request different versions, the global default version wins,
  otherwise the highest requested version is used. The container is provisioned
  with the largest memory any project requests.

GetOpenSearchPort/GetElasticsearchPort now return the fixed ports and drop the
version argument; the version->port helpers are removed. Status, service-name
matching, `magebox new`, and `magebox check` are updated to the fixed names/ports.
Docs (ports, config-options, search guide, opensearch service) updated to match.

Claude-Session: https://claude.ai/code/session_01TysGzdAeGf96J3WvTKFrht
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

📦 PR build artifacts

Built from 91ebeb3view run. Artifacts expire in 14 days.

Note: artifact download links require being signed in to GitHub with access to this repository.

@peterjaap
peterjaap marked this pull request as ready for review July 6, 2026 12:57
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