diff --git a/client/gateway.go b/client/gateway.go index cfc0442f3..ba82b8923 100644 --- a/client/gateway.go +++ b/client/gateway.go @@ -16,6 +16,7 @@ import ( "os/exec" "os/user" "regexp" + "runtime" "strconv" "strings" "text/template" @@ -596,7 +597,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 +736,22 @@ 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" + + volumeFlag := gatewayDir + ":" + containerDir + ":Z" + + if isNonLinux { + networkingFlag = "-p" + networkingValue = adminPort[len(adminPort)-1] + ":" + adminPort[len(adminPort)-1] + + volumeFlag = gatewayDir + ":" + containerDir + } + containerCmd := gatewayType containerCmdArgs := []string{ "run", @@ -743,8 +760,8 @@ func (cli *VanClient) gatewayStartContainer(ctx context.Context, gatewayName str "-d", "--name", gatewayName, - "--network", - "host", + networkingFlag, + networkingValue, "-e", "SKUPPER_SITE_ID=gateway" + "_" + gatewayName + "_" + siteId, "-e", @@ -752,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(), }