diff --git a/.changeset/good-scissors-promise.md b/.changeset/good-scissors-promise.md deleted file mode 100644 index 38fe736d3..000000000 --- a/.changeset/good-scissors-promise.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@hyperdx/api': minor -'@hyperdx/app': minor ---- - -feat: introduce usage-stats service diff --git a/.env b/.env index 4d3928a62..2de0030ec 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ IMAGE_NAME=ghcr.io/hyperdxio/hyperdx -IMAGE_VERSION=1.0.3 +IMAGE_VERSION=1.1.0 diff --git a/Makefile b/Makefile index 5a4f23862..a3e155f53 100644 --- a/Makefile +++ b/Makefile @@ -42,11 +42,11 @@ ci-int: .PHONY: build-and-push-ghcr build-and-push-ghcr: - docker buildx build --platform ${BUILD_PLATFORMS} ./docker/hostmetrics -t ${IMAGE_NAME}:${LATEST_VERSION}-hostmetrics --target dev --push & - docker buildx build --platform ${BUILD_PLATFORMS} ./docker/ingestor -t ${IMAGE_NAME}:${LATEST_VERSION}-ingestor --target dev --push & - docker buildx build --platform ${BUILD_PLATFORMS} ./docker/otel-collector -t ${IMAGE_NAME}:${LATEST_VERSION}-otel-collector --target dev --push & - docker buildx build --platform ${BUILD_PLATFORMS} . -f ./packages/miner/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-miner --target dev --push & - docker buildx build --platform ${BUILD_PLATFORMS} . -f ./packages/api/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-api --target dev --push & - docker buildx build --platform ${BUILD_PLATFORMS} . -f ./packages/app/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-app --target prod --push + docker buildx build --platform ${BUILD_PLATFORMS} ./docker/hostmetrics -t ${IMAGE_NAME}:${LATEST_VERSION}-hostmetrics --target prod --push & + docker buildx build --platform ${BUILD_PLATFORMS} ./docker/ingestor -t ${IMAGE_NAME}:${LATEST_VERSION}-ingestor --target prod --push & + docker buildx build --platform ${BUILD_PLATFORMS} ./docker/otel-collector -t ${IMAGE_NAME}:${LATEST_VERSION}-otel-collector --target prod --push & + docker buildx build --build-arg CODE_VERSION=${LATEST_VERSION} --platform ${BUILD_PLATFORMS} . -f ./packages/miner/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-miner --target prod --push & + docker buildx build --build-arg CODE_VERSION=${LATEST_VERSION} --platform ${BUILD_PLATFORMS} . -f ./packages/api/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-api --target prod --push & + docker buildx build --build-arg CODE_VERSION=${LATEST_VERSION} --platform ${BUILD_PLATFORMS} . -f ./packages/app/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-app --target prod --push diff --git a/docker-compose.yml b/docker-compose.yml index 303908213..29d60a640 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,6 @@ services: OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318 OTEL_LOG_LEVEL: ERROR OTEL_SERVICE_NAME: hdx-oss-miner - volumes: - - ./packages/miner/src:/app/src ports: - 5123:5123 networks: @@ -18,8 +16,6 @@ services: hostmetrics: image: ${IMAGE_NAME}:${IMAGE_VERSION}-hostmetrics container_name: hdx-oss-hostmetrics - volumes: - - ./docker/hostmetrics/config.dev.yaml:/etc/otelcol-contrib/config.yaml environment: HYPERDX_API_KEY: ${HYPERDX_API_KEY} OTEL_SERVICE_NAME: hostmetrics @@ -30,7 +26,6 @@ services: image: ${IMAGE_NAME}:${IMAGE_VERSION}-ingestor container_name: hdx-oss-ingestor volumes: - - ./docker/ingestor:/app - .volumes/ingestor_data:/var/lib/vector ports: - 8002:8002 # http-generic @@ -63,8 +58,6 @@ services: otel-collector: image: ${IMAGE_NAME}:${IMAGE_VERSION}-otel-collector container_name: hdx-oss-otel-collector - volumes: - - ./docker/otel-collector/config.yaml:/etc/otelcol-contrib/config.yaml ports: - '13133:13133' # health_check extension - '1888:1888' # pprof extension @@ -93,8 +86,6 @@ services: PORT: 8001 REDIS_URL: redis://redis:6379 SERVER_URL: 'http://localhost:8000' - volumes: - - ./packages/api/src:/app/src networks: - internal depends_on: @@ -104,8 +95,8 @@ services: task-check-alerts: image: ${IMAGE_NAME}:${IMAGE_VERSION}-api container_name: hdx-oss-task-check-alerts - entrypoint: 'yarn' - command: 'dev:task check-alerts' + entrypoint: 'node' + command: './build/tasks/index.js check-alerts' environment: APP_TYPE: 'scheduled-task' CLICKHOUSE_HOST: http://ch-server:8123 @@ -124,8 +115,6 @@ services: OTEL_EXPORTER_OTLP_ENDPOINT: 'http://otel-collector:4318' OTEL_SERVICE_NAME: 'hdx-oss-task-check-alerts' REDIS_URL: redis://redis:6379 - volumes: - - ./packages/api/src:/app/src restart: always networks: - internal @@ -161,8 +150,6 @@ services: REDIS_URL: redis://redis:6379 SERVER_URL: 'http://localhost:8000' USAGE_STATS_ENABLED: ${USAGE_STATS_ENABLED:-true} - volumes: - - ./packages/api/src:/app/src networks: - internal depends_on: @@ -181,14 +168,6 @@ services: NEXT_PUBLIC_HDX_SERVICE_NAME: 'hdx-oss-app' NODE_ENV: development PORT: 8080 - volumes: - - ./packages/app/pages:/app/pages - - ./packages/app/public:/app/public - - ./packages/app/src:/app/src - - ./packages/app/styles:/app/styles - - ./packages/app/mdx.d.ts:/app/mdx.d.ts - - ./packages/app/next-env.d.ts:/app/next-env.d.ts - - ./packages/app/next.config.js:/app/next.config.js networks: - internal depends_on: diff --git a/docker/hostmetrics/Dockerfile b/docker/hostmetrics/Dockerfile index bb8a0e628..c7586b71d 100644 --- a/docker/hostmetrics/Dockerfile +++ b/docker/hostmetrics/Dockerfile @@ -6,3 +6,9 @@ FROM otel/opentelemetry-collector-contrib:0.83.0 AS base FROM base as dev COPY ./config.dev.yaml /etc/otelcol-contrib/config.yaml + + +## prod ############################################################################################# +FROM base as prod + +COPY ./config.dev.yaml /etc/otelcol-contrib/config.yaml diff --git a/docker/ingestor/Dockerfile b/docker/ingestor/Dockerfile index 5165c4dcd..6ac75589e 100644 --- a/docker/ingestor/Dockerfile +++ b/docker/ingestor/Dockerfile @@ -16,3 +16,10 @@ EXPOSE 8002 8686 ENTRYPOINT ["vector", "-c", "http-server.core.toml", "-c", "http-server.sinks.toml", "--require-healthy", "true"] + +## prod ############################################################################################# +FROM base as prod + +EXPOSE 8002 8686 + +ENTRYPOINT ["vector", "-c", "http-server.core.toml", "-c", "http-server.sinks.toml", "--require-healthy", "true"] diff --git a/docker/otel-collector/Dockerfile b/docker/otel-collector/Dockerfile index 1de2bedb7..946981e1f 100644 --- a/docker/otel-collector/Dockerfile +++ b/docker/otel-collector/Dockerfile @@ -2,9 +2,17 @@ FROM otel/opentelemetry-collector-contrib:0.83.0 AS base -## dev ############################################################################################# +## dev ############################################################################################## FROM base as dev COPY ./config.yaml /etc/otelcol-contrib/config.yaml EXPOSE 1888 4317 4318 55679 13133 + + +## prod ############################################################################################# +FROM base as prod + +COPY ./config.yaml /etc/otelcol-contrib/config.yaml + +EXPOSE 1888 4317 4318 55679 13133 diff --git a/package.json b/package.json index 2bef88da1..4b0e23f4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "1.0.3", + "version": "1.1.0", "license": "MIT", "workspaces": [ "packages/*" diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md new file mode 100644 index 000000000..067003be6 --- /dev/null +++ b/packages/api/CHANGELOG.md @@ -0,0 +1,7 @@ +# @hyperdx/api + +## 1.1.0 + +### Minor Changes + +- 914d49a: feat: introduce usage-stats service diff --git a/packages/api/Dockerfile b/packages/api/Dockerfile index d88e4313f..ced284be9 100644 --- a/packages/api/Dockerfile +++ b/packages/api/Dockerfile @@ -16,3 +16,31 @@ EXPOSE 8000 ENTRYPOINT ["yarn"] CMD ["dev"] + + +## builder ######################################################################################### + +FROM base AS builder + +COPY ./packages/api/src ./src +RUN yarn run build + + +## prod ############################################################################################ + +FROM node:18.15.0-alpine AS prod + +ARG CODE_VERSION + +ENV CODE_VERSION=$CODE_VERSION + +EXPOSE 8000 + +USER node + +WORKDIR /app + +COPY --chown=node:node --from=builder /app/build ./build +COPY --chown=node:node --from=base /app/node_modules ./node_modules + +ENTRYPOINT ["node", "-r", "@hyperdx/node-opentelemetry/build/src/tracing", "./build/index.js"] diff --git a/packages/api/package.json b/packages/api/package.json index db26dd412..14f2d6672 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@hyperdx/api", - "version": "1.0.3", + "version": "1.1.0", "license": "MIT", "private": true, "engines": { diff --git a/packages/api/src/config.ts b/packages/api/src/config.ts index 2423e59e4..019dee856 100644 --- a/packages/api/src/config.ts +++ b/packages/api/src/config.ts @@ -1,5 +1,3 @@ -import { version } from '../package.json'; - const env = process.env; export const NODE_ENV = env.NODE_ENV as string; @@ -8,7 +6,7 @@ export const APP_TYPE = env.APP_TYPE as 'api' | 'aggregator' | 'scheduled-task'; export const CLICKHOUSE_HOST = env.CLICKHOUSE_HOST as string; export const CLICKHOUSE_PASSWORD = env.CLICKHOUSE_PASSWORD as string; export const CLICKHOUSE_USER = env.CLICKHOUSE_USER as string; -export const CODE_VERSION = version; +export const CODE_VERSION = env.CODE_VERSION as string; export const COOKIE_DOMAIN = env.COOKIE_DOMAIN as string; // prod ONLY export const EXPRESS_SESSION_SECRET = env.EXPRESS_SESSION_SECRET as string; export const FRONTEND_URL = env.FRONTEND_URL as string; diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 1c2d6f637..a2e970517 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -15,7 +15,6 @@ "noUnusedLocals": false, "noUnusedParameters": false, "outDir": "build", - "resolveJsonModule": true, "skipLibCheck": false, "sourceMap": true, "strict": true, diff --git a/packages/app/CHANGELOG.md b/packages/app/CHANGELOG.md new file mode 100644 index 000000000..7f1e9a59b --- /dev/null +++ b/packages/app/CHANGELOG.md @@ -0,0 +1,7 @@ +# @hyperdx/app + +## 1.1.0 + +### Minor Changes + +- 914d49a: feat: introduce usage-stats service diff --git a/packages/app/package.json b/packages/app/package.json index 9e6ca6fe5..4831466a9 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@hyperdx/app", - "version": "1.0.3", + "version": "1.1.0", "private": true, "license": "MIT", "engines": {