Commit Graph
46 Commits
Author SHA1 Message Date
Jose Diaz-Gonzalez ffa2991abf fix: reject negative process counts when scaling
A process count below zero was accepted and stored verbatim, leaving the scheduler to reject the value long after the command reported success. Counts below zero are now rejected, as are process tuples that omit a process type, across `ps:scale`, the `ps-set-scale` trigger and the `formation` key of `app.json`. A negative count persisted by an earlier version stays readable so it can be corrected with `ps:scale`.
2026-09-18 02:50:34 -04:00
Jose Diaz-Gonzalez db45f8608b feat: add --clear and --replace flags to ps:scale
The `ps:scale` command merges the specified process types into the existing formation, so replacing an entire formation from the CLI required reading the current scale, diffing it, and issuing a second call to zero out each unlisted process type. The `--replace` flag treats the specified process types as the whole formation and sets the process count for every unspecified process type to zero, while the `--clear` flag resets the formation to the scale a newly created app has. The two flags cannot be combined, `--replace` requires at least one process type, and `--clear` accepts none. Process types cleared this way are now scaled down as part of the same command rather than being left running with a stale formation.
2026-09-02 14:55:16 -04:00
Jose Diaz-Gonzalez 857d115fdd feat: add --format json support to ps:scale
The `ps:scale` command now accepts a `--format` flag that defaults to `stdout` and can be set to `json` to emit the current formation as a JSON array of process type and quantity objects, matching the JSON output the `:report` subcommands already provide. The flag only applies when displaying the current formation; it is ignored when process types are supplied for scaling. When no scale has been set for the app, the JSON output is an empty array.
2026-07-06 13:57:19 -04:00
Jose Diaz-Gonzalez 9d711cbb44 fix: expand variables for release tasks
Procfile commands need to be expanded with actual environment variables as procfile-util will otherwise empty them out. This doesn't happen for app.json scripts as they are never expanded until the docker container gets created.

Closes #8050
2025-10-19 23:33:12 -04:00
Jose Diaz-Gonzalez 1eb41f32dc feat: only redeploy formations that have had their values changed
Rather than redeploy every formation, only deploy formations that have had their values changed from the defaults.

This still doesn't handle the case where we touch existing processes when scaling _up_, but should decrease the number of services touched otherwise during scaling.

Also note that there are no tests for this new behavior yet (tests incoming).

Refs #7396
2025-06-23 04:42:09 -04:00
Jose Diaz-Gonzalez bb5ab0a777 refactor: use CallPlugnTrigger instead of PlugnTrigger
Refs #6422
2024-03-14 03:11:37 -04:00
Jose Diaz-Gonzalez cdff4ae867 refactor: use CallPlugnTrigger instead of PlugnTriggerOutput
Refs #6422
2024-03-14 01:18:28 -04:00
Jose Diaz-Gonzalez 44dd933638 refactor: remove all calls to common.NewShellCmd
At this point, the only usage of go-sh should be by plugin trigger calls.
2024-02-13 01:09:24 -05:00
Jose Diaz-Gonzalez 31abd7e31e chore: always sort returned formations 2024-02-11 21:12:25 -05:00
Jose Diaz-Gonzalez 0102d219f3 refactor: do not ever return duplicate entries when getting formations 2024-02-11 21:12:15 -05:00
Jose Diaz-Gonzalez 701f18a69c fix: ensure splitting only ever returns at most two parts 2024-02-11 21:11:40 -05:00
Jose Diaz-Gonzalez 66f46de2fd fix: ensure each entry in a process type has whitespace removed 2024-02-11 21:06:28 -05:00
Jose Diaz-Gonzalez ab1f8bfd30 chore: remove unused code in ps plugin 2024-02-11 21:03:50 -05:00
Jose Diaz-Gonzalez 173434ef34 chore: reorder functions 2023-02-14 03:08:02 -05:00
Jose Diaz-Gonzalez a53ead6c64 chore: rename function 2023-02-14 03:08:02 -05:00
Jose Diaz-Gonzalez 6cbe93c245 refactor: move all golang code for managing data directories to common plugin
Additionally, ensure the golang plugins handle setup/teardown of plugin and app-specific data directories during install, rename, and clone phases.
2023-01-08 23:36:12 -05:00
josegonzalez 30887d74fc chore: drop debugging code from ps plugin
This was accidentally added in a refactor of how processes are managed.
2022-12-28 23:50:39 -05:00
Jose Diaz-Gonzalez e458c8e4a6 fix: keep track of old scale values for a single deploy
This will ensure we scale things down after usage.
2022-11-27 15:02:45 -05:00
Jose Diaz-Gonzalez 55ca8e3d52 chore: drop debug calls 2022-11-25 14:50:35 -05:00
Jose Diaz-Gonzalez fe4d80a82b refactor: cleanup zero'd out processes when a Procfile omitting those process types is set
This change also moves the referenced Procfile out to a host path once on deploy vs potentially several times, which should speed up deploys a small amount and simplify reasoning about the file.

Closes #5112
2022-11-25 14:50:35 -05:00
Jose Diaz-Gonzalez 3b0bf4d8f2 feat: use --all flag for clearing proxy config during ps:restore
Without this, we might end up with one or more apps that still have a proxy config.
2022-01-28 20:58:31 -05:00
Jose Diaz-Gonzalez b48b79f5ca feat: allow specifying a single process type to restart
This changes restarts to drop the 'release' part that currently gets triggered, which also helps reduce the possibility that a new image layer will be added due to predeploy deploy triggers.

Note that the old method essentially halfway-rebuilt the app (which was what added the extra layer). This refactor removes that, which is a bc-break.

Additionally, scaling processes will result in deploying _only_ restarting the processes being scaled.

Closes #2184
2021-10-09 18:46:17 -04:00
Jose Diaz-Gonzalez 06cb7a0d55 fix: properly update formations 2021-08-01 19:06:33 -04:00
Jose Diaz-Gonzalez 401683a305 refactor: write DOKKU_SCALE contents to scale property
- remove extraction of DOKKU_SCALE
- migrate to property system
- rewrite internals to use a FormationSlice instead of a map
2021-08-01 17:47:04 -04:00
Jose Diaz-Gonzalez bd4621070c feat: implement ps-can-scale 2021-08-01 16:27:13 -04:00
Jose Diaz-Gonzalez ef262c26e8 feat: override all existing scale parameters when calling ps-set-scale 2021-08-01 16:20:19 -04:00
Jose Diaz-Gonzalez 247698fea6 refactor: move can-scale check out to command
If the internals call ps-set-scale, we should always respect it.
2021-08-01 16:07:55 -04:00
Jose Diaz-Gonzalez 302537efd2 refactor: skip image fetching when deploys are skipped 2021-08-01 16:07:26 -04:00
Jose Diaz-Gonzalez c62bff3002 refactor: hide dokku scale file parsing inside ps plugin 2021-08-01 01:21:46 -04:00
Jose Diaz-Gonzalez 9d0bc930a6 fix: handle empty lines and comments in DOKKU_SCALE file 2021-07-31 20:54:14 -04:00
Jose Diaz-Gonzalez fceb412fb1 fix: reference extracted Procfile
Rather than attempting to always extract the Procfile, reference the one that was extracted by the last deploy. This fixes issues where 'docker container cp' may fail intermittently for lord knows what reason.

Closes #4083
2020-11-22 17:14:18 -05:00
Jose Diaz-Gonzalez ae1b1c7274 chore: move function to internal 2020-11-21 21:07:20 -05:00
Jose Diaz-Gonzalez 1b50b4ab0a fix: ensure the scale file has correct processes when it exists 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez bc9a60f696 feat: switch to updateScalefile from generateScalefile
The process is the same.
2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez 44ce5c76ae fix: move log message to correct location 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez 702e9cf66c fix: zero out entries that don't exist in the scale file 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez f13ee16ab8 feat: add support for process state in ps:report output 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez 82f13af166 chore: return early 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez 23ad4bb230 refactor: add ability to skip deploys and fix process scaling 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez 0a533c754f refactor: split ps:scale func into different functions 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez e8d0965a33 feat: implement all of ps:report 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez db435c40e5 fix: do not delete the destination scale file if it was not extracted previously 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez bf84405b43 fix: handle scaling properly when there is no procfile 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez 833a64cc0e fix: check if it can scale by checking for an extracted file 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez a93f504d45 chore: short-circuit procfile command fetching if there is no procfile 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez e7ee7a1781 refactor: implement most of ps plugin in golang 2020-11-21 20:57:33 -05:00