feat: migrate environment variables to plugin properties

Standardize how environment variables are migrated to properties during
install triggers and migrate all remaining DOKKU_* config vars to their
appropriate plugin properties.

Adds a reusable MigrateConfigToProperties() function in the common
package with Transform callback and ListProperty support, plus a
migrate-config-to-property subcommand for the prop binary so shell
plugins can use the same code path.

Migrated variables and their new property owners:
- DOKKU_APP_PROXY_TYPE/DOKKU_PROXY_TYPE → proxy type
- DOKKU_DISABLE_PROXY → proxy disabled
- DOKKU_PROXY_PORT → ports proxy-port
- DOKKU_PROXY_SSL_PORT → ports proxy-ssl-port
- DOKKU_APP_RESTORE → ps restore
- DOKKU_SKIP_DEPLOY → ps skip-deploy
- DOKKU_START_CMD → ps start-cmd
- DOKKU_DOCKERFILE_START_CMD → ps dockerfile-start-cmd
- DOKKU_DISABLE_APP_AUTOCREATION → apps disable-autocreation
- DOKKU_APP_SHELL → scheduler shell
- DOKKU_SKIP_CLEANUP → builder skip-cleanup
- DOKKU_CHECKS_DISABLED → checks disabled
- DOKKU_CHECKS_SKIPPED → checks skipped
- DOKKU_CHECKS_WAIT → checks wait
- DOKKU_CHECKS_TIMEOUT → checks timeout
- DOKKU_CHECKS_ATTEMPTS → checks attempts
- DOKKU_DEFAULT_CHECKS_WAIT → checks default-wait
- DOKKU_SKIP_ALL_CHECKS → checks disabled (legacy)
- DOKKU_SKIP_DEFAULT_CHECKS → checks skipped (legacy)

Also refactors existing bespoke migration loops in scheduler, ports, ps,
builder, and nginx-vhosts plugins to use the standardized utility.

Removes DOKKU_PARALLEL_ARGUMENTS from documentation (unused in core).
Deprecates fn-migrate-config-to-property bash function.

closes #1558
This commit is contained in:
Jose Diaz-Gonzalez
2026-04-25 05:11:07 -04:00
parent 71ec612fbd
commit 1308e21947
45 changed files with 604 additions and 468 deletions

View File

@@ -4,10 +4,12 @@ var (
// DefaultProperties is a map of all valid scheduler properties with corresponding default property values
DefaultProperties = map[string]string{
"selected": "docker-local",
"shell": "",
}
// GlobalProperties is a map of all valid global scheduler properties
GlobalProperties = map[string]bool{
"selected": true,
"shell": true,
}
)

View File

@@ -1,7 +1,6 @@
package scheduler
import (
"errors"
"fmt"
"github.com/dokku/dokku/plugins/common"
@@ -31,53 +30,19 @@ func TriggerInstall() error {
return fmt.Errorf("Unable to install the scheduler plugin: %s", err.Error())
}
apps, err := common.UnfilteredDokkuApps()
if err != nil && !errors.Is(err, common.NoAppsExist) {
return nil
}
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "config-get-global",
Args: []string{"DOKKU_SCHEDULER"},
})
globalScheduler := results.StdoutContents()
if globalScheduler != "" {
common.LogVerboseQuiet(fmt.Sprintf("Setting scheduler property 'selected' to %v", globalScheduler))
if err := common.PropertyWrite("scheduler", "--global", "selected", globalScheduler); err != nil {
return err
}
_, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "config-unset",
Args: []string{"--global", "DOKKU_SCHEDULER"},
})
if err != nil {
common.LogWarn(err.Error())
}
}
for _, appName := range apps {
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "config-get",
Args: []string{appName, "DOKKU_SCHEDULER"},
})
scheduler := results.StdoutContents()
if scheduler == "" {
continue
}
common.LogVerboseQuiet(fmt.Sprintf("Setting %s scheduler property 'selected' to %v", appName, scheduler))
if err := common.PropertyWrite("scheduler", appName, "selected", scheduler); err != nil {
return err
}
_, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "config-unset",
Args: []string{appName, "DOKKU_SCHEDULER"},
})
if err != nil {
common.LogWarn(err.Error())
}
if err := common.MigrateConfigToProperties("scheduler", []common.MigrateConfigEntry{
{
ConfigVar: "DOKKU_SCHEDULER",
GlobalConfigVar: "DOKKU_SCHEDULER",
Property: "selected",
},
{
ConfigVar: "DOKKU_APP_SHELL",
GlobalConfigVar: "DOKKU_APP_SHELL",
Property: "shell",
},
}); err != nil {
return err
}
return nil