hyperdx/docker-compose.dev.yml
Dan Hable 3e40a46ffb
fix(dev): otel collector should wait for clickhouse (#597)
The OTEL collector can start execution before the Clickhouse DB is ready. This can cause the OTEL collector to crash, which aborts the container and caused the compose command to fail. This commit adds a health check to the Clickhouse container and then orders the OTEL collector container to wait until the database is healthy.
2025-02-04 16:38:49 +00:00

126 lines
3.7 KiB
YAML

name: hdx-oss-dev
x-hyperdx-logging: &hyperdx-logging
driver: fluentd
options:
fluentd-address: tcp://localhost:24225
labels: 'service.name'
services:
# miner:
# build:
# context: .
# dockerfile: ./packages/miner/Dockerfile
# target: dev
# environment:
# HYPERDX_API_KEY: ${HYPERDX_API_KEY}
# HYPERDX_ENABLE_ADVANCED_NETWORK_CAPTURE: 1
# HYPERDX_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
# OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
# OTEL_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
# OTEL_SERVICE_NAME: hdx-oss-dev-miner
# volumes:
# - ./packages/miner/src:/app/src
# ports:
# - 5123:5123
# networks:
# - internal
redis:
logging: *hyperdx-logging
labels:
service.name: 'hdx-oss-dev-redis'
image: redis:7.0.11-alpine
volumes:
- .volumes/redis:/data
ports:
- 6379:6379
networks:
- internal
depends_on:
- otel-collector
db:
logging: *hyperdx-logging
labels:
service.name: 'hdx-oss-dev-db'
image: mongo:5.0.14-focal
volumes:
- .volumes/db:/data/db
ports:
- 27017:27017
networks:
- internal
depends_on:
- otel-collector
otel-collector:
image: otel/opentelemetry-collector-contrib:0.117.0
environment:
CLICKHOUSE_SERVER_ENDPOINT: 'ch-server:9000'
HYPERDX_API_KEY: ${HYPERDX_API_KEY}
HYPERDX_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
volumes:
- ./docker/otel-collector/config.yaml:/etc/otelcol-contrib/config.yaml
ports:
- '13133:13133' # health_check extension
- '24225:24225' # fluentd receiver
- '4317:4317' # OTLP gRPC receiver
- '4318:4318' # OTLP http receiver
- '8888:8888' # metrics extension
restart: always
networks:
- internal
depends_on:
ch-server:
condition: service_healthy
# task-check-alerts:
# build:
# context: .
# dockerfile: ./packages/api/Dockerfile
# target: dev
# entrypoint: 'yarn'
# command: 'dev:task check-alerts'
# environment:
# APP_TYPE: 'scheduled-task'
# EXPRESS_SESSION_SECRET: 'hyperdx is cool 👋'
# FRONTEND_URL: 'http://localhost:8080' # need to be localhost (CORS)
# HDX_NODE_ADVANCED_NETWORK_CAPTURE: 1
# HDX_NODE_BETA_MODE: 0
# HDX_NODE_CONSOLE_CAPTURE: 1
# HYPERDX_API_KEY: ${HYPERDX_API_KEY}
# HYPERDX_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
# MINER_API_URL: 'http://miner:5123'
# MONGO_URI: 'mongodb://db:27017/hyperdx'
# NODE_ENV: development
# OTEL_EXPORTER_OTLP_ENDPOINT: 'http://otel-collector:4318'
# OTEL_SERVICE_NAME: 'hdx-oss-dev-task-check-alerts'
# REDIS_URL: redis://redis:6379
# volumes:
# - ./packages/api/src:/app/src
# restart: always
# networks:
# - internal
# depends_on:
# - ch-server
# - db
# - redis
ch-server:
image: clickhouse/clickhouse-server:head-alpine
ports:
- 8123:8123 # http api
- 9000:9000 # native
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
- .volumes/ch_data:/var/lib/clickhouse
- .volumes/ch_logs:/var/log/clickhouse-server
restart: on-failure
networks:
- internal
healthcheck:
# "clickhouse", "client", "-u ${CLICKHOUSE_USER}", "--password ${CLICKHOUSE_PASSWORD}", "-q 'SELECT 1'"
test: wget --no-verbose --tries=1 http://127.0.0.1:8123/ping || exit 1
interval: 3s
timeout: 3s
retries: 3
networks:
internal: