fix: move proxy-port properties to proxy plugin and fix CI failures

- Move proxy-port and proxy-ssl-port properties from ports plugin to
  proxy plugin where they conceptually belong
- Generalize proxy:set to handle any property (matching ps:set pattern)
  instead of only handling the type property
- Fix apps:set --global flag parsing (pflag treats --global as a flag,
  not an argument — must be defined explicitly like ps:set does)
- Add missing property-functions source to scheduler-docker-local
  shell scripts (scheduler-enter, scheduler-run, scheduler-deploy,
  check-deploy, bin/scheduler-deploy-process-container)
- Update nginx-vhosts property references from ports to proxy plugin
- Update tests to use proxy:set for proxy-port properties
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-04-25 17:19:42 -04:00
1 parent 24f460f5d3
commit 915172c0c5
19 files changed
+57 -69

No files matched your search

+2 -2
View File
@@ -122,8 +122,8 @@ The following environment variables have been migrated to plugin properties. Exi
| `DOKKU_DISABLE_PROXY` | `dokku proxy:disable <app>` / `dokku proxy:enable <app>` | | `DOKKU_DISABLE_PROXY` | `dokku proxy:disable <app>` / `dokku proxy:enable <app>` |
| `DOKKU_DOCKERFILE_START_CMD` | `dokku ps:set <app> dockerfile-start-cmd <value>` | | `DOKKU_DOCKERFILE_START_CMD` | `dokku ps:set <app> dockerfile-start-cmd <value>` |
| `DOKKU_PARALLEL_ARGUMENTS` | Removed. No longer supported. | | `DOKKU_PARALLEL_ARGUMENTS` | Removed. No longer supported. |
| `DOKKU_PROXY_PORT` | `dokku ports:set <app> proxy-port <value>` | | `DOKKU_PROXY_PORT` | `dokku proxy:set <app> proxy-port <value>` |
| `DOKKU_PROXY_SSL_PORT` | `dokku ports:set <app> proxy-ssl-port <value>` | | `DOKKU_PROXY_SSL_PORT` | `dokku proxy:set <app> proxy-ssl-port <value>` |
| `DOKKU_SKIP_ALL_CHECKS` | `dokku checks:disable <app>` | | `DOKKU_SKIP_ALL_CHECKS` | `dokku checks:disable <app>` |
| `DOKKU_SKIP_CLEANUP` | `dokku builder:set <app> skip-cleanup <true\|false>` | | `DOKKU_SKIP_CLEANUP` | `dokku builder:set <app> skip-cleanup <true\|false>` |
| `DOKKU_SKIP_DEFAULT_CHECKS` | `dokku checks:skip <app>` | | `DOKKU_SKIP_DEFAULT_CHECKS` | `dokku checks:skip <app>` |
@@ -74,10 +74,16 @@ func main() {
} }
case "set": case "set":
args := flag.NewFlagSet("apps:set", flag.ExitOnError) args := flag.NewFlagSet("apps:set", flag.ExitOnError)
global := args.Bool("global", false, "--global: set a global property")
args.Parse(os.Args[2:]) args.Parse(os.Args[2:])
appName := args.Arg(0) appName := args.Arg(0)
property := args.Arg(1) property := args.Arg(1)
value := args.Arg(2) value := args.Arg(2)
if *global {
appName = "--global"
property = args.Arg(0)
value = args.Arg(1)
}
err = apps.CommandSet(appName, property, value) err = apps.CommandSet(appName, property, value)
case "unlock": case "unlock":
args := flag.NewFlagSet("apps:unlock", flag.ExitOnError) args := flag.NewFlagSet("apps:unlock", flag.ExitOnError)
+2 -2
View File
@@ -7,8 +7,8 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions" source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
fn-nginx-vhosts-migrate-env-vars() { fn-nginx-vhosts-migrate-env-vars() {
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property ports proxy-port DOKKU_NGINX_PORT "$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property proxy proxy-port DOKKU_NGINX_PORT
"$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property ports proxy-ssl-port DOKKU_NGINX_SSL_PORT "$PLUGIN_CORE_AVAILABLE_PATH/common/prop" migrate-config-to-property proxy proxy-ssl-port DOKKU_NGINX_SSL_PORT
} }
fn-nginx-vhosts-migrate-nginx-conf-sigil() { fn-nginx-vhosts-migrate-nginx-conf-sigil() {
+2 -2
View File
@@ -18,10 +18,10 @@ trigger-nginx-vhosts-pre-disable-vhost() {
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port") local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
if [[ "$PROXY_PORT" == "80" ]]; then if [[ "$PROXY_PORT" == "80" ]]; then
fn-plugin-property-delete "ports" "$APP" "proxy-port" fn-plugin-property-delete "proxy" "$APP" "proxy-port"
fi fi
if [[ "$PROXY_SSL_PORT" == "443" ]]; then if [[ "$PROXY_SSL_PORT" == "443" ]]; then
fn-plugin-property-delete "ports" "$APP" "proxy-ssl-port" fn-plugin-property-delete "proxy" "$APP" "proxy-ssl-port"
fi fi
# clear ports if there is a mapping starting with http:80 or https:443 # clear ports if there is a mapping starting with http:80 or https:443
+2 -2
View File
@@ -18,10 +18,10 @@ trigger-nginx-vhosts-pre-enable-vhost() {
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port") local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
if [[ "$PROXY_PORT" == "80" ]]; then if [[ "$PROXY_PORT" == "80" ]]; then
fn-plugin-property-delete "ports" "$APP" "proxy-port" fn-plugin-property-delete "proxy" "$APP" "proxy-port"
fi fi
if [[ "$PROXY_SSL_PORT" == "443" ]]; then if [[ "$PROXY_SSL_PORT" == "443" ]]; then
fn-plugin-property-delete "ports" "$APP" "proxy-ssl-port" fn-plugin-property-delete "proxy" "$APP" "proxy-ssl-port"
fi fi
# clear ports if there is a mapping starting with http:80 or https:443 # clear ports if there is a mapping starting with http:80 or https:443
+6 -6
View File
@@ -161,7 +161,7 @@ func getDetectedPortMaps(appName string) []PortMap {
// getGlobalProxyPort gets the global proxy port // getGlobalProxyPort gets the global proxy port
func getGlobalProxyPort() int { func getGlobalProxyPort() int {
port := 0 port := 0
value := common.PropertyGet("ports", "--global", "proxy-port") value := common.PropertyGet("proxy", "--global", "proxy-port")
if intVar, err := strconv.Atoi(value); err == nil { if intVar, err := strconv.Atoi(value); err == nil {
port = intVar port = intVar
} }
@@ -172,7 +172,7 @@ func getGlobalProxyPort() int {
// getGlobalProxySSLPort gets the global proxy ssl port // getGlobalProxySSLPort gets the global proxy ssl port
func getGlobalProxySSLPort() int { func getGlobalProxySSLPort() int {
port := 0 port := 0
value := common.PropertyGet("ports", "--global", "proxy-ssl-port") value := common.PropertyGet("proxy", "--global", "proxy-ssl-port")
if intVar, err := strconv.Atoi(value); err == nil { if intVar, err := strconv.Atoi(value); err == nil {
port = intVar port = intVar
} }
@@ -194,7 +194,7 @@ func getPortMaps(appName string) []PortMap {
// getProxyPort gets the proxy port for an app // getProxyPort gets the proxy port for an app
func getProxyPort(appName string) int { func getProxyPort(appName string) int {
port := 0 port := 0
value := common.PropertyGet("ports", appName, "proxy-port") value := common.PropertyGet("proxy", appName, "proxy-port")
if intVar, err := strconv.Atoi(value); err == nil { if intVar, err := strconv.Atoi(value); err == nil {
port = intVar port = intVar
} }
@@ -205,7 +205,7 @@ func getProxyPort(appName string) int {
// getProxySSLPort gets the proxy ssl port for an app // getProxySSLPort gets the proxy ssl port for an app
func getProxySSLPort(appName string) int { func getProxySSLPort(appName string) int {
port := 0 port := 0
value := common.PropertyGet("ports", appName, "proxy-ssl-port") value := common.PropertyGet("proxy", appName, "proxy-ssl-port")
if intVar, err := strconv.Atoi(value); err == nil { if intVar, err := strconv.Atoi(value); err == nil {
port = intVar port = intVar
} }
@@ -432,12 +432,12 @@ func setPortMaps(appName string, portMaps []PortMap) error {
// setProxyPort sets the proxy port for an app // setProxyPort sets the proxy port for an app
func setProxyPort(appName string, port int) error { func setProxyPort(appName string, port int) error {
return common.PropertyWrite("ports", appName, "proxy-port", fmt.Sprint(port)) return common.PropertyWrite("proxy", appName, "proxy-port", fmt.Sprint(port))
} }
// setProxySSLPort sets the proxy ssl port for an app // setProxySSLPort sets the proxy ssl port for an app
func setProxySSLPort(appName string, port int) error { func setProxySSLPort(appName string, port int) error {
return common.PropertyWrite("ports", appName, "proxy-ssl-port", fmt.Sprint(port)) return common.PropertyWrite("proxy", appName, "proxy-ssl-port", fmt.Sprint(port))
} }
// transformPortMap normalizes a port map string for migration to list properties // transformPortMap normalizes a port map string for migration to list properties
-13
View File
@@ -4,19 +4,6 @@ import (
"fmt" "fmt"
) )
var (
// DefaultProperties is a map of all valid ports properties with corresponding default property values
DefaultProperties = map[string]string{
"proxy-port": "",
"proxy-ssl-port": "",
}
// GlobalProperties is a map of all valid global ports properties
GlobalProperties = map[string]bool{
"proxy-port": true,
"proxy-ssl-port": true,
}
)
// PortMap is a struct that contains a scheme:host-port:container-port mapping // PortMap is a struct that contains a scheme:host-port:container-port mapping
type PortMap struct { type PortMap struct {
+5 -15
View File
@@ -21,16 +21,6 @@ func TriggerInstall() error {
ListProperty: true, ListProperty: true,
Transform: transformPortMap, Transform: transformPortMap,
}, },
{
ConfigVar: "DOKKU_PROXY_PORT",
GlobalConfigVar: "DOKKU_PROXY_PORT",
Property: "proxy-port",
},
{
ConfigVar: "DOKKU_PROXY_SSL_PORT",
GlobalConfigVar: "DOKKU_PROXY_SSL_PORT",
Property: "proxy-ssl-port",
},
}); err != nil { }); err != nil {
return err return err
} }
@@ -166,7 +156,7 @@ func TriggerPostAppRenameSetup(oldAppName string, newAppName string) error {
// TriggerPostCertsRemove unsets port properties after SSL cert is removed // TriggerPostCertsRemove unsets port properties after SSL cert is removed
func TriggerPostCertsRemove(appName string) error { func TriggerPostCertsRemove(appName string) error {
if err := common.PropertyDelete("ports", appName, "proxy-ssl-port"); err != nil { if err := common.PropertyDelete("proxy", appName, "proxy-ssl-port"); err != nil {
return err return err
} }
@@ -175,15 +165,15 @@ func TriggerPostCertsRemove(appName string) error {
// TriggerPostCertsUpdate sets port properties after SSL cert is added // TriggerPostCertsUpdate sets port properties after SSL cert is added
func TriggerPostCertsUpdate(appName string) error { func TriggerPostCertsUpdate(appName string) error {
port := common.PropertyGet("ports", appName, "proxy-port") port := common.PropertyGet("proxy", appName, "proxy-port")
sslPort := common.PropertyGet("ports", appName, "proxy-ssl-port") sslPort := common.PropertyGet("proxy", appName, "proxy-ssl-port")
portMaps := getPortMaps(appName) portMaps := getPortMaps(appName)
if port == "80" { if port == "80" {
common.PropertyDelete("ports", appName, "proxy-port") common.PropertyDelete("proxy", appName, "proxy-port")
} }
if sslPort == "443" { if sslPort == "443" {
common.PropertyDelete("ports", appName, "proxy-ssl-port") common.PropertyDelete("proxy", appName, "proxy-ssl-port")
} }
var http80Ports []PortMap var http80Ports []PortMap
+7 -3
View File
@@ -11,13 +11,17 @@ const RunInSerial = 0
var ( var (
// DefaultProperties is a map of all valid proxy properties with corresponding default property values // DefaultProperties is a map of all valid proxy properties with corresponding default property values
DefaultProperties = map[string]string{ DefaultProperties = map[string]string{
"disabled": "false", "disabled": "false",
"type": "", "proxy-port": "",
"proxy-ssl-port": "",
"type": "",
} }
// GlobalProperties is a map of all valid global proxy properties // GlobalProperties is a map of all valid global proxy properties
GlobalProperties = map[string]bool{ GlobalProperties = map[string]bool{
"type": true, "proxy-port": true,
"proxy-ssl-port": true,
"type": true,
} }
) )
+5 -3
View File
@@ -59,12 +59,14 @@ func main() {
global := args.Bool("global", false, "--global: set a global property") global := args.Bool("global", false, "--global: set a global property")
args.Parse(os.Args[2:]) args.Parse(os.Args[2:])
appName := args.Arg(0) appName := args.Arg(0)
proxyType := args.Arg(1) property := args.Arg(1)
value := args.Arg(2)
if *global { if *global {
appName = "--global" appName = "--global"
proxyType = args.Arg(0) property = args.Arg(0)
value = args.Arg(1)
} }
err = proxy.CommandSet(appName, proxyType) err = proxy.CommandSet(appName, property, value)
default: default:
err = fmt.Errorf("Invalid plugin subcommand call: %s", subcommand) err = fmt.Errorf("Invalid plugin subcommand call: %s", subcommand)
} }
+2 -18
View File
@@ -2,7 +2,6 @@ package proxy
import ( import (
"errors" "errors"
"strings"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
@@ -82,22 +81,7 @@ func CommandReport(appName string, format string, infoFlag string) error {
} }
// CommandSet sets a proxy for an app // CommandSet sets a proxy for an app
func CommandSet(appName string, proxyType string) error { func CommandSet(appName string, property string, value string) error {
if appName != "--global" { common.CommandPropertySet("proxy", appName, property, value, DefaultProperties, GlobalProperties)
if err := common.VerifyAppName(appName); err != nil {
return err
}
}
if len(proxyType) < 2 {
return errors.New("Please specify a proxy type")
}
if strings.Contains(proxyType, ":") {
common.LogWarn("Detected potential port mapping instead of proxy type")
return errors.New("Consider using ports:set command or specifying a valid proxy")
}
common.CommandPropertySet("proxy", appName, "type", proxyType, DefaultProperties, GlobalProperties)
return nil return nil
} }
+10
View File
@@ -28,6 +28,16 @@ func TriggerInstall() error {
return value return value
}, },
}, },
{
ConfigVar: "DOKKU_PROXY_PORT",
GlobalConfigVar: "DOKKU_PROXY_PORT",
Property: "proxy-port",
},
{
ConfigVar: "DOKKU_PROXY_SSL_PORT",
GlobalConfigVar: "DOKKU_PROXY_SSL_PORT",
Property: "proxy-ssl-port",
},
}); err != nil { }); err != nil {
return err return err
} }
@@ -2,6 +2,7 @@
set -eo pipefail set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions" source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
main() { main() {
@@ -36,6 +36,7 @@
set -eo pipefail set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions" source "$PLUGIN_AVAILABLE_PATH/checks/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions" source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
@@ -2,6 +2,7 @@
set -eo pipefail set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions" source "$PLUGIN_AVAILABLE_PATH/checks/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions" source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
set -eo pipefail set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x [[ $DOKKU_TRACE ]] && set -x
@@ -2,6 +2,7 @@
set -eo pipefail set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions" source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
+1 -1
View File
@@ -116,7 +116,7 @@ teardown() {
echo "output: $output" echo "output: $output"
echo "status: $status" echo "status: $status"
assert_success assert_success
run /bin/bash -c "$PLUGIN_CORE_AVAILABLE_PATH/common/prop set ports $TEST_APP proxy-ssl-port 443" run /bin/bash -c "dokku proxy:set $TEST_APP proxy-ssl-port 443"
echo "output: $output" echo "output: $output"
echo "status: $status" echo "status: $status"
assert_success assert_success
+2 -2
View File
@@ -62,7 +62,7 @@ teardown() {
@test "(nginx-vhosts) proxy:build-config (global proxy-port)" { @test "(nginx-vhosts) proxy:build-config (global proxy-port)" {
local GLOBAL_PORT=30999 local GLOBAL_PORT=30999
run /bin/bash -c "$PLUGIN_CORE_AVAILABLE_PATH/common/prop set ports --global proxy-port ${GLOBAL_PORT}" run /bin/bash -c "dokku proxy:set --global proxy-port ${GLOBAL_PORT}"
echo "output: $output" echo "output: $output"
echo "status: $status" echo "status: $status"
assert_success assert_success
@@ -74,7 +74,7 @@ teardown() {
check_urls "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}" check_urls "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}"
assert_http_success "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}" assert_http_success "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}"
run /bin/bash -c "$PLUGIN_CORE_AVAILABLE_PATH/common/prop del ports --global proxy-port" run /bin/bash -c "dokku proxy:set --global proxy-port"
echo "output: $output" echo "output: $output"
echo "status: $status" echo "status: $status"
assert_success assert_success