fix: support otelcol opamp in aio build (#859)

Ref: HDX-1734
This commit is contained in:
Warren 2025-05-27 11:56:11 -07:00 committed by GitHub
parent 8d534da32e
commit d63deeddbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 6 deletions

View file

@ -0,0 +1,5 @@
---
"@hyperdx/api": patch
---
fix: support otelcol opamp for aio build

View file

@ -9,13 +9,15 @@
ARG NODE_VERSION=22.16.0
ARG CLICKHOUSE_VERSION=24
ARG OTEL_COLLECTOR_VERSION=0.120.0
ARG OTEL_COLLECTOR_VERSION=0.126.0
ARG OTEL_COLLECTOR_OPAMPSUPERVISOR_VERSION=0.126.0
# base #############################################################################################
# == Clickhouse/Base Image ==
FROM clickhouse/clickhouse-server:${CLICKHOUSE_VERSION}-alpine AS clickhouse_base
# == Otel Collector Image ==
FROM otel/opentelemetry-collector-contrib:${OTEL_COLLECTOR_VERSION} AS otel_collector_base
FROM otel/opentelemetry-collector-opampsupervisor:${OTEL_COLLECTOR_OPAMPSUPERVISOR_VERSION} AS otel_collector_opampsupervisor_base
FROM node:${NODE_VERSION}-alpine AS node_base
@ -86,7 +88,8 @@ FROM scratch AS all-in-one-base
# Copy from clickhouse and otel collector bases
COPY --from=clickhouse_base / /
COPY --from=otel_collector_base /otelcol-contrib /usr/local/bin/otelcol-contrib
COPY --from=otel_collector_base --chmod=755 /otelcol-contrib /otelcontribcol
COPY --from=otel_collector_opampsupervisor_base --chmod=755 /usr/local/bin/opampsupervisor /usr/local/bin/opampsupervisor
# Copy Node.js runtime from node base
COPY --from=node_base --link /usr/local/bin /usr/local/bin
@ -100,13 +103,15 @@ COPY --from=hyperdx ./clickhouseConfig.xml /etc/clickhouse-server/config.xml
# Set up Otel Collector
COPY --from=otel-collector ./config.yaml /etc/otelcol-contrib/config.yaml
COPY --from=otel-collector ./supervisor_docker.yaml /etc/otel/supervisor.yaml
# Install MongoDB and other dependencies (consolidated into a single RUN command)
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/main' >> /etc/apk/repositories && \
echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories && \
apk update && \
apk add --no-cache mongodb yaml-cpp=0.6.2-r2 curl && \
apk add --no-cache mongodb yaml-cpp=0.6.2-r2 curl ca-certificates && \
mkdir -p /data/db && \
mkdir -p /etc/otel/supervisor-data && \
rm -rf /var/cache/apk/*
ENV NODE_ENV production

View file

@ -9,10 +9,12 @@ export CLICKHOUSE_LOG_LEVEL="error"
# Same applies to the frontend/app
export SERVER_URL="http://127.0.0.1:${HYPERDX_API_PORT:-8000}"
export FRONTEND_URL="${FRONTEND_URL:-${HYPERDX_APP_URL:-http://localhost}:${HYPERDX_APP_PORT:-8080}}"
export OPAMP_PORT=${HYPERDX_OPAMP_PORT:-4320}
# Internal Services
export CLICKHOUSE_ENDPOINT="tcp://ch-server:9000?dial_timeout=10s"
export MONGO_URI="mongodb://db:27017/hyperdx"
export OPAMP_SERVER_URL="http://127.0.0.1:${OPAMP_PORT}"
export EXPRESS_SESSION_SECRET="hyperdx is cool 👋"
# IS_LOCAL_APP_MODE should be set by the calling script
@ -20,7 +22,6 @@ export EXPRESS_SESSION_SECRET="hyperdx is cool 👋"
export IS_LOCAL_APP_MODE="${IS_LOCAL_APP_MODE}"
export NEXT_TELEMETRY_DISABLED="1"
# Simulate Docker Service DNS
echo "127.0.0.1 ch-server" >> /etc/hosts
echo "127.0.0.1 db" >> /etc/hosts
@ -48,7 +49,7 @@ while ! curl -s "http://ch-server:8123" > /dev/null; do
done
# Start Otel Collector
otelcol-contrib --config /etc/otelcol-contrib/config.yaml &
opampsupervisor --config /etc/otel/supervisor.yaml > /var/log/otel-collector.log 2>&1 &
# Start HyperDX app
npx concurrently \

View file

@ -92,7 +92,7 @@
"start": "node ./build/index.js",
"dev": "DOTENV_CONFIG_PATH=.env.development nodemon --signal SIGTERM -e ts,json --exec 'ts-node' --transpile-only -r tsconfig-paths/register -r dotenv-expand/config -r '@hyperdx/node-opentelemetry/build/src/tracing' ./src/index.ts",
"dev-task": "DOTENV_CONFIG_PATH=.env.development nodemon --signal SIGTERM -e ts,json --exec 'ts-node' --transpile-only -r tsconfig-paths/register -r dotenv-expand/config -r '@hyperdx/node-opentelemetry/build/src/tracing' ./src/tasks/index.ts",
"build": "rimraf ./build && tsc && tsc-alias",
"build": "rimraf ./build && tsc && tsc-alias && cp -r src/opamp/proto build/opamp/",
"lint": "eslint --quiet . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"ci:lint": "yarn lint && yarn tsc --noEmit",