From e1830b46b82ee199cc365bb3de9895f9c9a08e58 Mon Sep 17 00:00:00 2001 From: Hugo Guerrero <1001939+hguerrero@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:56:28 -0400 Subject: [PATCH 1/3] use adminport instead of `host` network --- client/gateway.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/gateway.go b/client/gateway.go index cfc0442f3..a29360b29 100644 --- a/client/gateway.go +++ b/client/gateway.go @@ -596,7 +596,7 @@ func (cli *VanClient) setupGatewayConfig(ctx context.Context, gatewayName string } gatewayConfig.Listeners["amqp"] = qdr.Listener{ Name: "amqp", - Host: "localhost", + Host: "0.0.0.0", Port: int32(amqpPort), } @@ -735,6 +735,8 @@ func (cli *VanClient) gatewayStartContainer(ctx context.Context, gatewayName str } siteId, _ := getGatewaySiteId(gatewayDir) + adminUrl, _ := getRouterUrl(gatewayDir) + adminPort := strings.Split(adminUrl, ":") containerCmd := gatewayType containerCmdArgs := []string{ "run", @@ -743,8 +745,8 @@ func (cli *VanClient) gatewayStartContainer(ctx context.Context, gatewayName str "-d", "--name", gatewayName, - "--network", - "host", + "-p", + adminPort[len(adminPort)-1] + ":" + adminPort[len(adminPort)-1], "-e", "SKUPPER_SITE_ID=gateway" + "_" + gatewayName + "_" + siteId, "-e", From cb1142d23164e5fa1cc77008548064b6e07564ab Mon Sep 17 00:00:00 2001 From: Hugo Guerrero <1001939+hguerrero@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:02:43 -0400 Subject: [PATCH 2/3] check the host OS to avoid breaking podman --- client/gateway.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/gateway.go b/client/gateway.go index a29360b29..cea760a2c 100644 --- a/client/gateway.go +++ b/client/gateway.go @@ -16,6 +16,7 @@ import ( "os/exec" "os/user" "regexp" + "runtime" "strconv" "strings" "text/template" @@ -737,6 +738,14 @@ func (cli *VanClient) gatewayStartContainer(ctx context.Context, gatewayName str siteId, _ := getGatewaySiteId(gatewayDir) adminUrl, _ := getRouterUrl(gatewayDir) adminPort := strings.Split(adminUrl, ":") + + networkingFlag := "--network" + networkingValue := "host" + if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { + networkingFlag = "-p" + networkingValue = adminPort[len(adminPort)-1] + ":" + adminPort[len(adminPort)-1] + } + containerCmd := gatewayType containerCmdArgs := []string{ "run", @@ -745,8 +754,8 @@ func (cli *VanClient) gatewayStartContainer(ctx context.Context, gatewayName str "-d", "--name", gatewayName, - "-p", - adminPort[len(adminPort)-1] + ":" + adminPort[len(adminPort)-1], + networkingFlag, + networkingValue, "-e", "SKUPPER_SITE_ID=gateway" + "_" + gatewayName + "_" + siteId, "-e", From 136afe81936ce214ef5730c4ce37392437e223ac Mon Sep 17 00:00:00 2001 From: Hugo Guerrero <1001939+hguerrero@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:57:08 -0400 Subject: [PATCH 3/3] fix error with podman on nonLinux --- client/gateway.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/gateway.go b/client/gateway.go index cea760a2c..ba82b8923 100644 --- a/client/gateway.go +++ b/client/gateway.go @@ -738,12 +738,18 @@ func (cli *VanClient) gatewayStartContainer(ctx context.Context, gatewayName str siteId, _ := getGatewaySiteId(gatewayDir) adminUrl, _ := getRouterUrl(gatewayDir) adminPort := strings.Split(adminUrl, ":") + isNonLinux := runtime.GOOS == "windows" || runtime.GOOS == "darwin" networkingFlag := "--network" networkingValue := "host" - if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { + + volumeFlag := gatewayDir + ":" + containerDir + ":Z" + + if isNonLinux { networkingFlag = "-p" networkingValue = adminPort[len(adminPort)-1] + ":" + adminPort[len(adminPort)-1] + + volumeFlag = gatewayDir + ":" + containerDir } containerCmd := gatewayType @@ -763,7 +769,7 @@ func (cli *VanClient) gatewayStartContainer(ctx context.Context, gatewayName str "-e", "QDROUTERD_CONF=" + containerDir + "/config/skrouterd.json", "-v", - gatewayDir + ":" + containerDir + ":Z", + volumeFlag, images.GetRouterImageName(), }