From a0590a50b21e4fd5d4ce2b066282a183a6e69ddb Mon Sep 17 00:00:00 2001 From: wwweww <2646787260@qq.com> Date: Sat, 25 Apr 2026 08:31:18 +0800 Subject: [PATCH] Modify docker-compose.yaml - Add mongo service - Add depend mongo config for chat-api --- app/chat/test/docker-compose.yml | 33 +++++++++++++++++++++++++++----- deploy/dev/docker-compose.yml | 23 ++++++++++++++++++++-- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/app/chat/test/docker-compose.yml b/app/chat/test/docker-compose.yml index e657a8b..56ad4cd 100644 --- a/app/chat/test/docker-compose.yml +++ b/app/chat/test/docker-compose.yml @@ -1,4 +1,26 @@ services: + mongo: + image: mongo:8.2.7 + container_name: chat-mongo-test + ports: + - "27017:27017" + healthcheck: + test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"] + interval: 5s + timeout: 3s + retries: 5 + + redis: + image: redis:7-alpine + container_name: chat-redis-test + ports: + - "6379:6379" + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 3s + timeout: 2s + retries: 5 + chat-api: build: context: ../../../../ @@ -6,11 +28,12 @@ services: container_name: chat-api-test ports: - "28888:8888" + - "28889:8889" - "28443:8443/udp" volumes: - ./certs:/etc/certs:ro - healthcheck: - test: ["CMD", "true"] - interval: 2s - timeout: 2s - retries: 5 + depends_on: + mongo: + condition: service_healthy + redis: + condition: service_healthy diff --git a/deploy/dev/docker-compose.yml b/deploy/dev/docker-compose.yml index 0092593..4d40941 100644 --- a/deploy/dev/docker-compose.yml +++ b/deploy/dev/docker-compose.yml @@ -42,6 +42,20 @@ services: - "6380:6379" restart: unless-stopped + mongo: + image: mongo:8.2.7 + container_name: juwan-mongo + restart: unless-stopped + ports: + - "27017:27017" + volumes: + - mongodata:/data/db + healthcheck: + test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"] + interval: 5s + timeout: 3s + retries: 10 + kafka: image: apache/kafka:4.0.1 container_name: juwan-kafka @@ -444,12 +458,15 @@ services: restart: unless-stopped ports: - "18810:8888" + - "18889:8889" - "18443:8443/udp" volumes: - ./certs:/etc/certs:ro depends_on: - chat-rpc: - condition: service_started + mongo: + condition: service_healthy + redis: + condition: service_healthy review-api: image: juwan/review-api:dev @@ -518,3 +535,5 @@ volumes: name: juwan-pgdata redisdata: name: juwan-redisdata + mongodata: + name: juwan-mongodata