mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
## Summary
- Enable multiple agents/developers to run `make dev-int` simultaneously from different git worktrees without Docker port conflicts
- Compute a deterministic port offset (0-99) from the worktree directory name via `cksum`, giving each worktree its own isolated Docker Compose project and port range
- Switch `.env.test` files to use `${HDX_CI_*:-default}` variable expansion (powered by `dotenv-expand`) so test processes connect to the correct dynamic ports
## How it works
Each worktree gets a unique **slot** derived from its directory name. All service ports are offset by that slot:
| Service | Base port | Example (slot 68) |
|-----------------|-----------|-------------------|
| ClickHouse HTTP | 18123 | 18191 |
| MongoDB | 39999 | 40067 |
| API test server | 19000 | 19068 |
| OpAMP | 14320 | 14388 |
Docker Compose project names are also unique (`int-<slot>`), isolating containers and networks.
Backward compatible — when no `HDX_CI_*` env vars are set, all ports fall back to their original defaults.
## Changes
- **Makefile**: Added `HDX_CI_SLOT` computation and dynamic project names/ports for all `dev-int` targets
- **docker-compose.ci.yml**: Ports use `${HDX_CI_*:-default}` env vars; removed unused OTel collector published port; removed hardcoded network name (auto-generated from project name)
- **packages/api/.env.test** / **packages/common-utils/.env.test**: Ports use `${HDX_CI_*:-default}` expansion syntax
- **packages/api/jest.config.js** / **packages/common-utils/jest.int.config.js**: Switched from `dotenv/config` to `dotenv-expand/config` to enable variable expansion
- **packages/api/package.json** / **packages/common-utils/package.json**: Added `dotenv-expand` devDependency
- **agent_docs/development.md**: Documented multi-agent worktree support
## Testing
Ran full Alert integration test suite (`make dev-int FILE=alerts`) — **6 test suites, 150 tests passed** on slot 68 with dynamic ports.
42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
name: hdx-ci
|
|
services:
|
|
otel-collector:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/otel-collector/Dockerfile
|
|
target: dev
|
|
environment:
|
|
CLICKHOUSE_ENDPOINT: 'tcp://ch-server:9000?dial_timeout=10s'
|
|
HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE: ${HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE}
|
|
HYPERDX_OTEL_EXPORTER_TABLES_TTL: '87600h'
|
|
HYPERDX_API_KEY: ${HYPERDX_API_KEY}
|
|
HYPERDX_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
|
|
volumes:
|
|
- ./docker/otel-collector/config.yaml:/etc/otelcol-contrib/config.yaml
|
|
restart: on-failure
|
|
networks:
|
|
- internal
|
|
depends_on:
|
|
- ch-server
|
|
ch-server:
|
|
image: clickhouse/clickhouse-server:26.1-alpine
|
|
environment:
|
|
# default settings
|
|
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
|
|
volumes:
|
|
- ./docker/clickhouse/local/config.xml:/etc/clickhouse-server/config.xml
|
|
- ./docker/clickhouse/local/users.xml:/etc/clickhouse-server/users.xml
|
|
restart: on-failure
|
|
ports:
|
|
- '${HDX_CI_CH_PORT:-18123}:8123' # http api
|
|
networks:
|
|
- internal
|
|
db:
|
|
image: mongo:5.0.32-focal
|
|
command: --port 29999
|
|
ports:
|
|
- '${HDX_CI_MONGO_PORT:-39999}:29999'
|
|
networks:
|
|
- internal
|
|
networks:
|
|
internal:
|