Last missing peace to get started with plack is tooling. http://wiki.koha-community.org/wiki/Plack does provide some information, psgi files and startup scripts should also be part of main repository for easy deployment on sendboxes.
Created attachment 8684 [details] [review] Bug 7844 - plack intranet tooling for developers intranet.psgi example and script to run any Koha intranet under plack This assumes that intranetdir in koha-conf.xml points to source code checkout. It also defines new enviroment variables: PLACK_DEBUG - turn debugging panels on PLACK_MINIFY - minify JavaScript and CSS which saves us ~10k on each page load Test scenario: 1. install plack, using ./cpanm-install.pl 2. start ./intranet-plack.sh sitename from misc/plack directory so it can find intranet.psgi here 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl
Created attachment 8693 [details] [review] Bug 7844 - plack intranet tooling for developers koha.psgi example and script to run any Koha site intranet or opac under plack It also defines new enviroment variables: PLACK_DEBUG=1 - turn Plack debug panels on PLACK_MINIFY=1 - minify JavaScript and CSS which saves us ~10k on each page load Test scenario: 1. install plack and dependencies, using ./cpanm-install.pl 2. start ./intranet-plack.sh sitename 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl and verify that it works 4. start ./opac-plack.sh sitename 5. open OPAC http://localhost:5000/cgi-bin/koha/opac-main.pl and very that it works
Created attachment 8731 [details] [review] Bug 7844 - plack intranet tooling for developers koha.psgi example and script to run any Koha site intranet or opac under plack This means that it will use sudo to switch to correct site-koha user for configuration and plack process It also defines new enviroment variables: PLACK_DEBUG=1 - turn Plack debug panels on PLACK_MINIFY=1 - minify JavaScript and CSS which saves us ~10k on each page load Test scenario: 1. install plack and dependencies, using ./cpanm-install.pl 2. start ./intranet-plack.sh sitename 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl and verify that it works 4. start ./opac-plack.sh sitename 5. open OPAC http://localhost:5000/cgi-bin/koha/opac-main.pl and very that it works 6. start PLACK_DEBUG=1 ./intranet-plack.sh sitename and verify that debug console is available
This tools are very useful. I have tested installing dependencies using ./cpanm-install.pl on debian squeeze and ubnutu 10.04 and it works on both. However, opac-plack.sh and intranet-plack.sh seem too specifics insofar as many informations are hardcoded. For instance, "KOHA_CONF=/etc/koha/sites/$site/koha-conf.xml" could be "KOHA_CONF=/home/koha/etc/koha-conf.xml" or others. Also, if i'm not wrong, scripts assumes that user launching http server consists of the site ($site) and "-koha". It could be koha. Plack::Middleware::Static root are also hardcoded ('/srv/koha/koha-tmpl/'). should we not make koha-conf path and user some parameters of this scripts? For my part, with a few changes, it works well :-)
Created attachment 8892 [details] [review] Bug 7844 - plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs. When you are happy with it, rename it to site name and save it for safe-keeping. Test scenario: 1. install plack and dependencies, using ./cpanm-install.pl 2. start ./plackup.sh sitename 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl and verify that it works 4. start ./plackup.sh sitename i[ntranet] 5. open OPAC http://localhost:5000/cgi-bin/koha/opac-main.pl and verify that it works 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically) This message is included as README.plack because it's useful as quickstart guide when trying code from distribution or checkout
Alex, I totally agree. I was refactoring it into single script and psgi in last few days while trying to record http://blog.rot13.org/koha/koha-plack-debug.ogv It turned out much better, but it does benefit of various additional patches to other tools used which are provided as additional patch to this bug. Feel free to skip them if you don't think they are needed in upstream Koha, they are here just as convenience so that testing features doesn't require more than bz apply to test out. I'm using git submodules to manage those dependencies: https://github.com/dpavlin/Koha/blob/plack/.gitmodules Same goes for shell helpers, they are useful for development, but maybe not needed in upstream repository. Scripts does expect koha to be installed in a way Debian packages use Koha, and I would love to keep it that way. This is how we suggest that normal people run Koha, and I expect this script to morph into "migrate to plack" in 3.10 cycle.
Created attachment 8893 [details] [review] Bug 7844 - plack shell helpers
Created attachment 8894 [details] [review] Bug 7844 - plack modified upstream modules
Created attachment 9113 [details] [review] Bug 7844 - plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs. When you are happy with it, rename it to site name and save it for safe-keeping. Test scenario: 1. install plack and dependencies, using ./cpanm-install.pl 2. start ./plackup.sh sitename 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl and verify that it works 4. start ./plackup.sh sitename i[ntranet] 5. open OPAC http://localhost:5000/cgi-bin/koha/opac-main.pl and verify that it works 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically)
In the end, I decided to include just minimal plack support in this patch: koha.psgi, shell script to start it up and README file.
Dobrika, hello, I'm reviewing your patches related to plack, and find this one. In the attachment 9113 [details] [review], is written: +1. install plack and dependencies, using ./cpanm-install.pl but I can't find cpanm-install.pl anywhere. Is it a mistake ? I can see cpanm-install.pl in the attachment the attachment 8893 [details] [review], but it's an obsolete one. Any explanation welcomed !
I removed cpanm-install.pl since installation of dependencies is something that should be done by Debian package. I don't think that installing packages using cpanm on production is something we should recommend. Installing dependencies is documented at wiki page http://wiki.koha-community.org/wiki/Plack but it does depend on platform availability of perl packages. Currently squeeze miss quite a few packages, while wheezy does include most packages needed for Koha.
Created attachment 9879 [details] [review] Bug 7844 - plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs. When you are happy with it, rename it to site name and save it for safe-keeping. Test scenario: 1. install plack and dependencies, as documented at http://wiki.koha-community.org/wiki/Plack 2. start ./plackup.sh sitename 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl and verify that it works 4. start ./plackup.sh sitename i[ntranet] 5. open OPAC http://localhost:5000/cgi-bin/koha/opac-main.pl and verify that it works 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically)
Created attachment 10082 [details] [review] Bug 7844 - plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs (enable memcache, enable/disable debugging modules for plack and so on). For deployment of opac or intranet you would probably want to take a look in plackup.sh and enable starman as web server (which is pre-forking server written in perl) and put some web server in front of it to serve static web files (e.g. ngnix, apache) When you are happy with it, rename koha.psgi and plackup.sh it to site name and save it for safe-keeping. This version does not have mapping to / of opac or intranet, so you need to use full URLs to pages as specified in test scenario. This will be fixed when we are ready to deploy plack, but for now it's clear indication that this is intended for developers which know what to do anyway. Test scenario: 1. install plack and dependencies, as documented at http://wiki.koha-community.org/wiki/Plack 2. start ./plackup.sh sitename i[ntranet] 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl and verify that it works 4. start ./plackup.sh sitename 5. open OPAC http://localhost:5000/cgi-bin/koha/opac-main.pl and verify that it works 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically)
Created attachment 10220 [details] [review] Bug 7844 - plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs (enable memcache, enable/disable debugging modules for plack and so on). For deployment of opac or intranet you would probably want to take a look in plackup.sh and enable starman as web server (which is pre-forking server written in perl) and put some web server in front of it to serve static web files (e.g. ngnix, apache) When you are happy with it, rename koha.psgi and plackup.sh it to site name and save it for safe-keeping. This version does not have mapping to / of opac or intranet, so you need to use full URLs to pages as specified in test scenario. This will be fixed when we are ready to deploy plack, but for now it's clear indication that this is intended for developers which know what to do anyway. This commit message is included in patch as README.plack because it includes useful information for people using plack for first time. Test scenario: 1. install plack and dependencies, as documented at http://wiki.koha-community.org/wiki/Plack 2. start ./plackup.sh sitename i[ntranet] 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl and verify that it works 4. start ./plackup.sh sitename 5. open OPAC http://localhost:5000/cgi-bin/koha/opac-main.pl and verify that it works 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically)
Hi, I am not sure - does this needs to be signed-off to be included in Koha? Or do we want to store it somewhere else? Maybe in a developer-tools repository?
I agree about the Katrin note, could be external tool, not "koha software".
Maybe a contrib/dev-tools or similar could be created in the Koha git repository?
(In reply to comment #18) > Maybe a contrib/dev-tools or similar could be created in the Koha git > repository? I think that contrib/global.git is also an option, there's no need to have zillions of tiny repos. Just use contrib/global.git & add a directory.
Dobrica: Would you be OK with having this outside Koha, e.g. in contrib/global.git? Setting to "in discussion".
My preference would be to start shipping a Plack config, actually. Sure, it's experimental, but it's also something that seems reasonably likely to ultimately become standard within a few releases, and I feel that shuffling it off into a separate repository wouldn't help.
(In reply to Galen Charlton from comment #21) > My preference would be to start shipping a Plack config, actually. Sure, > it's experimental, but it's also something that seems reasonably likely to > ultimately become standard within a few releases, and I feel that shuffling > it off into a separate repository wouldn't help. I agree wholeheartedly with Galen now. I think speed is really important for the future growth of Koha, and Plack seems to be the speediest route to getting more speed. So let's get something into Koha that makes it as easy as possible to test Koha under Plack for as many people as possible, so we can iron out the bugs we know are lurking in the corners. I don't know enough about configuring Plack to say if the patch from Dobrica is optimal in every sense, but it does make it easy for me to test Koha under Plack, so I am happy to sign it off. Then we can argue about what the default settings should be, as well as add more options to plackup.sh, over time. And we can perhaps elvolve this starting point into two branches, one for testing as well as one sane baseline setup for production use.
Ooops, I set the wrong status...
Created attachment 26148 [details] [review] Bug 7844 - [SIGNED-OFF] plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs (enable memcache, enable/disable debugging modules for plack and so on). For deployment of opac or intranet you would probably want to take a look in plackup.sh and enable starman as web server (which is pre-forking server written in perl) and put some web server in front of it to serve static web files (e.g. ngnix, apache) When you are happy with it, rename koha.psgi and plackup.sh it to site name and save it for safe-keeping. This version does not have mapping to / of opac or intranet, so you need to use full URLs to pages as specified in test scenario. This will be fixed when we are ready to deploy plack, but for now it's clear indication that this is intended for developers which know what to do anyway. This commit message is included in patch as README.plack because it includes useful information for people using plack for first time. Test scenario: 1. install plack and dependencies, as documented at http://wiki.koha-community.org/wiki/Plack 2. start ./plackup.sh sitename i[ntranet] 3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl and verify that it works 4. start ./plackup.sh sitename 5. open OPAC http://localhost:5000/cgi-bin/koha/opac-main.pl and verify that it works 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically) Signed-off-by: Magnus Enger <digitalutvikling@gmail.com> Works as advertised. As I have explained in a comment on the bug this looks like a very good starting point, and we can argue about the details and add more options over time. Very happy to sign this off! It is a minor drawback that the "default pages" do not work: http://localhost:5000/ http://localhost:5001/ but I think this can be deferred to a followup.
Created attachment 26201 [details] [review] Bug 7844 - plack should redirect / to correct page This is followup which include redirect for home pages of OPAC and Intranet
Sorry Dobrica, with the second patch I get: $ git bz apply 7844 Bug 7844 - plack scripts for developers 26148 - Bug 7844 - [SIGNED-OFF] plack intranet tooling for developers 26201 - Bug 7844 - plack should redirect / to correct page Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 7844 - [SIGNED-OFF] plack intranet tooling for developers Applying: Bug 7844 - plack should redirect / to correct page fatal: sha1 information is lacking or useless (misc/plack/koha.psgi). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 7844 - plack should redirect / to correct page When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-7844---plack-should-redirect--to-correct-page-U01YNR.patch
Strange. Did you start from clean master? In my tests it does trigger 3-way merge, but it does succeed... dpavlin@koha-dev:/srv/koha(bug_7844) $ git bz apply 7844 Bug 7844 - plack scripts for developers 26148 - Bug 7844 - [SIGNED-OFF] plack intranet tooling for developers 26201 - Bug 7844 - plack should redirect / to correct page Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 7844 - [SIGNED-OFF] plack intranet tooling for developers Applying: Bug 7844 - plack should redirect / to correct page Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging misc/plack/koha.psgi
Created attachment 26206 [details] [review] Bug 7844 - plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs (enable memcache, enable/disable debugging modules for plack and so on). For deployment of opac or intranet you would probably want to take a look in plackup.sh and enable starman as web server (which is pre-forking server written in perl) and put some web server in front of it to serve static web files (e.g. ngnix, apache) When you are happy with it, rename koha.psgi and plackup.sh it to site name and save it for safe-keeping. This commit message is included in patch as README.plack because it includes useful information for people using plack for first time. Test scenario: 1. install plack and dependencies, as documented at http://wiki.koha-community.org/wiki/Plack 2. start ./plackup.sh sitename i[ntranet] 3. open intranet page http://localhost:5001/ and verify that it redirects to http://localhost:5001/cgi-bin/koha/mainpage.pl 4. start ./plackup.sh sitename 5. open OPAC http://localhost:5000/ and verify that it redirects to http://localhost:5000/cgi-bin/koha/opac-main.pl 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically)
I just squashed both patches together and updated READEME not to mention missing redirects.
Created attachment 26227 [details] [review] Bug 7844 - [SIGNED-OFF] plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs (enable memcache, enable/disable debugging modules for plack and so on). For deployment of opac or intranet you would probably want to take a look in plackup.sh and enable starman as web server (which is pre-forking server written in perl) and put some web server in front of it to serve static web files (e.g. ngnix, apache) When you are happy with it, rename koha.psgi and plackup.sh it to site name and save it for safe-keeping. This commit message is included in patch as README.plack because it includes useful information for people using plack for first time. Test scenario: 1. install plack and dependencies, as documented at http://wiki.koha-community.org/wiki/Plack 2. start ./plackup.sh sitename i[ntranet] 3. open intranet page http://localhost:5001/ and verify that it redirects to http://localhost:5001/cgi-bin/koha/mainpage.pl 4. start ./plackup.sh sitename 5. open OPAC http://localhost:5000/ and verify that it redirects to http://localhost:5000/cgi-bin/koha/opac-main.pl 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically) Signed-off-by: Magnus Enger <magnus@enger.priv.no> Works as advertised. As I have explained in a comment on the bug this looks like a very good starting point, and we can argue about the details and add more options over time. Very happy to sign this off! (My earlier concern about / not working has now been taken care of, thanks Dobrica!)
Created attachment 26275 [details] [review] [PASSED QA] Bug 7844 - plack intranet tooling for developers koha.psgi example and plackup.sh script to run any Koha site intranet or opac interface under plack with optional multi-process Starman server plackup.sh site-name [intranet] site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml All configuration is specified in koha.psgi, which you are welcomed to edit and tune according to your development needs (enable memcache, enable/disable debugging modules for plack and so on). For deployment of opac or intranet you would probably want to take a look in plackup.sh and enable starman as web server (which is pre-forking server written in perl) and put some web server in front of it to serve static web files (e.g. ngnix, apache) When you are happy with it, rename koha.psgi and plackup.sh it to site name and save it for safe-keeping. This commit message is included in patch as README.plack because it includes useful information for people using plack for first time. Test scenario: 1. install plack and dependencies, as documented at http://wiki.koha-community.org/wiki/Plack 2. start ./plackup.sh sitename i[ntranet] 3. open intranet page http://localhost:5001/ and verify that it redirects to http://localhost:5001/cgi-bin/koha/mainpage.pl 4. start ./plackup.sh sitename 5. open OPAC http://localhost:5000/ and verify that it redirects to http://localhost:5000/cgi-bin/koha/opac-main.pl 6. next step is to take a look into koha.psgi and enable additional debug modules, save file and reload page (plackup will reload code automatically) Signed-off-by: Magnus Enger <magnus@enger.priv.no> Works as advertised. As I have explained in a comment on the bug this looks like a very good starting point, and we can argue about the details and add more options over time. Very happy to sign this off! (My earlier concern about / not working has now been taken care of, thanks Dobrica!) Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
More than happy to pass QA on this, and will hopefully lead to more developers running and testing plack for both intranet and opac. Not designed for production use and happily doesn't touch anything as such. Some thought needs to go into how this patch and bug 9316 fit together. 9316 is moving toward production, but is not fit for regular use yet.
Pushed to master. Thanks, Dobrica!