|
1 | 1 | #================================================================================================ |
2 | 2 | # TelemetryFlow Core - Docker Compose Configuration |
3 | 3 | # IAM Module Only (PostgreSQL + Backend) |
| 4 | +# |
| 5 | +# PROFILES: |
| 6 | +# - core: Essential services (postgres, clickhouse, backend) - No monitoring |
| 7 | +# - monitoring: Observability stack (otel-collector, jaeger, prometheus, grafana) |
| 8 | +# - tools: Management tools (portainer) |
| 9 | +# - all: All services combined |
| 10 | +# |
| 11 | +# USAGE: |
| 12 | +# docker-compose --profile core up -d # Core services only |
| 13 | +# docker-compose --profile core --profile monitoring up -d # Core + monitoring |
| 14 | +# docker-compose --profile all up -d # All services |
4 | 15 | #================================================================================================ |
5 | 16 |
|
6 | 17 | #================================================================================================ |
@@ -85,10 +96,75 @@ services: |
85 | 96 | start_period: 10s |
86 | 97 |
|
87 | 98 | #---------------------------------------------------------------------------------------------- |
88 | | - # BACKEND - NestJS API |
| 99 | + # BACKEND - NestJS API (Core Profile - No OTEL dependency) |
89 | 100 | #---------------------------------------------------------------------------------------------- |
90 | 101 | backend: |
91 | | - profiles: ["core", "all"] |
| 102 | + profiles: ["core"] |
| 103 | + platform: linux/amd64 |
| 104 | + build: |
| 105 | + context: . |
| 106 | + dockerfile: Dockerfile |
| 107 | + container_name: ${CONTAINER_BACKEND:-telemetryflow_core_backend} |
| 108 | + restart: unless-stopped |
| 109 | + ports: |
| 110 | + - "${PORT:-3000}:3000" |
| 111 | + environment: |
| 112 | + - NODE_ENV=${NODE_ENV:-production} |
| 113 | + - PORT=3000 |
| 114 | + - TZ=${TZ:-UTC} |
| 115 | + |
| 116 | + # PostgreSQL |
| 117 | + - POSTGRES_HOST=postgres |
| 118 | + - POSTGRES_PORT=5432 |
| 119 | + - POSTGRES_DB=${POSTGRES_DB:-telemetryflow_db} |
| 120 | + - POSTGRES_USERNAME=${POSTGRES_USERNAME:-postgres} |
| 121 | + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-telemetryflow123} |
| 122 | + |
| 123 | + # ClickHouse |
| 124 | + - CLICKHOUSE_HOST=clickhouse |
| 125 | + - CLICKHOUSE_PORT=8123 |
| 126 | + - CLICKHOUSE_DB=${CLICKHOUSE_DB:-telemetryflow_db} |
| 127 | + - CLICKHOUSE_USER=${CLICKHOUSE_USER:-default} |
| 128 | + - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-telemetryflow123} |
| 129 | + |
| 130 | + # JWT |
| 131 | + - JWT_SECRET=${JWT_SECRET} |
| 132 | + - JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-24h} |
| 133 | + - SESSION_SECRET=${SESSION_SECRET} |
| 134 | + |
| 135 | + # Logging |
| 136 | + - LOGGER_TYPE=${LOGGER_TYPE:-winston} |
| 137 | + - LOG_LEVEL=${LOG_LEVEL:-info} |
| 138 | + - LOG_PRETTY_PRINT=${LOG_PRETTY_PRINT:-false} |
| 139 | + - LOG_FILE_ENABLED=${LOG_FILE_ENABLED:-true} |
| 140 | + - LOG_FILE_DIRNAME=logs |
| 141 | + - LOG_FILE_FILENAME=app-%DATE%.log |
| 142 | + |
| 143 | + # OpenTelemetry (disabled for core profile) |
| 144 | + - OTEL_ENABLED=false |
| 145 | + - OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-telemetryflow-core} |
| 146 | + volumes: |
| 147 | + - ./logs:/app/logs |
| 148 | + depends_on: |
| 149 | + postgres: |
| 150 | + condition: service_healthy |
| 151 | + clickhouse: |
| 152 | + condition: service_healthy |
| 153 | + networks: |
| 154 | + telemetryflow_core_net: |
| 155 | + ipv4_address: ${CONTAINER_IP_BACKEND:-172.151.151.10} |
| 156 | + healthcheck: |
| 157 | + test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1"] |
| 158 | + interval: 30s |
| 159 | + timeout: 10s |
| 160 | + retries: 3 |
| 161 | + start_period: 40s |
| 162 | + |
| 163 | + #---------------------------------------------------------------------------------------------- |
| 164 | + # BACKEND - NestJS API (All Profile - With OTEL dependency) |
| 165 | + #---------------------------------------------------------------------------------------------- |
| 166 | + backend-with-monitoring: |
| 167 | + profiles: ["all"] |
92 | 168 | platform: linux/amd64 |
93 | 169 | build: |
94 | 170 | context: . |
@@ -129,7 +205,7 @@ services: |
129 | 205 | - LOG_FILE_DIRNAME=logs |
130 | 206 | - LOG_FILE_FILENAME=app-%DATE%.log |
131 | 207 |
|
132 | | - # OpenTelemetry |
| 208 | + # OpenTelemetry (enabled for all profile) |
133 | 209 | - OTEL_ENABLED=${OTEL_ENABLED:-true} |
134 | 210 | - OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-telemetryflow-core} |
135 | 211 | - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318 |
@@ -190,7 +266,7 @@ services: |
190 | 266 | otel-collector: |
191 | 267 | profiles: ["monitoring", "all"] |
192 | 268 | platform: linux/amd64 |
193 | | - image: otel/opentelemetry-collector-contrib:${OTEL_VERSION:-latest} |
| 269 | + image: telemetryflow/telemetryflow-collector-ocb:${OTEL_VERSION:-latest} |
194 | 270 | container_name: ${CONTAINER_OTEL:-telemetryflow_core_otel} |
195 | 271 | restart: unless-stopped |
196 | 272 | command: ["--config=/etc/otel-collector-config.yaml"] |
|
0 commit comments