Commit Graph

107 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
f202072220 fix: ensure the destination directory exists when extracting files from a repository
Closes #8272
2026-01-09 23:58:52 -05:00
Jose Diaz-Gonzalez
1c6927b25e fix: directly write deployed property
The previous method ended up validating the app name when checking if the app was deployed or not, which isn't necessary as that should only be performed at the command-level.
2025-09-14 05:08:23 -04:00
Jose Diaz-Gonzalez
7e748a1cf3 fix: do not list folders in Dokku root that start with an upper-case character
These were never valid app names, so we can avoid listing them altogether as they aren't Dokku apps.
2025-09-14 05:04:27 -04:00
Jose Diaz-Gonzalez
577f46153f refactor: use helper go functions to handle extracting files from a repository
This standardizes the extraction code and makes it easier to reuse in future implementations of file extraction.

Additionally, this adds a way to extract folders from codebases.
2025-07-23 18:16:16 -04:00
Jose Diaz-Gonzalez
2c30c03ef7 fix: non-constant format string in call to fmt.Printf 2025-07-08 21:28:57 -04:00
Jose Diaz-Gonzalez
e1af6ad1f9 fix: ensure all report subcommands exit 0 when there is no app
Closes #7454
2025-02-02 01:37:20 -05:00
Jose Diaz-Gonzalez
c3a573229d refactor: execute one-off commands with DOKKU_APP_SHELL as the initial command
This commit changes the launched pod to use the configured DOKKU_APP_SHELL - default /bin/bash - to launch processes. Without this, if a non-interactive process was executed and did not immediately exit, it was possible for that process to launch twice - once when the pod started, and once when entering the pod. Ideally we know whether the process is interactive or not, but this isn't always possible when running under a tty (non-tty == non-interactive). As such, this also removes the ability to launch one-off containers that do not have a configured shell in the container, but this is better than attempting to run commands twice.
2024-11-04 14:29:34 -05:00
Jose Diaz-Gonzalez
cdff4ae867 refactor: use CallPlugnTrigger instead of PlugnTriggerOutput
Refs #6422
2024-03-14 01:18:28 -04:00
Jose Diaz-Gonzalez
6bcb4a016d refactor: return an int32 for scale count 2024-01-18 19:23:57 -05:00
Eng Zer Jun
1d186a5a81 refactor(plugins): replace deprecated io/ioutil functions
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-12-22 01:59:22 +08:00
Jose Diaz-Gonzalez
60b343470b feat: add support for specifying multiple networks on a given app
Closes #5314
2023-08-05 10:58:46 -04:00
Jose Diaz-Gonzalez
49dc73028e chore: move the times function to functions.go
The functions.go file is where private functions to a given plugin go.
2023-06-16 23:38:53 -04:00
Jose Diaz-Gonzalez
07e0eb4e50 feat: return an error when an invalid scale count is encountered
Closes #5710
2023-03-18 05:07:03 -04:00
Jose Diaz-Gonzalez
1a498b0b76 fix: handle nil map issue 2023-01-21 17:26:52 -05:00
Jose Diaz-Gonzalez
5719f43551 feat: silence env var setting 2023-01-21 16:43:43 -05:00
Jose Diaz-Gonzalez
b3d7174a7a fix: filter apps when verifying app names
This ensures folks can't interact with apps that are hidden from them via the filtering performed in app listing.
2022-05-27 23:28:59 -04:00
Jose Diaz-Gonzalez
f87cd22340 feat: allow returning an unfiltered list of users
This is useful for upgrades or commands that _must_ perform against all apps.
2022-05-15 15:33:19 -04:00
Jose Diaz-Gonzalez
ac58b502c5 refactor: move app listing back to common
Without this, we'd need to duplicate some logic or make it more complex via a plugin trigger.
2022-02-26 02:55:34 -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
3c6396fbca feat: implement the scheduler plugin
This also performs a one-time migration of the DOKKU_SCHEDULER values the scheduler plugin properties.

Closes #4739
2021-10-09 18:31:59 -04:00
Jose Diaz-Gonzalez
a1dcc2c173 refactor: move ParseScaleOutput to common.go so that it can be used by all plugins 2021-08-01 16:29:50 -04:00
Jose Diaz-Gonzalez
84b34b2221 feat: properly space report output 2021-07-10 17:57:01 -04:00
Jose Diaz-Gonzalez
548ca90e57 fix: add docblocks 2021-02-28 15:20:46 -05:00
Jose Diaz-Gonzalez
d55e34a55f refactor: use LogFailWithError to allow a unified exit code for golang commands when the app is missing 2021-02-28 15:20:46 -05:00
Jose Diaz-Gonzalez
d09a7506df refactor: bubble up error handling so that standard exit codes can be set at the top-level
LogFail shouldn't be called internally if at all possible.
2021-02-28 15:20:46 -05:00
Jose Diaz-Gonzalez
1e915968b5 fix: correctly handle is-deployed check
Previously, checking if an app was deployed actually checked if there were any running processes. This is not only incorrect, but also fails to take into account applications that do not have running processes and are only used for one-off commands.

This fix migrates apps to the new "deployed" property which is set in core-post-deploy. The result is a slightly faster "deployed" check that is correct and allows non-scaled apps to actually work.

Closes #4398
2021-02-13 00:46:35 -05:00
Jose Diaz-Gonzalez
033b0952dd feat: allow formatting :report command output as json 2021-02-01 22:23:30 -05:00
Jose Diaz-Gonzalez
d70a9be97e fix: correct issue where all flags were not shown if an invalid flag was specified 2021-01-07 01:34:05 -05:00
Jose Diaz-Gonzalez
3b76b81edf fix: set correct variable for app image repo 2021-01-02 18:47:48 -05:00
Jose Diaz-Gonzalez
596e7b6f24 feat: use error group to fetch the deploying app image
This is a fairly slow operation currently done serially, making ps:scale output brutally slow. Using an error group to parallelize the output is also pleasing to the eyes :)
2021-01-02 18:45:30 -05:00
Jose Diaz-Gonzalez
aa0437bb23 refactor: use an error group to simplify parallel retrieval of scheduler
This makes the code a bit simpler to read and more idiomatic
2021-01-02 18:45:30 -05:00
Jose Diaz-Gonzalez
e8aaacff5e refactor: simplify code 2021-01-02 06:11:34 -05:00
Jose Diaz-Gonzalez
44461e21df refactor: parallelize scheduler retrieval
In many cases, a user may only set a global scheduler, and as such we waste the initial call to get the app scheduler. Parallelizing the fetch increases the speed at which we can check for the scheduler.
2020-12-29 23:55:13 -05:00
Jose Diaz-Gonzalez
65d7fd9cce refactor: drop extra internal calls to VerifyAppName
These are duplicative of the checks that happen at the subcommand level.
2020-12-27 15:14:11 -05:00
Jose Diaz-Gonzalez
d7b23b84f0 fix: allow renaming old applications to new format
0.22.0 changed allowed values for app names, making it more difficult for users to fix their app names - you need to either downgrade+rename or recreate the app. The `apps:rename`  command can now rename these old applications to the new standard.

Also drop some app name verification from internal commands. Duplicate verification doesn't help much, and though it isn't excessively slow, it does prevent us from running commands against old apps that exist.

Refs #4267
2020-12-22 13:29:32 -05:00
Jose Diaz-Gonzalez
dd1962f92d fix: add missing docblock 2020-12-21 01:40:40 -05:00
Jose Diaz-Gonzalez
1439e8b30b hack: parse out the info flags for report subcommands separately
pflag doesn't ignore unspecified arguments, so they must be parsed out separately first.
2020-12-21 01:36:59 -05:00
Jose Diaz-Gonzalez
c6976499ad fix: do not delete app when the app name is invalid
Let folks call apps:destroy instead.

Refs #4129
2020-12-15 01:14:30 -05:00
Jose Diaz-Gonzalez
8c14bb9aeb fix: ensure all byte output is trimmed of whitespace
This otherwise causes issues when interpreting the output as part of a variable, such as when constructing the deploying app image.

Closes #4229
2020-12-13 02:04:35 -05:00
Jose Diaz-Gonzalez
97513dee91 fix: handle case where deploying app image does not exist
This happens if ps:scale is called before a deploy.

Also refactor GetDeployingAppImageName() to return an error as the second return parameter.
2020-11-23 00:11:00 -05:00
Jose Diaz-Gonzalez
53a76b1353 feat: implement ps:retire 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez
bb9f764b9f fix: sync code to bash implementation 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
Jose Diaz-Gonzalez
34343a846d chore: drop alias 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez
c7becc6cad refactor: move all subprocess-related code to new file 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez
74f27480fc refactor: move all docker-related functions to new file 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez
33d3722060 refactor: move common io-related functions into new file 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez
66696d0b46 refactor: export SetPermissions function 2020-11-21 20:57:33 -05:00
Jose Diaz-Gonzalez
0f514f300e feat: prohibit non-dns names for apps and process types
This is necessary for ensuring ssl certificates can be auto-retrieved for apps, and also easing integration into schedulers that use names and process types as part of DNS records.

As well, this fixes an issue where we may potentially have invalid DNS entries when adding apps to custom networks.

Closes #4102
Closes #4114
2020-09-09 20:07:50 -04:00
Jose Diaz-Gonzalez
b8b6d64f75 fix: correct stickler-ci errors and remove unused code 2020-08-31 18:44:00 -04:00