# docker/compose.yml — hexus dev/test/mcp stack # # Profiles: # test → CI + local one-shot test runs (pg + test container) # dev → just the DB; host runs pytest # mcp → pg + long-lived MCP server (stdio inside the container; # operators expose it to editors/agents via their own bridge) # # Forked from andreab67/hermes-memory-pgvector (BSD-3-Clause) name: hexus services: pg: image: pgvector/pgvector:pg16 container_name: hexus-pg environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: ${HEXUS_DB_PASS:-postgres} POSTGRES_DB: hermes_test volumes: - pg_data:/var/lib/postgresql/data # Migration is applied by the test entrypoint from /app/pgvector/migrations/ # (COPY'd in the Dockerfile). Skip the /docker-entrypoint-initdb.d/ mount — # pgvector's base image has a pre-existing 001_schema.sql/ directory there # that conflicts with our file bind-mount in some Docker setups. healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d hermes_test"] interval: 2s timeout: 5s retries: 30 # Exposed (not published) so the test/mcp containers can reach it # via the internal docker network as `pg:5432`. For the dev # profile, run with `--service-ports` to publish 5432 to the host # so host-side pytest can connect at `localhost:5432`. expose: - "5432" test: build: context: .. dockerfile: docker/Dockerfile target: runtime image: hexus:test container_name: hexus-test profiles: ["test"] depends_on: pg: condition: service_healthy environment: CMD_PROFILE: test PYTHONPATH: /app # the COPY'd source dirs (pgvector, mcp_server) live here PG_TEST_HOST: pg PG_TEST_PORT: "5432" PG_TEST_DSN: "dbname=hermes_test user=postgres password=${HEXUS_DB_PASS:-postgres} host=pg" HEXUS_DB_PASS: ${HEXUS_DB_PASS:-postgres} # PG_TEST_EMBED_URL is intentionally unset → live embed test skips (Phase 0) # Long-lived MCP server. `hexus-mcp serve --transport http` # binds 0.0.0.0:8000 inside the container; the host port mapping is # commented out by default because most operators want the server on # an internal network only (Claude Desktop / Cursor / fleet agents # talk to it via traefik or a local-only reverse proxy). Uncomment # `ports:` to publish directly to the host. mcp: build: context: .. dockerfile: docker/Dockerfile target: runtime image: hexus:test container_name: hexus-mcp profiles: ["mcp"] depends_on: pg: condition: service_healthy environment: CMD_PROFILE: mcp PYTHONPATH: /app # the COPY'd source dirs (pgvector, mcp_server) live here # The mcp entrypoint waits on PG_TEST_HOST before starting; point it at # the `pg` service (matches the test service) so it isn't left waiting on # the homelab-db default. PG_TEST_HOST: pg HEXUS_TRANSPORT: http HEXUS_DSN: "dbname=hermes_test user=postgres password=${HEXUS_DB_PASS:-postgres} host=pg" HEXUS_DB_PASS: ${HEXUS_DB_PASS:-postgres} # Default agent_identity for tool calls that don't supply one. # Override per-launch by setting HEXUS_AGENT_IDENTITY # in this env or in the operator's compose override. HEXUS_AGENT_IDENTITY: "default" # Eager-load the BERT model at startup (saves ~1-2s on first # tool call). Set to "0" for lazy (default). HEXUS_EMBED_EAGER_LOAD: "0" HF_HUB_OFFLINE: "1" expose: - "8000" # streamable-http MCP endpoint, host-port via proxy healthcheck: test: ["CMD-SHELL", "hexus-mcp doctor --dsn \"dbname=hermes_test user=postgres password=$${HEXUS_DB_PASS:-postgres} host=pg\""] interval: 30s timeout: 10s retries: 3 start_period: 30s volumes: pg_data: name: hexus-pg-data