Skip to content

Reverse Proxy to easily allow for different domains #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ dev-int:
ci-int:
docker compose -p int -f ./docker-compose.ci.yml run --rm api ci:int

.PHONY: build
build:
docker buildx build ./docker/hostmetrics -t ${IMAGE_NAME}:${LATEST_VERSION}-hostmetrics --target prod &
docker buildx build ./docker/ingestor -t ${IMAGE_NAME}:${LATEST_VERSION}-ingestor --target prod &
docker buildx build ./docker/otel-collector -t ${IMAGE_NAME}:${LATEST_VERSION}-otel-collector --target prod &
docker buildx build --build-arg CODE_VERSION=${LATEST_VERSION} . -f ./packages/miner/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-miner --target prod &
docker buildx build --build-arg CODE_VERSION=${LATEST_VERSION} . -f ./packages/api/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-api --target prod &
docker buildx build --build-arg NEXT_PUBLIC_API_SERVER_URL='/api' --build-arg CODE_VERSION=${LATEST_VERSION} . -f ./packages/app/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-app --target prod
Comment on lines +44 to +49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff here. I think we want to disable multi-platform build (for local build purpose). Will include this in the separate PR


.PHONY: build-and-push-ghcr
build-and-push-ghcr:
Expand Down
39 changes: 34 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
version: '3'
services:
traefik:
image: 'traefik:v2.10'
command:
- '--log.level=DEBUG'
- '--providers.docker=true'
- '--providers.docker.exposedbydefault=false'
- '--entrypoints.web.address=:80'
ports:
- '80:80'
networks:
- internal
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'

miner:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-miner
container_name: hdx-oss-miner
Expand Down Expand Up @@ -80,7 +94,7 @@ services:
CLICKHOUSE_HOST: http://ch-server:8123
CLICKHOUSE_PASSWORD: aggregator
CLICKHOUSE_USER: aggregator
FRONTEND_URL: 'http://localhost:8080' # need to be localhost (CORS)
FRONTEND_URL: 'http://${HOST:-hyperdx.localhost}'
MONGO_URI: 'mongodb://db:27017/hyperdx'
NODE_ENV: development
PORT: 8001
Expand All @@ -103,7 +117,7 @@ services:
CLICKHOUSE_LOG_LEVEL: trace
CLICKHOUSE_PASSWORD: worker
CLICKHOUSE_USER: worker
FRONTEND_URL: 'http://localhost:8080' # need to be localhost (CORS)
FRONTEND_URL: 'http://${HOST:-hyperdx.localhost}'
HDX_NODE_ADVANCED_NETWORK_CAPTURE: 1
HDX_NODE_BETA_MODE: 0
HDX_NODE_CONSOLE_CAPTURE: 1
Expand Down Expand Up @@ -135,7 +149,7 @@ services:
CLICKHOUSE_PASSWORD: api
CLICKHOUSE_USER: api
EXPRESS_SESSION_SECRET: 'hyperdx is cool 👋'
FRONTEND_URL: 'http://localhost:8080' # need to be localhost (CORS)
FRONTEND_URL: 'http://${HOST:-hyperdx.localhost}'
HDX_NODE_ADVANCED_NETWORK_CAPTURE: 1
HDX_NODE_BETA_MODE: 1
HDX_NODE_CONSOLE_CAPTURE: 1
Expand All @@ -148,21 +162,30 @@ services:
OTEL_SERVICE_NAME: 'hdx-oss-api'
PORT: 8000
REDIS_URL: redis://redis:6379
SERVER_URL: 'http://localhost:8000'
SERVER_URL: 'http://${HOST:-hyperdx.localhost}/api'
USAGE_STATS_ENABLED: ${USAGE_STATS_ENABLED:-true}
networks:
- internal
depends_on:
- ch-server
- db
- redis
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.api.rule=Host(`${HOST:-hyperdx.localhost}`) &&
PathPrefix(`/api/`)'
- 'traefik.http.routers.api.entrypoints=web'
- 'traefik.http.routers.api.middlewares=api-stripprefix'
- 'traefik.http.middlewares.api-stripprefix.stripprefix.prefixes=/api'
- 'traefik.http.services.api.loadbalancer.server.port=8000'

app:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-app
container_name: hdx-oss-app
ports:
- 8080:8080
environment:
NEXT_PUBLIC_API_SERVER_URL: 'http://localhost:8000' # need to be localhost (CORS)
NEXT_PUBLIC_API_SERVER_URL: '/api'
NEXT_PUBLIC_HDX_API_KEY: ${HYPERDX_API_KEY}
NEXT_PUBLIC_HDX_COLLECTOR_URL: 'http://localhost:4318'
NEXT_PUBLIC_HDX_SERVICE_NAME: 'hdx-oss-app'
Expand All @@ -172,6 +195,12 @@ services:
- internal
depends_on:
- api
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.app.rule=Host(`${HOST:-hyperdx.localhost}`)'
- 'traefik.http.routers.app.entrypoints=web'
- 'traefik.http.services.app.loadbalancer.server.port=8080'

ch-server:
image: clickhouse/clickhouse-server:23.7.1-alpine
container_name: hdx-oss-ch-server
Expand Down