[Bug 17030] New: Configure the REST api on packages install
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Bug ID: 17030 Summary: Configure the REST api on packages install Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Packaging Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: mirko@abunchofthings.net This should've been implemented a while back, so we start taking advantage of the REST api in the UI. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |17044 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17044 [Bug 17044] Wrong destination for 'api' directory -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 53991 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53991&action=edit Bug 17030: Enable REST api on packages This patch enables access to the REST API endpoint on packages setup. It does so, by patching the shared apache-shared-intranet.conf and apache-shared-opac.conf. You can build your own master packages with this patch applied, or just: - Grab debian/templates/apache-shared-intranet.conf debian/templates/apache-shared-opac.conf and overwrite their counterparts in /etc/koha on a packages setup. For example in kohadevbox. - Have Koha loaded with all default data - Create a superlibrarian user for you - Login to the intranet and the OPAC - Point your browser to: http://localhost:8080/api/v1/patrons/51 => SUCCESS: You get JSON data, for the patron you requested http://localhost:8081/api/v1/patrons/51 => SUCCESS: You get JSON data, for the patron you requested - Sign off :-D Note: I use the HTTPRequester addon for Firefox, re-using the CGISESSID value from the browser session cookie, in the headers. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 53992 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53992&action=edit Bug 17030: Make REST api available on packages with plack enabled This patch is the starting point for making the REST api available on Plack. What it does: - It creates the /api/v1/app.pl mount point in plack.psgi - It enables the ProxyPass and ProxyPassReverse directives so it is reached through Plack. TODO: It is missing the rewrite part. To test: - Grab the following files, and put them in /etc/koha (overwrite the existing ones) debian/templates/apache-shared-intranet-plack.conf debian/templates/apache-shared-opac-plack.conf - Tweak your /etc/koha/sites/kohadev/plack.psgi file so the API-related stuff is present on your file. - Make sure Plack is enabled for the instance: $ sudo koha-plack --enable kohadev $ sudo koha-plack --restart kohadev $ sudo service apache2 restart - Follow the previous patch test plan, but use this URLs (no pretty URL for now): http://localhost:8080/api/v1/app.pl/api/v1/patrons/50 http://localhost:8081/api/v1/app.pl/api/v1/patrons/50 => SUCCESS: You get a JSON response from the API [1] - Sign off :-D Note: this patch made a bug visible (the session is lost when accessing the API through Plack) but it shouldn't prevent its inclusion because the API right now is not even available as default for developers to test or fix it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org, | |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@kul.oslo.k | |ommune.no -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17050 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17050 [Bug 17050] Accessing the REST API through Plack kicks the session out -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 53995 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53995&action=edit Bug 17030: (followup) Rewrite rule for Plack This patch fixes the TODO from the previous one. It implements the rewrite on the Plack-related files so pretty uRLs can be used. To test: - Follow the previous patches test steps (you should have a tweaked plack-psgi file and Plack enabled) - Grab debian/templates/apache-shared-opac-plack.conf debian/templates/apache-shared-intranet-plack.conf and put them in /etc/koha - Run: $ sudo service apache2 restart - Point your browser to: http://localhost:8080/api/v1/app.pl/api/v1/patrons/50 => SUCCESS: You get the JSON output from the REST api - Point your browser to the pretty URL: http://localhost:8080/api/v1/patrons/50 => SUCCESS: You get the JSON output from the REST api - Repeat for port 8081 (intranet) - Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53992|0 |1 is obsolete| | --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54008 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54008&action=edit Bug 17030: Make REST api available on packages with plack enabled This patch is the starting point for making the REST api available on Plack. What it does: - It creates the /api/v1/app.pl mount point in plack.psgi - It enables the ProxyPass and ProxyPassReverse directives so it is reached through Plack. - It sets rewrite rules so we can use the 'pretty' urls (i.e. /api/v1/patrons instead of /api/v1/app.pl/api/v1/patrons). To test: - Grab the following files, and put them in /etc/koha (overwrite the existing ones) debian/templates/apache-shared-intranet-plack.conf debian/templates/apache-shared-opac-plack.conf - Tweak your /etc/koha/sites/kohadev/plack.psgi file so the API-related stuff is present on your file. - Make sure Plack is enabled for the instance: $ sudo koha-plack --enable kohadev $ sudo koha-plack --restart kohadev $ sudo service apache2 restart - Follow the previous patch test plan, but use this URLs (no pretty URL): http://localhost:8080/api/v1/app.pl/api/v1/patrons/50 http://localhost:8081/api/v1/app.pl/api/v1/patrons/50 => SUCCESS: You get a JSON response from the API [1] - Not use this URLs: http://localhost:8080/api/v1/patrons/50 http://localhost:8081/api/v1/patrons/50 => SUCCESS: You get a JSON response from the API [1] - Sign off :-D [1] this patch made a bug visible (the session is lost when accessing the API through Plack) but it shouldn't prevent its inclusion because the API right now is not even available as default for developers to test or fix it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53995|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53991|0 |1 is obsolete| | --- Comment #5 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54012 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54012&action=edit Bug 17030: Enable REST api on packages This patch enables access to the REST API endpoint on packages setup. It does so, by patching the shared apache-shared-intranet.conf and apache-shared-opac.conf. You can build your own master packages with this patch applied, or just: - Grab debian/templates/apache-shared-intranet.conf debian/templates/apache-shared-opac.conf and overwrite their counterparts in /etc/koha on a packages setup. For example in kohadevbox. - Have Koha loaded with all default data - Create a superlibrarian user for you - Login to the intranet and the OPAC - Point your browser to: http://localhost:8080/api/v1/patrons/51 => SUCCESS: You get JSON data, for the patron you requested http://localhost:8081/api/v1/patrons/51 => SUCCESS: You get JSON data, for the patron you requested - Sign off :-D Note: I use the HTTPRequester addon for Firefox, re-using the CGISESSID value from the browser session cookie, in the headers. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54008|0 |1 is obsolete| | --- Comment #6 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54013 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54013&action=edit Bug 17030: Make REST api available on packages with plack enabled This patch is the starting point for making the REST api available on Plack. What it does: - It creates the /api/v1/app.pl mount point in plack.psgi - It enables the ProxyPass and ProxyPassReverse directives so it is reached through Plack. - It sets rewrite rules so we can use the 'pretty' urls (i.e. /api/v1/patrons instead of /api/v1/app.pl/api/v1/patrons). To test: - Grab the following files, and put them in /etc/koha (overwrite the existing ones) debian/templates/apache-shared-intranet-plack.conf debian/templates/apache-shared-opac-plack.conf - Tweak your /etc/koha/sites/kohadev/plack.psgi file so the API-related stuff is present on your file. - Make sure Plack is enabled for the instance: $ sudo koha-plack --enable kohadev $ sudo koha-plack --restart kohadev $ sudo service apache2 restart - Follow the previous patch test plan, but use this URLs (no pretty URL): http://localhost:8080/api/v1/app.pl/api/v1/patrons/50 http://localhost:8081/api/v1/app.pl/api/v1/patrons/50 => SUCCESS: You get a JSON response from the API [1] - Not use this URLs: http://localhost:8080/api/v1/patrons/50 http://localhost:8081/api/v1/patrons/50 => SUCCESS: You get a JSON response from the API [1] - Sign off :-D [1] this patch made a bug visible (the session is lost when accessing the API through Plack) but it shouldn't prevent its inclusion because the API right now is not even available as default for developers to test or fix it. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #7 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Lovely work Tomas! Just as we have implemented at OPL, but with a much better apache rewrite... As for the session timeout, I tested by disabled the syspref SessionRestrictionByIP and never suffered the session timeout issue again. Relevant log error with : Use of uninitialized value in string ne at /usr/share/koha/lib/C4/Auth.pm line 1674. which points to the test: C4::Context->preference('SessionRestrictionByIP') && $ip ne $ENV{'REMOTE_ADDR'} ) my guess is that session worker translates localhost to 127.0.0.1 and then this test will give false and delete session. Anyway, this should be a separate bug and not prevent this important one to hit master as soon as possible! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54012|0 |1 is obsolete| | Attachment #54013|0 |1 is obsolete| | --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 54049 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54049&action=edit Bug 17030: Enable REST api on packages This patch enables access to the REST API endpoint on packages setup. It does so, by patching the shared apache-shared-intranet.conf and apache-shared-opac.conf. You can build your own master packages with this patch applied, or just: - Grab debian/templates/apache-shared-intranet.conf debian/templates/apache-shared-opac.conf and overwrite their counterparts in /etc/koha on a packages setup. For example in kohadevbox. - Have Koha loaded with all default data - Create a superlibrarian user for you - Login to the intranet and the OPAC - Point your browser to: http://localhost:8080/api/v1/patrons/51 => SUCCESS: You get JSON data, for the patron you requested http://localhost:8081/api/v1/patrons/51 => SUCCESS: You get JSON data, for the patron you requested - Sign off :-D Note: I use the HTTPRequester addon for Firefox, re-using the CGISESSID value from the browser session cookie, in the headers. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 54050 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54050&action=edit Bug 17030: Make REST api available on packages with plack enabled This patch is the starting point for making the REST api available on Plack. What it does: - It creates the /api/v1/app.pl mount point in plack.psgi - It enables the ProxyPass and ProxyPassReverse directives so it is reached through Plack. - It sets rewrite rules so we can use the 'pretty' urls (i.e. /api/v1/patrons instead of /api/v1/app.pl/api/v1/patrons). To test: - Grab the following files, and put them in /etc/koha (overwrite the existing ones) debian/templates/apache-shared-intranet-plack.conf debian/templates/apache-shared-opac-plack.conf - Tweak your /etc/koha/sites/kohadev/plack.psgi file so the API-related stuff is present on your file. - Make sure Plack is enabled for the instance: $ sudo koha-plack --enable kohadev $ sudo koha-plack --restart kohadev $ sudo service apache2 restart - Follow the previous patch test plan, but use this URLs (no pretty URL): http://localhost:8080/api/v1/app.pl/api/v1/patrons/50 http://localhost:8081/api/v1/app.pl/api/v1/patrons/50 => SUCCESS: You get a JSON response from the API [1] - Not use this URLs: http://localhost:8080/api/v1/patrons/50 http://localhost:8081/api/v1/patrons/50 => SUCCESS: You get a JSON response from the API [1] - Sign off :-D [1] this patch made a bug visible (the session is lost when accessing the API through Plack) but it shouldn't prevent its inclusion because the API right now is not even available as default for developers to test or fix it. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #10 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to master for 16.11, thanks Tomas! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |frederic@tamil.fr Status|Pushed to Master |Pushed to Stable --- Comment #11 from Frédéric Demians <frederic@tamil.fr> --- Pushed in 16.05. Will be in 16.05.03. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Jacek Ablewicz <abl@biblos.pk.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |abl@biblos.pk.edu.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Stable |Pushed to Master --- Comment #12 from Frédéric Demians <frederic@tamil.fr> --- Reverted on 16.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Bug 17030 depends on bug 17044, which changed state. Bug 17044 Summary: Wrong destination for 'api' directory https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17044 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Stable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17030 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Master |RESOLVED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org