From 8a10224db0778896303bd39b8c045a199bb43e9c Mon Sep 17 00:00:00 2001 From: BBIT-Kai <2911862937@qq.com> Date: Tue, 14 Oct 2025 17:51:56 +0800 Subject: [PATCH] =?UTF-8?q?dockercompose=E5=88=86=E5=BC=80=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=9C=8D=E5=8A=A1=E4=B8=8E=E5=89=8D=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/docker/docker-compose.yaml | 204 +------------------- server/docker/infra-compose.yaml | 302 ++++++++++++++++++++++++++++++ 2 files changed, 306 insertions(+), 200 deletions(-) create mode 100644 server/docker/infra-compose.yaml diff --git a/server/docker/docker-compose.yaml b/server/docker/docker-compose.yaml index eb12ab0..eede265 100644 --- a/server/docker/docker-compose.yaml +++ b/server/docker/docker-compose.yaml @@ -10,7 +10,7 @@ services: # ---------- Vue 前端 ---------- vue: container_name: ce_vue - image: ce_vue:latest + image: s1.ronsunny.cn:13011/bbit_ai/ce_vue:latest networks: - ce_network restart: always @@ -18,7 +18,7 @@ services: # ---------- Python 后端 ---------- backend: container_name: ce_pybackend - image: ce_pybackend:latest + image: s1.ronsunny.cn:13011/bbit_ai/ce_pybackend:latest networks: - ce_network restart: unless-stopped @@ -27,204 +27,8 @@ services: extra_hosts: - "s1.ronsunny.cn:10.10.10.9" - # ---------- PostgreSQL ---------- - postgres: - container_name: ce_postgres - image: postgres:15-alpine - environment: - POSTGRES_DB: ktor # 实际上这里已经没用了,因为卷已经创建了,现在在用ktor2、kong两个数据库 - POSTGRES_USER: postgres - POSTGRES_PASSWORD: 123456 - ports: - - "5432:5432" - volumes: - - postgres_data:/var/lib/postgresql/data - networks: - - ce_network - restart: unless-stopped - - # ---------- Redis ---------- - redis: - container_name: ce_redis - image: redis:7.2.3-alpine - volumes: - - redis_data:/data - ports: - - "6379:6379" - networks: - - ce_network - restart: unless-stopped - - # ---------- MinIO ---------- - minio: - container_name: ce_minio - image: minio/minio:RELEASE.2025-03-12T18-04-18Z - environment: - MINIO_ACCESS_KEY: minioadmin - MINIO_SECRET_KEY: minioadmin - ports: - - "9000:9000" - - "9001:9001" - volumes: - - minio_data:/data - networks: - - ce_network - restart: unless-stopped - command: server /data --console-address ":9001" - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] - interval: 30s - timeout: 20s - retries: 3 - - # ---------- ETCD ---------- - etcd: - container_name: ce_etcd - image: quay.io/coreos/etcd:v3.5.18 - environment: - - ETCD_AUTO_COMPACTION_MODE=revision - - ETCD_AUTO_COMPACTION_RETENTION=1000 - - ETCD_QUOTA_BACKEND_BYTES=4294967296 - - ETCD_SNAPSHOT_COUNT=50000 - networks: - - ce_network - volumes: - - etcd_data:/data/etcd - command: etcd -advertise-client-urls=http://etcd:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /data/etcd - healthcheck: - test: ["CMD", "etcdctl", "endpoint", "health"] - interval: 30s - timeout: 20s - retries: 3 - - # ---------- Milvus ---------- - milvus: - container_name: ce_milvus - image: milvusdb/milvus:v2.6.1 - command: ["milvus", "run", "standalone"] - security_opt: - - seccomp:unconfined - environment: - ETCD_ENDPOINTS: etcd:2379 - MINIO_ADDRESS: minio:9000 - MQ_TYPE: woodpecker - networks: - - ce_network - volumes: - - milvus_data:/var/lib/milvus - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"] - interval: 30s - start_period: 90s - timeout: 20s - retries: 3 - ports: - - "19530:19530" # 服务用 - - "9091:9091" # GUI用 - depends_on: - - etcd - - minio - - # ---------- Attu ---------- - attu: - container_name: ce_attu - image: zilliz/attu:v2.6 - environment: - MILVUS_URL: ce_milvus:19530 - networks: - - ce_network - ports: - - "3000:3000" # 浏览器访问端口 - restart: unless-stopped - depends_on: - - milvus - - # ---------- Kong 网关 ---------- - kong-migrations: - image: kong:3.9.1-ubuntu - container_name: ce_kong_migrations - command: kong migrations bootstrap - depends_on: - - postgres - environment: - <<: *kong-env - networks: - - ce_network - restart: on-failure - - kong-migrations-up: - image: kong:3.9.1-ubuntu - container_name: ce_kong_migrations_up - command: kong migrations up && kong migrations finish - depends_on: - - postgres - environment: - <<: *kong-env - networks: - - ce_network - restart: on-failure - - kong: - image: kong:3.9.1-ubuntu - container_name: ce_kong - user: kong - environment: - <<: *kong-env - KONG_ADMIN_ACCESS_LOG: /dev/stdout - KONG_ADMIN_ERROR_LOG: /dev/stderr - KONG_PROXY_ACCESS_LOG: /dev/stdout - KONG_PROXY_ERROR_LOG: /dev/stderr - KONG_PREFIX: /var/run/kong - - KONG_PROXY_LISTEN: "0.0.0.0:8090" # 对外暴露端口 - KONG_ADMIN_LISTEN: "0.0.0.0:8001" # Admin GUI - KONG_ADMIN_GUI_LISTEN: "0.0.0.0:8002" - ports: - - "8090:8090" # 代理端口对外 - - "8001:8001/tcp" - - "8002:8002/tcp" - - "8444:8444/tcp" - volumes: - - kong_prefix_vol:${KONG_PREFIX:-/var/run/kong} - - kong_tmp_vol:/tmp - - ./config:/opt/kong - networks: - - ce_network - restart: unless-stopped - - # ---------- RabbitMQ ---------- - rabbitmq: - image: rabbitmq:4.2-rc-management-alpine - container_name: ce_rabbitmq - restart: always - environment: - RABBITMQ_DEFAULT_USER: admin - RABBITMQ_DEFAULT_PASS: 123456 - ports: - - "5672:5672" - - "15672:15672" - volumes: - - rabbitmq_data:/var/lib/rabbitmq - networks: - - ce_network - -# ---------- 数据卷 ---------- -volumes: - postgres_data: - redis_data: - minio_data: - etcd_data: - milvus_data: - kong_prefix_vol: - driver_opts: - type: tmpfs - device: tmpfs - kong_tmp_vol: - driver_opts: - type: tmpfs - device: tmpfs - rabbitmq_data: # ---------- 网络 ---------- networks: ce_network: - driver: bridge + external: true + diff --git a/server/docker/infra-compose.yaml b/server/docker/infra-compose.yaml new file mode 100644 index 0000000..30afa80 --- /dev/null +++ b/server/docker/infra-compose.yaml @@ -0,0 +1,302 @@ + +x-kong-config: + &kong-env + KONG_DATABASE: postgres + KONG_PG_HOST: postgres + KONG_PG_DATABASE: kong + KONG_PG_USER: postgres + KONG_PG_PASSWORD: 123456 +services: + # ---------- PostgreSQL ---------- + postgres: + container_name: ce_postgres + image: postgres:15-alpine + environment: + POSTGRES_DB: ktor # 实际上这里已经没用了,因为卷已经创建了,现在在用ktor2、kong两个数据库 + POSTGRES_USER: postgres + POSTGRES_PASSWORD: 123456 + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data + networks: + - ce_network + restart: unless-stopped + + # ---------- Redis ---------- + redis: + container_name: ce_redis + image: redis:7.2.3-alpine + volumes: + - redis_data:/data + ports: + - "6379:6379" + networks: + - ce_network + restart: unless-stopped + + # ---------- MinIO ---------- + minio: + container_name: ce_minio + image: minio/minio:RELEASE.2025-03-12T18-04-18Z + environment: + MINIO_ACCESS_KEY: minioadmin + MINIO_SECRET_KEY: minioadmin + MINIO_PROMETHEUS_AUTH_TYPE: "public" + ports: + - "9000:9000" + - "9001:9001" + volumes: + - minio_data:/data + networks: + - ce_network + restart: unless-stopped + command: server /data --console-address ":9001" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 10s + timeout: 5s + retries: 5 + + # ---------- ETCD ---------- + etcd: + container_name: ce_etcd + image: quay.io/coreos/etcd:v3.5.18 + environment: + - ETCD_AUTO_COMPACTION_MODE=revision + - ETCD_AUTO_COMPACTION_RETENTION=1000 + - ETCD_QUOTA_BACKEND_BYTES=4294967296 + - ETCD_SNAPSHOT_COUNT=50000 + networks: + - ce_network + restart: unless-stopped + volumes: + - etcd_data:/data/etcd + command: etcd -advertise-client-urls=http://etcd:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /data/etcd + healthcheck: + test: ["CMD", "etcdctl", "endpoint", "health"] + interval: 10s + timeout: 5s + retries: 5 + + # ---------- Milvus ---------- + milvus: + container_name: ce_milvus + image: milvusdb/milvus:v2.6.1 + command: ["milvus", "run", "standalone"] + security_opt: + - seccomp:unconfined + restart: unless-stopped + environment: + ETCD_ENDPOINTS: etcd:2379 + MINIO_ADDRESS: minio:9000 + MQ_TYPE: woodpecker + networks: + - ce_network + volumes: + - milvus_data:/var/lib/milvus + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"] + interval: 30s + start_period: 90s + timeout: 20s + retries: 3 + ports: + - "19530:19530" # 服务用 + - "9091:9091" # GUI用 + depends_on: + - etcd + - minio + + # ---------- Attu ---------- + attu: + container_name: ce_attu + image: zilliz/attu:v2.6 + environment: + MILVUS_URL: ce_milvus:19530 + networks: + - ce_network + ports: + - "3000:3000" # 浏览器访问端口 + restart: unless-stopped + depends_on: + - milvus + + # ---------- Kong 网关 ---------- + kong-migrations: + image: kong:3.9.1-ubuntu + container_name: ce_kong_migrations + command: kong migrations bootstrap + depends_on: + - postgres + environment: + <<: *kong-env + networks: + - ce_network + restart: on-failure + + kong-migrations-up: + image: kong:3.9.1-ubuntu + container_name: ce_kong_migrations_up + command: kong migrations up && kong migrations finish + depends_on: + - postgres + environment: + <<: *kong-env + networks: + - ce_network + restart: on-failure + + kong: + image: kong:3.9.1-ubuntu + container_name: ce_kong + user: kong + environment: + <<: *kong-env + KONG_ADMIN_ACCESS_LOG: /dev/stdout + KONG_ADMIN_ERROR_LOG: /dev/stderr + KONG_PROXY_ACCESS_LOG: /dev/stdout + KONG_PROXY_ERROR_LOG: /dev/stderr + KONG_PREFIX: /var/run/kong + + KONG_PROXY_LISTEN: "0.0.0.0:8090" # 对外暴露端口 + KONG_ADMIN_LISTEN: "0.0.0.0:8001" # Admin GUI + KONG_ADMIN_GUI_LISTEN: "0.0.0.0:8002" + + KONG_PLUGINS: bundled,prometheus + KONG_PROMETHEUS_STATUS_CODE_METRICS: "on" + KONG_PROMETHEUS_LATENCY_METRICS: "on" + KONG_PROMETHEUS_BANDWIDTH_METRICS: "on" + ports: + - "8090:8090" # 代理端口对外 + - "8001:8001/tcp" + - "8002:8002/tcp" + - "8444:8444/tcp" + volumes: + - kong_prefix_vol:${KONG_PREFIX:-/var/run/kong} + - kong_tmp_vol:/tmp + - ./config/kong:/opt/kong + networks: + - ce_network + restart: unless-stopped + + # ---------- RabbitMQ ---------- + rabbitmq: + image: rabbitmq:4.2-rc-management-alpine + container_name: ce_rabbitmq + restart: always + environment: + RABBITMQ_DEFAULT_USER: admin + RABBITMQ_DEFAULT_PASS: 123456 + ports: + - "5672:5672" + - "15672:15672" + - "15692:15692" + command: > + sh -c "rabbitmq-plugins enable --offline rabbitmq_prometheus && rabbitmq-server" + volumes: + - rabbitmq_data:/var/lib/rabbitmq + networks: + - ce_network + + # ---------- prometheus ---------- + prometheus: + image: prom/prometheus:v3.7.0-rc.0 + container_name: ce_prometheus + restart: always + volumes: + - ./config/prometheus:/etc/prometheus + - prometheus_data:/prometheus + ports: + - "0.0.0.0:9090:9090" + networks: + - ce_network + depends_on: + - kong + - milvus + - minio + - node_exporter + - postgres-exporter + - rabbitmq + - redis-exporter + + # ---------- grafana ---------- + grafana: + image: grafana/grafana:12.3.0-18481575143-ubuntu + container_name: ce_grafana + restart: always + ports: + - "0.0.0.0:3001:3000" + environment: + - GF_SECURITY_ADMIN_USER=admin + - GF_SECURITY_ADMIN_PASSWORD=123456 + - GF_AUTH_ANONYMOUS_ENABLED=false + volumes: + - grafana_data:/var/lib/grafana + depends_on: + - prometheus + networks: + - ce_network + # ---------- Redis Exporter ---------- + redis-exporter: + image: oliver006/redis_exporter:v1.78.0-alpine + container_name: ce_redis_exporter + environment: + - REDIS_ADDR=ce_redis:6379 + # ports: + # - "9121:9121" # 无需暴露内网端口 直接通过ce_redis_exporter访问即可 + networks: + - ce_network + restart: unless-stopped + depends_on: + - redis + + # ---------- PostgreSQL Exporter ---------- + postgres-exporter: + image: prometheuscommunity/postgres-exporter:v0.18.1 + container_name: ce_postgres_exporter + environment: + DATA_SOURCE_NAME: "postgresql://postgres:123456@ce_postgres:5432/postgres?sslmode=disable" + # ports: + # - "9187:9187" # 无需暴露内网端口 直接通过ce_postgres_exporter访问即可 + networks: + - ce_network + restart: unless-stopped + depends_on: + - postgres + + # ---------- node_exporter ---------- + node_exporter: + image: quay.io/prometheus/node-exporter:v1.9.1 + container_name: ce_node_exporter + command: + - '--path.rootfs=/host' + network_mode: host + pid: host + restart: unless-stopped + volumes: + - '/:/host:ro,rslave' + +# ---------- 数据卷 ---------- +volumes: + grafana_data: + postgres_data: + redis_data: + minio_data: + etcd_data: + milvus_data: + kong_prefix_vol: + driver_opts: + type: tmpfs + device: tmpfs + kong_tmp_vol: + driver_opts: + type: tmpfs + device: tmpfs + rabbitmq_data: + prometheus_config: + prometheus_data: +# ---------- 网络 ---------- +networks: + ce_network: + external: true