Browse Source

docker新增Milvus服务

537yaha 6 tháng trước cách đây
mục cha
commit
225ed5c157
1 tập tin đã thay đổi với 75 bổ sung0 xóa
  1. 75 0
      docker-compose.prod.yml

+ 75 - 0
docker-compose.prod.yml

@@ -1,4 +1,69 @@
 services:
+  # ========== Milvus 向量库及其依赖(与 MySQL 一样在 Docker 中运行) ==========
+  etcd:
+    image: quay.io/coreos/etcd:v3.5.5
+    container_name: milvus-etcd
+    environment:
+      - ETCD_AUTO_COMPACTION_MODE=revision
+      - ETCD_AUTO_COMPACTION_RETENTION=1000
+      - ETCD_QUOTA_BACKEND_BYTES=4294967296
+      - ETCD_SNAPSHOT_COUNT=50000
+    volumes:
+      - etcd_data:/etcd
+    command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
+    healthcheck:
+      test: ["CMD", "etcdctl", "endpoint", "health"]
+      interval: 30s
+      timeout: 20s
+      retries: 3
+    networks:
+      - ai-cs-network
+    restart: unless-stopped
+
+  minio:
+    image: minio/minio:RELEASE.2023-03-20T20-16-18Z
+    container_name: milvus-minio
+    environment:
+      MINIO_ACCESS_KEY: minioadmin
+      MINIO_SECRET_KEY: minioadmin
+    volumes:
+      - minio_data:/minio_data
+    command: minio server /minio_data --console-address ":9001"
+    healthcheck:
+      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
+      interval: 30s
+      timeout: 20s
+      retries: 3
+    networks:
+      - ai-cs-network
+    restart: unless-stopped
+
+  milvus-standalone:
+    image: milvusdb/milvus:v2.3.3
+    container_name: milvus-standalone
+    command: ["milvus", "run", "standalone"]
+    environment:
+      ETCD_ENDPOINTS: etcd:2379
+      MINIO_ADDRESS: minio:9000
+    volumes:
+      - milvus_data:/var/lib/milvus
+    ports:
+      - "${MILVUS_PORT:-19530}:19530"
+    depends_on:
+      etcd:
+        condition: service_healthy
+      minio:
+        condition: service_healthy
+    healthcheck:
+      test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
+      interval: 30s
+      start_period: 90s
+      timeout: 20s
+      retries: 5
+    networks:
+      - ai-cs-network
+    restart: unless-stopped
+
   # MySQL 数据库
   mysql:
     image: mysql:8.0
@@ -54,6 +119,8 @@ services:
       SERVER_PORT: 8080
       GIN_MODE: ${GIN_MODE:-release}
       ENCRYPTION_KEY: ${ENCRYPTION_KEY:-default-key}
+      MILVUS_HOST: milvus-standalone
+      MILVUS_PORT: 19530
     ports:
       - "${BACKEND_PORT:-18080}:8080"
     volumes:
@@ -61,6 +128,8 @@ services:
     depends_on:
       mysql:
         condition: service_healthy
+      milvus-standalone:
+        condition: service_healthy
     networks:
       - ai-cs-network
     restart: unless-stopped
@@ -117,6 +186,12 @@ services:
 volumes:
   mysql_data:
     driver: local
+  etcd_data:
+    driver: local
+  minio_data:
+    driver: local
+  milvus_data:
+    driver: local
 
 networks:
   ai-cs-network: