diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 97733791832..1319dea7e45 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,7 +22,7 @@ updates: interval: daily open-pull-requests-limit: 10 - package-ecosystem: npm - directory: "/tests/apps/dockerfile-dokku-scale" + directory: "/tests/apps/dockerfile-app-json-formations" schedule: interval: daily open-pull-requests-limit: 10 @@ -156,7 +156,7 @@ updates: interval: daily open-pull-requests-limit: 10 - package-ecosystem: "docker" - directory: "/tests/apps/dockerfile-dokku-scale" + directory: "/tests/apps/dockerfile-app-json-formations" schedule: interval: daily open-pull-requests-limit: 10 diff --git a/docs/appendices/0.30.0-migration-guide.md b/docs/appendices/0.30.0-migration-guide.md index 72e54994233..a41b46037f4 100644 --- a/docs/appendices/0.30.0-migration-guide.md +++ b/docs/appendices/0.30.0-migration-guide.md @@ -3,3 +3,4 @@ ## Removals - Support for [SPDY](https://en.wikipedia.org/wiki/SPDY) has been removed. No major browser supports it as of 2021. Custom `nginx.conf.sigil` templates referencing spdy-related variables will continue to build until the 1.0.0 release. +- Support for the `DOKKU_SCALE` file - deprecated in 0.25.0 - has been removed in favor of the `formations` key in the `app.json` file. Please see the [process management documentation](/docs/processes/process-management.md#manually-managing-process-scaling) for more information on how to use the `formation` key of the `app.json` file. diff --git a/plugins/app-json/functions.go b/plugins/app-json/functions.go index 109ed9b7327..e47470ac38f 100644 --- a/plugins/app-json/functions.go +++ b/plugins/app-json/functions.go @@ -8,7 +8,6 @@ import ( "fmt" "io/ioutil" "os" - "path/filepath" "strconv" "strings" @@ -479,10 +478,6 @@ func refreshAppJSON(appName string, image string) error { } func setScale(appName string, image string) error { - if err := injectDokkuScale(appName, image); err != nil { - return err - } - appJSON, err := getAppJSON(appName) if err != nil { return err @@ -507,68 +502,3 @@ func setScale(appName string, image string) error { return common.PlugnTrigger("ps-set-scale", args...) } - -func injectDokkuScale(appName string, image string) error { - appJSON, err := getAppJSON(appName) - if err != nil { - return err - } - - baseDirectory := common.GetDataDirectory("app-json") - if !common.DirectoryExists(baseDirectory) { - return errors.New("Run 'dokku plugin:install' to ensure the correct directories exist") - } - - dokkuScaleFile := filepath.Join(baseDirectory, "DOKKU_SCALE") - previouslyExtracted := common.FileExists(dokkuScaleFile) - if previouslyExtracted { - os.Remove(dokkuScaleFile) - } - - common.CopyFromImage(appName, image, "DOKKU_SCALE", dokkuScaleFile) - - if !common.FileExists(dokkuScaleFile) { - return nil - } - - lines, err := common.FileToSlice(dokkuScaleFile) - if err != nil { - return err - } - - if appJSON.Formation == nil { - common.LogWarn("Deprecated: Injecting scale settings from DOKKU_SCALE file. Use the 'formation' key the app.json file to specify scaling instead of 'DOKKU_SCALE'.") - appJSON.Formation = make(map[string]Formation) - } else { - common.LogWarn("Deprecated: DOKKU_SCALE ignored in favor of 'formation' key in the app.json") - return nil - } - - for _, line := range lines { - if line == "" || strings.HasPrefix(line, "#") { - continue - } - - procParts := strings.SplitN(line, "=", 2) - if len(procParts) != 2 { - continue - } - - processType := procParts[0] - quantity, err := strconv.Atoi(procParts[1]) - if err != nil { - continue - } - - appJSON.Formation[processType] = Formation{ - Quantity: &quantity, - } - } - - b, err := json.Marshal(appJSON) - if err != nil { - return err - } - - return ioutil.WriteFile(GetAppjsonPath(appName), b, 0644) -} diff --git a/plugins/ps/triggers.go b/plugins/ps/triggers.go index 2c8baec8c1d..171d5ad5078 100644 --- a/plugins/ps/triggers.go +++ b/plugins/ps/triggers.go @@ -149,23 +149,11 @@ func TriggerInstall() error { for _, appName := range apps { dokkuScaleFile := filepath.Join(common.AppRoot(appName), "DOKKU_SCALE") if common.FileExists(dokkuScaleFile) { - processTuples, err := common.FileToSlice(dokkuScaleFile) - if err != nil { - return err - } - - if err := scaleSet(appName, true, false, processTuples); err != nil { - return err - } - os.Remove(dokkuScaleFile) } dokkuScaleExtracted := filepath.Join(common.AppRoot(appName), "DOKKU_SCALE.extracted") if common.FileExists(dokkuScaleExtracted) { - if err := common.PropertyWrite("ps", appName, "can-scale", strconv.FormatBool(false)); err != nil { - return err - } os.Remove(dokkuScaleExtracted) } } diff --git a/tests/apps/config/DOKKU_SCALE b/tests/apps/config/DOKKU_SCALE deleted file mode 100644 index 1312bef2d17..00000000000 --- a/tests/apps/config/DOKKU_SCALE +++ /dev/null @@ -1,2 +0,0 @@ -# test comment -web=1 diff --git a/tests/apps/config/app.json b/tests/apps/config/app.json new file mode 100644 index 00000000000..be4658045fb --- /dev/null +++ b/tests/apps/config/app.json @@ -0,0 +1,7 @@ +{ + "formation": { + "web": { + "quantity": 1 + } + } +} \ No newline at end of file diff --git a/tests/apps/dockerfile-dokku-scale/CHECKS b/tests/apps/dockerfile-app-json-formations/CHECKS similarity index 100% rename from tests/apps/dockerfile-dokku-scale/CHECKS rename to tests/apps/dockerfile-app-json-formations/CHECKS diff --git a/tests/apps/dockerfile-dokku-scale/Dockerfile b/tests/apps/dockerfile-app-json-formations/Dockerfile similarity index 100% rename from tests/apps/dockerfile-dokku-scale/Dockerfile rename to tests/apps/dockerfile-app-json-formations/Dockerfile diff --git a/tests/apps/dockerfile-dokku-scale/Procfile b/tests/apps/dockerfile-app-json-formations/Procfile similarity index 100% rename from tests/apps/dockerfile-dokku-scale/Procfile rename to tests/apps/dockerfile-app-json-formations/Procfile diff --git a/tests/apps/dockerfile-app-json-formations/app.json b/tests/apps/dockerfile-app-json-formations/app.json new file mode 100644 index 00000000000..be4658045fb --- /dev/null +++ b/tests/apps/dockerfile-app-json-formations/app.json @@ -0,0 +1,7 @@ +{ + "formation": { + "web": { + "quantity": 1 + } + } +} \ No newline at end of file diff --git a/tests/apps/dockerfile-dokku-scale/check_deploy b/tests/apps/dockerfile-app-json-formations/check_deploy similarity index 100% rename from tests/apps/dockerfile-dokku-scale/check_deploy rename to tests/apps/dockerfile-app-json-formations/check_deploy diff --git a/tests/apps/dockerfile-dokku-scale/package.json b/tests/apps/dockerfile-app-json-formations/package.json similarity index 100% rename from tests/apps/dockerfile-dokku-scale/package.json rename to tests/apps/dockerfile-app-json-formations/package.json diff --git a/tests/apps/dockerfile-dokku-scale/web.js b/tests/apps/dockerfile-app-json-formations/web.js similarity index 100% rename from tests/apps/dockerfile-dokku-scale/web.js rename to tests/apps/dockerfile-app-json-formations/web.js diff --git a/tests/apps/dockerfile-dokku-scale/worker.js b/tests/apps/dockerfile-app-json-formations/worker.js similarity index 100% rename from tests/apps/dockerfile-dokku-scale/worker.js rename to tests/apps/dockerfile-app-json-formations/worker.js diff --git a/tests/apps/dockerfile-dokku-scale/DOKKU_SCALE b/tests/apps/dockerfile-dokku-scale/DOKKU_SCALE deleted file mode 100644 index 3cb9829e636..00000000000 --- a/tests/apps/dockerfile-dokku-scale/DOKKU_SCALE +++ /dev/null @@ -1 +0,0 @@ -web=1 diff --git a/tests/apps/nodejs-worker/DOKKU_SCALE b/tests/apps/nodejs-worker/DOKKU_SCALE deleted file mode 100644 index 4a98d07fdab..00000000000 --- a/tests/apps/nodejs-worker/DOKKU_SCALE +++ /dev/null @@ -1,2 +0,0 @@ -web=0 -worker=1 diff --git a/tests/apps/nodejs-worker/app.json b/tests/apps/nodejs-worker/app.json new file mode 100644 index 00000000000..44dce8ca9b7 --- /dev/null +++ b/tests/apps/nodejs-worker/app.json @@ -0,0 +1,10 @@ +{ + "formation": { + "web": { + "quantity": 0 + }, + "worker": { + "quantity": 1 + } + } +} diff --git a/tests/unit/ps-dockerfile-2.bats b/tests/unit/ps-dockerfile-2.bats index 30221a1dfdd..3946efe06b7 100644 --- a/tests/unit/ps-dockerfile-2.bats +++ b/tests/unit/ps-dockerfile-2.bats @@ -12,13 +12,13 @@ teardown() { global_teardown } -@test "(ps:scale) dockerfile dokku-scale" { +@test "(ps:scale) dockerfile app-json formations" { run /bin/bash -c "dokku ps:scale $TEST_APP web=2" echo "output: $output" echo "status: $status" assert_success - deploy_app dockerfile-dokku-scale + deploy_app dockerfile-app-json-formations CIDS="" for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do CIDS+=$(<$CID_FILE)