From e9878487e8a8bb316d0b437bcc50476c59338624 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 29 Sep 2025 18:08:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=B9=E5=99=A8=E5=86=85=E6=B5=81?= =?UTF-8?q?=E9=87=8F=E8=BD=AC=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 3 +- docker/docker-compose.yaml | 58 ++++++++++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index e69054378..0fadfe5a0 100644 --- a/.env.example +++ b/.env.example @@ -81,8 +81,7 @@ LOG_LEVEL=INFO # === Frontend (Nuxt) === NUXT_PUBLIC_API_BASE_URL=http://localhost:8080 -NUXT_PUBLIC_API_BASE_URL_SSR=http://springboot:8080 -NUXT_PUBLIC_WEBSOCKET_URL=http://websocket_service:8082 +NUXT_PUBLIC_WEBSOCKET_URL=http://localhost:8082 NUXT_PUBLIC_WEBSITE_BASE_URL=http://localhost:3000 # 线上 & 本地均可使用 NUXT_PUBLIC_GOOGLE_CLIENT_ID=777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 029c654e4..4e02f0904 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -14,7 +14,17 @@ services: networks: - openisle-network healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-u", "root", "-p$MYSQL_ROOT_PASSWORD"] + test: + [ + "CMD", + "mysqladmin", + "ping", + "-h", + "127.0.0.1", + "-u", + "root", + "-p$MYSQL_ROOT_PASSWORD", + ] interval: 5s timeout: 3s retries: 30 @@ -36,7 +46,7 @@ services: - cluster.blocks.create_index=false ulimits: memlock: { soft: -1, hard: -1 } - nofile: { soft: 65536, hard: 65536 } + nofile: { soft: 65536, hard: 65536 } volumes: - ./data:/usr/share/opensearch/data - ./snapshots:/snapshots @@ -45,7 +55,11 @@ services: - "${OPENSEARCH_METRICS_PORT:-9600}:9600" restart: unless-stopped healthcheck: - test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:9200/_cluster/health >/dev/null"] + test: + [ + "CMD-SHELL", + "curl -fsS http://127.0.0.1:9200/_cluster/health >/dev/null", + ] interval: 10s timeout: 5s retries: 30 @@ -65,7 +79,7 @@ services: - opensearch restart: unless-stopped networks: - - openisle-network + - openisle-network rabbitmq: image: rabbitmq:3.13-management @@ -90,7 +104,6 @@ services: networks: - openisle-network - redis: image: redis:7 container_name: openisle-redis @@ -219,6 +232,41 @@ services: profiles: - service + loopback_8080: + image: alpine/socat + container_name: loopback-8080 + # 监听“frontend_dev 容器自身的” 127.0.0.1:8080 → 转发到 springboot:8080 + command: ["-d","-d","-ly","TCP4-LISTEN:8080,bind=127.0.0.1,reuseaddr,fork","TCP4:springboot:8080"] + depends_on: + springboot: + condition: service_started + network_mode: "service:frontend_dev" + profiles: ["dev"] + healthcheck: + test: ["CMD","sh","-c","nc -z 127.0.0.1 8080"] + interval: 5s + timeout: 3s + retries: 20 + start_period: 10s + + loopback_8082: + image: alpine/socat + container_name: loopback-8082 + # 监听 127.0.0.1:8082 → 转发到 websocket-service:8082(WS 纯 TCP 可直接过) + command: ["-d","-d","-ly","TCP4-LISTEN:8082,bind=127.0.0.1,reuseaddr,fork","TCP4:websocket-service:8082"] + depends_on: + websocket-service: + condition: service_started + network_mode: "service:frontend_dev" + profiles: ["dev"] + healthcheck: + test: ["CMD","sh","-c","nc -z 127.0.0.1 8082"] + interval: 5s + timeout: 3s + retries: 20 + start_period: 10s + + networks: openisle-network: driver: bridge