这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/appendices/0.30.0-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
70 changes: 0 additions & 70 deletions plugins/app-json/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"

Expand Down Expand Up @@ -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
Expand All @@ -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)
}
12 changes: 0 additions & 12 deletions plugins/ps/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 0 additions & 2 deletions tests/apps/config/DOKKU_SCALE

This file was deleted.

7 changes: 7 additions & 0 deletions tests/apps/config/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"formation": {
"web": {
"quantity": 1
}
}
}
7 changes: 7 additions & 0 deletions tests/apps/dockerfile-app-json-formations/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"formation": {
"web": {
"quantity": 1
}
}
}
1 change: 0 additions & 1 deletion tests/apps/dockerfile-dokku-scale/DOKKU_SCALE

This file was deleted.

2 changes: 0 additions & 2 deletions tests/apps/nodejs-worker/DOKKU_SCALE

This file was deleted.

10 changes: 10 additions & 0 deletions tests/apps/nodejs-worker/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"formation": {
"web": {
"quantity": 0
},
"worker": {
"quantity": 1
}
}
}
4 changes: 2 additions & 2 deletions tests/unit/ps-dockerfile-2.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down