mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: otelcol process in aio build (#1085)
This commit is contained in:
parent
6d30caf023
commit
56fd856d7a
6 changed files with 45 additions and 8 deletions
7
.changeset/famous-apples-shake.md
Normal file
7
.changeset/famous-apples-shake.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
"@hyperdx/api": patch
|
||||
"@hyperdx/app": patch
|
||||
"@hyperdx/common-utils": patch
|
||||
---
|
||||
|
||||
fix: otelcol process in aio build
|
||||
|
|
@ -76,9 +76,12 @@ COPY --chown=node:node --from=hyperdx ./entry.prod.sh /etc/local/entry.sh
|
|||
ENTRYPOINT ["sh", "/etc/local/entry.sh"]
|
||||
|
||||
# all-in-one base ############################################################################################
|
||||
FROM hairyhenderson/gomplate:v4.3.3-alpine AS gomplate
|
||||
FROM clickhouse/clickhouse-server:${CLICKHOUSE_VERSION}-alpine AS all-in-one-base
|
||||
|
||||
ARG CODE_VERSION
|
||||
ARG USER_UID=10001
|
||||
ARG USER_GID=10001
|
||||
|
||||
ENV CODE_VERSION=$CODE_VERSION
|
||||
# Copy from otel collector bases
|
||||
|
|
@ -100,15 +103,24 @@ 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
|
||||
COPY --from=otel-collector ./supervisor_docker.yaml.tmpl /etc/otel/supervisor.yaml.tmpl
|
||||
|
||||
# Copy otel-collector entrypoint and log rotation scripts
|
||||
COPY --from=otel-collector --chmod=755 ./entrypoint.sh /otel-entrypoint.sh
|
||||
COPY --from=otel-collector --chmod=755 ./log-rotator.sh /log-rotator.sh
|
||||
|
||||
# Copy gomplate binary from the gomplate image
|
||||
COPY --from=gomplate /bin/gomplate /usr/local/bin/gomplate
|
||||
|
||||
# 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 ca-certificates && \
|
||||
addgroup -S -g ${USER_GID} otel && \
|
||||
adduser -S -u ${USER_UID} -G otel otel && \
|
||||
mkdir -p /data/db && \
|
||||
mkdir -p /etc/otel/supervisor-data && \
|
||||
install -d -m 0777 -o ${USER_UID} -g ${USER_GID} /etc/otel/supervisor-data && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ENV NODE_ENV production
|
||||
|
|
|
|||
|
|
@ -37,6 +37,16 @@
|
|||
<timezone>UTC</timezone>
|
||||
<mlock_executable>false</mlock_executable>
|
||||
|
||||
<!-- Prometheus exporter -->
|
||||
<!-- <prometheus> -->
|
||||
<!-- <endpoint>/metrics</endpoint> -->
|
||||
<!-- <port>9363</port> -->
|
||||
<!-- <metrics>true</metrics> -->
|
||||
<!-- <events>true</events> -->
|
||||
<!-- <asynchronous_metrics>true</asynchronous_metrics> -->
|
||||
<!-- <errors>true</errors> -->
|
||||
<!-- </prometheus> -->
|
||||
|
||||
<!-- Query log. Used only for queries with setting log_queries = 1. -->
|
||||
<query_log>
|
||||
<database>system</database>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE="${HYPERDX_OTEL_EXPORTER_CLICKH
|
|||
export CLICKHOUSE_ENDPOINT="${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 CLICKHOUSE_PROMETHEUS_METRICS_ENDPOINT="${CLICKHOUSE_PROMETHEUS_METRICS_ENDPOINT:-ch-server:9363}"
|
||||
|
||||
export EXPRESS_SESSION_SECRET="hyperdx is cool 👋"
|
||||
# IS_LOCAL_APP_MODE should be set by the calling script
|
||||
|
|
@ -58,8 +59,8 @@ while ! curl -s "http://ch-server:8123" > /dev/null; do
|
|||
done
|
||||
echo "ClickHouse is ready!"
|
||||
|
||||
# Start Otel Collector
|
||||
opampsupervisor --config /etc/otel/supervisor.yaml > /var/log/otel-collector.log 2>&1 &
|
||||
# Start Otel Collector with entrypoint script for template rendering and log rotation
|
||||
/otel-entrypoint.sh /usr/local/bin/opampsupervisor > /var/log/otel-collector.log 2>&1 &
|
||||
|
||||
# Start HyperDX app
|
||||
npx concurrently \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
## base #############################################################################################
|
||||
FROM otel/opentelemetry-collector-contrib:0.129.1 AS col
|
||||
FROM otel/opentelemetry-collector-opampsupervisor:0.128.0 AS supervisor
|
||||
FROM hairyhenderson/gomplate:v4.3.3-alpine AS gomplate
|
||||
|
||||
# From: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/aa5c3aa4c7ec174361fcaf908de8eaca72263078/cmd/opampsupervisor/Dockerfile#L18
|
||||
FROM alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c AS base
|
||||
|
|
@ -8,14 +9,15 @@ FROM alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff45
|
|||
ARG USER_UID=10001
|
||||
ARG USER_GID=10001
|
||||
|
||||
# Install certs, gomplate for templating, create user/group, and make the writable data dir
|
||||
# Install certs, create user/group, and make the writable data dir
|
||||
RUN apk add --no-cache ca-certificates && \
|
||||
wget -O /usr/local/bin/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v4.3.3/gomplate_linux-amd64 && \
|
||||
chmod +x /usr/local/bin/gomplate && \
|
||||
addgroup -S -g ${USER_GID} otel && \
|
||||
adduser -S -u ${USER_UID} -G otel otel && \
|
||||
install -d -m 0777 -o ${USER_UID} -g ${USER_GID} /etc/otel/supervisor-data
|
||||
|
||||
# Copy gomplate binary from the gomplate image
|
||||
COPY --from=gomplate /bin/gomplate /usr/local/bin/gomplate
|
||||
|
||||
USER ${USER_UID}:${USER_GID}
|
||||
|
||||
COPY --from=supervisor --chmod=755 /usr/local/bin/opampsupervisor /opampsupervisor
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import mongoose from 'mongoose';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import * as config from '@/config';
|
||||
|
|
@ -8,7 +9,7 @@ import Team, { TeamCHSettings } from '@/models/team';
|
|||
|
||||
const LOCAL_APP_TEAM_ID = '_local_team_';
|
||||
export const LOCAL_APP_TEAM = {
|
||||
_id: LOCAL_APP_TEAM_ID,
|
||||
_id: new mongoose.Types.ObjectId(LOCAL_APP_TEAM_ID),
|
||||
id: LOCAL_APP_TEAM_ID,
|
||||
name: 'Local App Team',
|
||||
// Placeholder keys
|
||||
|
|
@ -48,6 +49,10 @@ export async function createTeam({
|
|||
}
|
||||
|
||||
export function getAllTeams(fields?: string[]) {
|
||||
if (config.IS_LOCAL_APP_MODE) {
|
||||
return [LOCAL_APP_TEAM];
|
||||
}
|
||||
|
||||
return Team.find({}, fields);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue