From 724cdf3df16721fb3d0ee4d80dd5ab0b1b41fea5 Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Wed, 6 Mar 2024 08:46:42 -0700 Subject: [PATCH 1/3] build: bump docker-compose to v2.24.7 --- pkg/versionconstants/versionconstants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/versionconstants/versionconstants.go b/pkg/versionconstants/versionconstants.go index 69bb3880172..03f9581a362 100644 --- a/pkg/versionconstants/versionconstants.go +++ b/pkg/versionconstants/versionconstants.go @@ -43,4 +43,4 @@ var MutagenVersion = "" const RequiredMutagenVersion = "0.17.2" -const RequiredDockerComposeVersionDefault = "v2.24.5" +const RequiredDockerComposeVersionDefault = "v2.24.7" From eb480d79df9589cec29e232756b86d2a1f4ff556 Mon Sep 17 00:00:00 2001 From: Stanislav Zhuk Date: Mon, 11 Mar 2024 12:50:28 +0200 Subject: [PATCH 2/3] fix: new env variables structure for router yaml --- pkg/ddevapp/traefik.go | 64 +++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/pkg/ddevapp/traefik.go b/pkg/ddevapp/traefik.go index bb12fa60d3a..f7a5b07d575 100644 --- a/pkg/ddevapp/traefik.go +++ b/pkg/ddevapp/traefik.go @@ -33,33 +33,51 @@ func detectAppRouting(app *DdevApp) ([]TraefikRouting, error) { if services, ok := app.ComposeYaml["services"]; ok { for serviceName, s := range services.(map[string]interface{}) { service := s.(map[string]interface{}) - if env, ok := service["environment"].(map[string]interface{}); ok { - var virtualHost string - var ok bool - if virtualHost, ok = env["VIRTUAL_HOST"].(string); ok { - util.Debug("VIRTUAL_HOST=%v for %s", virtualHost, serviceName) - } - if virtualHost == "" { - continue - } - hostnames := strings.Split(virtualHost, ",") - if httpExpose, ok := env["HTTP_EXPOSE"].(string); ok && httpExpose != "" { - util.Debug("HTTP_EXPOSE=%v for %s", httpExpose, serviceName) - routeEntries, err := processHTTPExpose(serviceName, httpExpose, false, hostnames) - if err != nil { - return nil, err + var envMap map[string]interface{} + if envInterface, ok := service["environment"]; ok { + switch env := envInterface.(type) { + // Backward compatibility for older docker-compose + case map[string]interface{}: + envMap = env + // The config structure changed in docker-compose v2.24.7 + // See https://github.com/docker/compose/issues/11589 + case []interface{}: + envMap = make(map[string]interface{}) + for _, val := range env { + if str, ok := val.(string); ok { + parts := strings.SplitN(str, "=", 2) + if len(parts) == 2 { + envMap[parts[0]] = parts[1] + } + } } - table = append(table, routeEntries...) } + } + var virtualHost string + var ok bool + if virtualHost, ok = envMap["VIRTUAL_HOST"].(string); ok { + util.Debug("VIRTUAL_HOST=%v for %s", virtualHost, serviceName) + } + if virtualHost == "" { + continue + } + hostnames := strings.Split(virtualHost, ",") + if httpExpose, ok := envMap["HTTP_EXPOSE"].(string); ok && httpExpose != "" { + util.Debug("HTTP_EXPOSE=%v for %s", httpExpose, serviceName) + routeEntries, err := processHTTPExpose(serviceName, httpExpose, false, hostnames) + if err != nil { + return nil, err + } + table = append(table, routeEntries...) + } - if httpsExpose, ok := env["HTTPS_EXPOSE"].(string); ok && httpsExpose != "" { - util.Debug("HTTPS_EXPOSE=%v for %s", httpsExpose, serviceName) - routeEntries, err := processHTTPExpose(serviceName, httpsExpose, true, hostnames) - if err != nil { - return nil, err - } - table = append(table, routeEntries...) + if httpsExpose, ok := envMap["HTTPS_EXPOSE"].(string); ok && httpsExpose != "" { + util.Debug("HTTPS_EXPOSE=%v for %s", httpsExpose, serviceName) + routeEntries, err := processHTTPExpose(serviceName, httpsExpose, true, hostnames) + if err != nil { + return nil, err } + table = append(table, routeEntries...) } } } From 695e963dcd0cce7c96e178e49c8325e7f3dd4a36 Mon Sep 17 00:00:00 2001 From: Stanislav Zhuk Date: Fri, 15 Mar 2024 15:11:06 +0200 Subject: [PATCH 3/3] build: bump docker-compose to v2.25.0 --- pkg/ddevapp/traefik.go | 64 +++++++++--------------- pkg/versionconstants/versionconstants.go | 2 +- 2 files changed, 24 insertions(+), 42 deletions(-) diff --git a/pkg/ddevapp/traefik.go b/pkg/ddevapp/traefik.go index f7a5b07d575..bb12fa60d3a 100644 --- a/pkg/ddevapp/traefik.go +++ b/pkg/ddevapp/traefik.go @@ -33,51 +33,33 @@ func detectAppRouting(app *DdevApp) ([]TraefikRouting, error) { if services, ok := app.ComposeYaml["services"]; ok { for serviceName, s := range services.(map[string]interface{}) { service := s.(map[string]interface{}) - var envMap map[string]interface{} - if envInterface, ok := service["environment"]; ok { - switch env := envInterface.(type) { - // Backward compatibility for older docker-compose - case map[string]interface{}: - envMap = env - // The config structure changed in docker-compose v2.24.7 - // See https://github.com/docker/compose/issues/11589 - case []interface{}: - envMap = make(map[string]interface{}) - for _, val := range env { - if str, ok := val.(string); ok { - parts := strings.SplitN(str, "=", 2) - if len(parts) == 2 { - envMap[parts[0]] = parts[1] - } - } - } + if env, ok := service["environment"].(map[string]interface{}); ok { + var virtualHost string + var ok bool + if virtualHost, ok = env["VIRTUAL_HOST"].(string); ok { + util.Debug("VIRTUAL_HOST=%v for %s", virtualHost, serviceName) } - } - var virtualHost string - var ok bool - if virtualHost, ok = envMap["VIRTUAL_HOST"].(string); ok { - util.Debug("VIRTUAL_HOST=%v for %s", virtualHost, serviceName) - } - if virtualHost == "" { - continue - } - hostnames := strings.Split(virtualHost, ",") - if httpExpose, ok := envMap["HTTP_EXPOSE"].(string); ok && httpExpose != "" { - util.Debug("HTTP_EXPOSE=%v for %s", httpExpose, serviceName) - routeEntries, err := processHTTPExpose(serviceName, httpExpose, false, hostnames) - if err != nil { - return nil, err + if virtualHost == "" { + continue + } + hostnames := strings.Split(virtualHost, ",") + if httpExpose, ok := env["HTTP_EXPOSE"].(string); ok && httpExpose != "" { + util.Debug("HTTP_EXPOSE=%v for %s", httpExpose, serviceName) + routeEntries, err := processHTTPExpose(serviceName, httpExpose, false, hostnames) + if err != nil { + return nil, err + } + table = append(table, routeEntries...) } - table = append(table, routeEntries...) - } - if httpsExpose, ok := envMap["HTTPS_EXPOSE"].(string); ok && httpsExpose != "" { - util.Debug("HTTPS_EXPOSE=%v for %s", httpsExpose, serviceName) - routeEntries, err := processHTTPExpose(serviceName, httpsExpose, true, hostnames) - if err != nil { - return nil, err + if httpsExpose, ok := env["HTTPS_EXPOSE"].(string); ok && httpsExpose != "" { + util.Debug("HTTPS_EXPOSE=%v for %s", httpsExpose, serviceName) + routeEntries, err := processHTTPExpose(serviceName, httpsExpose, true, hostnames) + if err != nil { + return nil, err + } + table = append(table, routeEntries...) } - table = append(table, routeEntries...) } } } diff --git a/pkg/versionconstants/versionconstants.go b/pkg/versionconstants/versionconstants.go index 03f9581a362..b22fae19b6a 100644 --- a/pkg/versionconstants/versionconstants.go +++ b/pkg/versionconstants/versionconstants.go @@ -43,4 +43,4 @@ var MutagenVersion = "" const RequiredMutagenVersion = "0.17.2" -const RequiredDockerComposeVersionDefault = "v2.24.7" +const RequiredDockerComposeVersionDefault = "v2.25.0"