Allow to control these parts of the script in particular: if [ "$DEV_INSTALL" = "1" ]; then # Maybe we should switch off debug_mode if DEV_INSTALL is not set? environment="development" fi and if [ "$debug_mode" = "yes" ]; then environment="development"
Created attachment 167069 [details] [review] Bug 36932: Add deployment parameter to koha-plack Test plan (needs dev_install or ktd): Add a die in a script somewhere to simulate a crash. * For example in opac-main.pl: die "Line 43"; Run koha-plack --restart without -dep and hit that page. Dev output? Run koha-plack --restart with -dep and hit page again. No dev output? Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Is that to make running KTD in production safer?
Or to someone needing to briefly enable debug mode in production?
(In reply to Victor Grousset/tuxayo from comment #2) > Is that to make running KTD in production safer? (In reply to Victor Grousset/tuxayo from comment #3) > Or to someone needing to briefly enable debug mode in production? The patch allows you to make a DEV_INSTALL (gitified package install, not only KTD) safer whether you want that in production or test environment.
Ok, so like someone deploying koha with branches for flexibility of managing additional patches? Which would still be using the commands like koha-plack.
Created attachment 167256 [details] [review] Bug 36932: Add deployment parameter to koha-plack Test plan (needs dev_install or ktd): Add a die in a script somewhere to simulate a crash. * For example in opac-main.pl: die "Line 43"; Run koha-plack --restart without -dep and hit that page. Dev output? Run koha-plack --restart with -dep and hit page again. No dev output? Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
It works! :) --- Clarification: > like someone deploying koha with branches * with a git repo to be able to use branches --- Not sure about the -dep , it sounds like dependency instead of deployment. No big deal if nothing else sounds better. --- new param is not documented in the --help --- Since it's a safeguard to make sure people don't expose errors info in production: shouldn't it be the opposite approach? So like a -dev flag that ktd would have to add in it's startup command line call to koha-plack. Wait, here with the current proposal it's very easy to switch back to an unsafe state: restart plack without putting the flag again. How do the people in the usecases needing this flag manage the automated startup of koha on machine boot? Because that place will need also to not have the -dep forgotten. Do we have any setting that we already have to a value for dev envs and another one for regular prod instances and prod instance using a gittified setup? (IIUC that's the usecase for this flag). How do we do it? ENV var that KTD overides and everywhere else it's a prod oriented value? koha-conf.xml attribute that the KTD startup replaces with a dev oriented value so the everywhere else it's a prod oriented value?
(In reply to Victor Grousset/tuxayo from comment #5) > Ok, so like someone deploying koha with branches for flexibility of managing > additional patches? Which would still be using the commands like koha-plack. Yeah possibly.
(In reply to Victor Grousset/tuxayo from comment #7) > Not sure about the -dep , it sounds like dependency instead of deployment. > No big deal if nothing else sounds better. > > > --- > > > new param is not documented in the --help > > --- > > > Since it's a safeguard to make sure people don't expose errors info in > production: shouldn't it be the opposite approach? So like a -dev flag that > ktd would have to add in it's startup command line call to koha-plack. > > Wait, here with the current proposal it's very easy to switch back to an > unsafe state: restart plack without putting the flag again. > How do the people in the usecases needing this flag manage the automated > startup of koha on machine boot? > Because that place will need also to not have the -dep forgotten. > > Do we have any setting that we already have to a value for dev envs and > another one for regular prod instances and prod instance using a gittified > setup? (IIUC that's the usecase for this flag). > How do we do it? ENV var that KTD overides and everywhere else it's a prod > oriented value? > koha-conf.xml attribute that the KTD startup replaces with a dev oriented > value so the everywhere else it's a prod oriented value? Coming back a bit later for these things. Since we are in 24.11 now, blocking this one temporarily.
Created attachment 172101 [details] [review] Bug 36932: Add development parameter to koha-plack Test plan: NOTE: Needs dev_install or ktd. [1] Add a die in a script somewhere to simulate a crash. For example in opac-main.pl: die "Line 43"; [2] Run koha-plack --restart YOUR_CLONE (without -dev) and hit that page. See no dev output? [3] Run koha-plack --restart -dev YOUR_CLONE and hit page again. See dev output? [4] BONUS: Do a koha-plack --reload YOUR_CLONE (without -dev). Hit page. Verify that environment did not change. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
This works, however the help needs to match the actual command (or vice versa): 1. Using -dev works: koha-plack --restart -dev kohadev 2. Using --development doesn't work: koha-plack --restart --development kohadev ==> Error: invalid option switch (--development) 3. Using --development_environment works. However, this is inconsistent with other options - should be a dash instead of an underscore. In addition, this doesn't match the help, which has --development. Testing notes using KTD: 1. Apply the patch. 2. Reset everything: reset_all 3. Check that the script is updated: koha-plack --help ==> You should see the new option listed in the help output (--development|-dev Enable development environment) 4. Run the rest of the test plan. Help output =========== koha-plack --help koha-plack This script lets you manage the plack daemons for your Koha instances. Usage: koha-plack --start|--stop|--restart|--reload|--status [--quiet|-q] instancename1 [instancename2...] koha-plack --enable|--disable instancename1 [instancename2] koha-plack -h|--help --start Start the plack daemon for the specified instances --stop Stop the plack daemon for the specified instances --restart Restart the plack daemon for the specified instances --reload Reload the plack daemon for the specified instances, letting the busy workers finish processing their requests before restarting them --enable Enable plack for the specified instances --disable Disable plack for the specified instances --status Show the status of Plack for the specified instances --debugger Enable running Plack in debug mode --debugger-key Specify the key the IDE is expecting --debugger-location Specify the host:port for your debugger tool (defaults to localhost:9000) --debugger-path Specify the path for the debugger library --development|-dev Enable development environment --quiet|-q Make the script quiet about non existent instance names (useful for calling from another scripts). --help|-h Display this help message