Commit Graph

96 Commits

Author SHA1 Message Date
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
Jose Diaz-Gonzalez
f27096f235 refactor: implement appjson in golang 2020-08-30 13:41:15 -04:00
Jose Diaz-Gonzalez
f2a623fde0 fix: trim whitespace to ensure container ID is valid 2020-08-30 13:41:15 -04:00
Jose Diaz-Gonzalez
7ee26d41f7 fix: correct doc 2020-08-30 13:41:15 -04:00
Jose Diaz-Gonzalez
55c77773ab fix: read input correct as string 2020-08-30 13:41:15 -04:00
Jose Diaz-Gonzalez
8f671b43ae feat: add helper functions for getting global config 2020-08-30 13:41:14 -04:00
Jose Diaz-Gonzalez
6f6fa709ec feat: implement common.CopyFromImage 2020-08-30 13:41:14 -04:00
Jose Diaz-Gonzalez
5d08964699 feat: add AppHostRoot() function
This makes it a bit easier to fetch files from the host path
2020-08-30 13:41:14 -04:00
Jose Diaz-Gonzalez
45e3623ffd refactor: switch to go mod
This hopefully makes it a little easier to work with as the tooling is now based on something in golang core.

- move columnize usage to common plugin
- remove old vendor files
2020-06-28 01:11:28 -04:00
Jose Diaz-Gonzalez
4aae0f1a1d fix: do not allow slashes in app names
There is likely a better regex for the actually allowed names, but this will suffice for ensuring folks don't do weird things with their folder structures...

Closes #4013
2020-06-18 11:13:11 -04:00
Jose Diaz-Gonzalez
2e2320ec73 fix: correct comment 2020-06-02 00:51:45 -04:00
Jose Diaz-Gonzalez
ce154aff09 feat: simplify flag parsing in apps plugin
Commands should be written such that they take arguments as is.
2020-05-29 01:59:50 -04:00