From b0bca2a62ae9f6f7908b31189875202fac243eef Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 23:52:07 +0900 Subject: [PATCH] =?UTF-8?q?fix(websocket):=20Nginx=20lane=EC=9D=B4=20job?= =?UTF-8?q?=20=EC=BB=A8=ED=85=8C=EC=9D=B4=EB=84=88=20=EC=95=88=EC=9D=98=20?= =?UTF-8?q?=EC=95=B1=EC=97=90=EB=8F=84=20=EB=8B=BF=EA=B2=8C=20=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit websocketNginxTest의 Nginx 컨테이너는 host.docker.internal을 host-gateway(Docker 호스트)로 풀어 시험 JVM의 앱에 붙었다. desktop에서는 Docker 호스트가 곧 JVM의 호스트라 됐지만, Gitea runner처럼 job이 자기 컨테이너 안에서 돌면 앱은 거기 없다. release 수동 실행(run 51)의 websocket-stable-release-gate가 upgrade마다 DeploymentException으로 실패했다. Testcontainers의 호스트 포트 노출(exposeHostPorts, withAccessToHost)로 host.testcontainers.internal을 이 JVM으로 잇는다. 두 환경에서 같은 이름이다. 버린 것: runner 설정을 host 네트워크로 바꾸기(platform-core 몫, job 격리를 푼다). 위험: Testcontainers가 sshd 보조 컨테이너를 하나 더 띄운다(이미지는 Testcontainers가 고정한 것, container-images.properties 밖). 검증: desktop에서 :adapter:inbound:websocket:websocketNginxTest. --- .../websocket/proxy/NginxWebSocketHarness.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/adapter/inbound/websocket/src/nginxWebSocketTest/java/dev/caskeleton/adapter/inbound/websocket/proxy/NginxWebSocketHarness.java b/src/adapter/inbound/websocket/src/nginxWebSocketTest/java/dev/caskeleton/adapter/inbound/websocket/proxy/NginxWebSocketHarness.java index 70c8859b..3f1173ed 100644 --- a/src/adapter/inbound/websocket/src/nginxWebSocketTest/java/dev/caskeleton/adapter/inbound/websocket/proxy/NginxWebSocketHarness.java +++ b/src/adapter/inbound/websocket/src/nginxWebSocketTest/java/dev/caskeleton/adapter/inbound/websocket/proxy/NginxWebSocketHarness.java @@ -30,12 +30,15 @@ public final class NginxWebSocketHarness implements AutoCloseable { */ @SuppressWarnings("resource") public NginxWebSocketHarness(int applicationPort, String configurationResource) { + // The application listens in this JVM's network, which a container reaches by name only through + // Testcontainers' host-port tunnel. `host-gateway` was the Docker host, which is this JVM's host + // on a workstation but not on a CI runner whose job runs in a container of its own (the Gitea + // runner): there Nginx reached nothing and every upgrade failed as a deployment error. + org.testcontainers.Testcontainers.exposeHostPorts(applicationPort); this.nginx = new GenericContainer<>(IMAGE) .withExposedPorts(8080) - // host.docker.internal is not resolvable on stock Linux Docker; without the gateway - // the container fails with a connection refused that reads as a config error. - .withExtraHost("host.docker.internal", "host-gateway") + .withAccessToHost(true) .withCopyToContainer( Transferable.of(configuration(configurationResource, applicationPort)), "/etc/nginx/nginx.conf"); @@ -68,7 +71,7 @@ public final class NginxWebSocketHarness implements AutoCloseable { throw new IllegalStateException(resource + " is missing from the lane's resources"); } return new String(stream.readAllBytes(), StandardCharsets.UTF_8) - .replace("APPLICATION_HOST", "host.docker.internal") + .replace("APPLICATION_HOST", "host.testcontainers.internal") .replace("APPLICATION_PORT", Integer.toString(applicationPort)); } catch (IOException e) { throw new IllegalStateException(resource + " could not be read", e);