feat(opik): add ClickHouse configuration files and update Docker Compose for Zookeeper and ClickHouse services

This commit is contained in:
Sun-ZhenXing
2026-02-27 15:30:34 +08:00
parent 7946434b0c
commit 64c9b251c3
4 changed files with 43 additions and 15 deletions

View File

@@ -0,0 +1,12 @@
<clickhouse>
<remote_servers>
<opik_cluster>
<shard>
<replica>
<host>clickhouse</host>
<port>9000</port>
</replica>
</shard>
</opik_cluster>
</remote_servers>
</clickhouse>

View File

@@ -0,0 +1,7 @@
<clickhouse>
<macros>
<cluster>opik_cluster</cluster>
<shard>01</shard>
<replica>01</replica>
</macros>
</clickhouse>

View File

@@ -0,0 +1,8 @@
<clickhouse>
<zookeeper>
<node>
<host>zookeeper</host>
<port>2181</port>
</node>
</zookeeper>
</clickhouse>

View File

@@ -13,7 +13,6 @@ services:
mysql: mysql:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}mysql:${MYSQL_VERSION:-8.4.2} image: ${GLOBAL_REGISTRY:-}mysql:${MYSQL_VERSION:-8.4.2}
hostname: mysql
environment: environment:
TZ: ${TZ:-UTC} TZ: ${TZ:-UTC}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-opik} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-opik}
@@ -40,7 +39,6 @@ services:
redis: redis:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}redis:${REDIS_VERSION:-7.2.4-alpine3.19} image: ${GLOBAL_REGISTRY:-}redis:${REDIS_VERSION:-7.2.4-alpine3.19}
hostname: redis
command: redis-server --requirepass ${REDIS_PASSWORD:-opik} command: redis-server --requirepass ${REDIS_PASSWORD:-opik}
environment: environment:
TZ: ${TZ:-UTC} TZ: ${TZ:-UTC}
@@ -64,7 +62,6 @@ services:
zookeeper: zookeeper:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}zookeeper:${ZOOKEEPER_VERSION:-3.9.4} image: ${GLOBAL_REGISTRY:-}zookeeper:${ZOOKEEPER_VERSION:-3.9.4}
hostname: zookeeper
user: root user: root
entrypoint: entrypoint:
- /bin/bash - /bin/bash
@@ -81,6 +78,9 @@ services:
ZOO_DATA_LOG_DIR: /bitnami/zookeeper/data ZOO_DATA_LOG_DIR: /bitnami/zookeeper/data
volumes: volumes:
- zookeeper_data:/bitnami/zookeeper - zookeeper_data:/bitnami/zookeeper
- zookeeper_data_dir:/data
- zookeeper_datalog:/datalog
- zookeeper_logs:/logs
healthcheck: healthcheck:
test: [CMD-SHELL, 'echo ruok | nc localhost 2181 | grep -q imok'] test: [CMD-SHELL, 'echo ruok | nc localhost 2181 | grep -q imok']
interval: 5s interval: 5s
@@ -99,6 +99,7 @@ services:
clickhouse-init: clickhouse-init:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}alpine:${ALPINE_VERSION:-latest} image: ${GLOBAL_REGISTRY:-}alpine:${ALPINE_VERSION:-latest}
restart: on-failure
volumes: volumes:
- ./clickhouse_config:/clickhouse_config_files:ro - ./clickhouse_config:/clickhouse_config_files:ro
- clickhouse_config:/config - clickhouse_config:/config
@@ -116,7 +117,6 @@ services:
clickhouse: clickhouse:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}clickhouse/clickhouse-server:${CLICKHOUSE_VERSION:-25.3.6.56-alpine} image: ${GLOBAL_REGISTRY:-}clickhouse/clickhouse-server:${CLICKHOUSE_VERSION:-25.3.6.56-alpine}
hostname: clickhouse
environment: environment:
TZ: ${TZ:-UTC} TZ: ${TZ:-UTC}
CLICKHOUSE_DB: ${CLICKHOUSE_DB:-opik} CLICKHOUSE_DB: ${CLICKHOUSE_DB:-opik}
@@ -154,7 +154,6 @@ services:
minio: minio:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}minio/minio:${MINIO_VERSION:-RELEASE.2025-03-12T18-04-18Z} image: ${GLOBAL_REGISTRY:-}minio/minio:${MINIO_VERSION:-RELEASE.2025-03-12T18-04-18Z}
hostname: minio
environment: environment:
TZ: ${TZ:-UTC} TZ: ${TZ:-UTC}
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-opikminio} MINIO_ROOT_USER: ${MINIO_ROOT_USER:-opikminio}
@@ -202,7 +201,6 @@ services:
backend: backend:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}ghcr.io/comet-ml/opik/opik-backend:${OPIK_VERSION:-1.10.23} image: ${GLOBAL_REGISTRY:-}ghcr.io/comet-ml/opik/opik-backend:${OPIK_VERSION:-1.10.23}
hostname: backend
command: [bash, -c, './run_db_migrations.sh && ./entrypoint.sh'] command: [bash, -c, './run_db_migrations.sh && ./entrypoint.sh']
environment: environment:
TZ: ${TZ:-UTC} TZ: ${TZ:-UTC}
@@ -260,13 +258,12 @@ services:
reservations: reservations:
cpus: ${BACKEND_CPU_RESERVATION:-0.5} cpus: ${BACKEND_CPU_RESERVATION:-0.5}
memory: ${BACKEND_MEMORY_RESERVATION:-1G} memory: ${BACKEND_MEMORY_RESERVATION:-1G}
tmpfs: volumes:
- /tmp - backend_tmp:/tmp
python-backend: python-backend:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}ghcr.io/comet-ml/opik/opik-python-backend:${OPIK_VERSION:-1.10.23} image: ${GLOBAL_REGISTRY:-}ghcr.io/comet-ml/opik/opik-python-backend:${OPIK_VERSION:-1.10.23}
hostname: python-backend
privileged: true privileged: true
environment: environment:
TZ: ${TZ:-UTC} TZ: ${TZ:-UTC}
@@ -310,24 +307,23 @@ services:
reservations: reservations:
cpus: ${PYTHON_BACKEND_CPU_RESERVATION:-0.5} cpus: ${PYTHON_BACKEND_CPU_RESERVATION:-0.5}
memory: ${PYTHON_BACKEND_MEMORY_RESERVATION:-512M} memory: ${PYTHON_BACKEND_MEMORY_RESERVATION:-512M}
tmpfs: volumes:
- /var/lib/docker - python_backend_docker:/var/lib/docker
frontend: frontend:
<<: *defaults <<: *defaults
image: ${GLOBAL_REGISTRY:-}ghcr.io/comet-ml/opik/opik-frontend:${OPIK_VERSION:-1.10.23} image: ${GLOBAL_REGISTRY:-}ghcr.io/comet-ml/opik/opik-frontend:${OPIK_VERSION:-1.10.23}
hostname: frontend
ports: ports:
- '${OPIK_PORT_OVERRIDE:-5173}:5173' - '${OPIK_PORT_OVERRIDE:-5173}:80'
environment: environment:
TZ: ${TZ:-UTC} TZ: ${TZ:-UTC}
NGINX_PORT: ${NGINX_PORT:-5173} NGINX_PORT: ${NGINX_PORT:-80}
NGINX_CONF_SUFFIX: ${NGINX_CONF_SUFFIX:-local} NGINX_CONF_SUFFIX: ${NGINX_CONF_SUFFIX:-local}
depends_on: depends_on:
backend: backend:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
test: [CMD-SHELL, 'curl --fail --fail-early http://localhost:5173/health'] test: [CMD-SHELL, 'curl --fail --fail-early http://localhost:80/']
interval: 10s interval: 10s
timeout: 10s timeout: 10s
retries: 10 retries: 10
@@ -345,7 +341,12 @@ volumes:
mysql_data: mysql_data:
redis_data: redis_data:
zookeeper_data: zookeeper_data:
zookeeper_data_dir:
zookeeper_datalog:
zookeeper_logs:
clickhouse_data: clickhouse_data:
clickhouse_logs: clickhouse_logs:
clickhouse_config: clickhouse_config:
minio_data: minio_data:
backend_tmp:
python_backend_docker: