[Bug 14448] New: Hypnotoad and Nginx config for REST API
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Bug ID: 14448 Summary: Hypnotoad and Nginx config for REST API Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Web services Assignee: koha-bugs@lists.koha-community.org Reporter: julian.maurice@biblibre.com QA Contact: testopia@bugs.koha-community.org Depends on: 13799 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 --- Comment #1 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 40548 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40548&action=edit Bug 14448 - Set up logging and configuration file reading for Mojolicious. Use environmental values to control some aspects of Mojolicious: This way we can have different settings for different servers running Mojolicious. %%%% Configuration file %%%% $ENV{MOJO_CONFIG} should be set in the system service (init) starting Mojolicious, eg: export MOJO_CONFIG=/home/koha/kohaclone/api/v1/hypnotoad.conf This configuration file read by the Mojolicious::Plugin::Config http://mojolicio.us/perldoc/Mojolicious/Plugin/Config %%%%% Logging %%%%%
NOTE!! There is a "feature" in Mojo::Server disabling STDOUT and STDERR, because such errors are not-suited-for-prod~ This modification in Mojo::Server disables this and preserves the STD* handles for forked server threads in Mojo::Server::daemonize(), comment out the following lines
# Close filehandles # open STDOUT, '>/dev/null'; # open STDERR, '>&STDOUT';
Log to a filename configured in an environemnt variable $ENV{MOJO_LOGFILE} using loglevel $ENV{MOJO_LOGLEVEL}. Defaults to '/tmp/koha-api.log' and loglevel of 'error' Examples: export MOJO_LOGFILE=/home/koha/koha-dev/var/log/kohaapi.mojo.log export MOJO_LOGLEVEL=debug Logging is done by Mojo::Log http://www.mojolicio.us/perldoc/Mojo/Log -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 --- Comment #2 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 40549 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40549&action=edit Bug 14448 - Adding the REST API as a Hypnotoad service, koha-api-daemon. After running make, the koha-api-daemon.sh -script should be in ../koha-dev/bin/koha-api-daemon.sh Link it to the init-directory and set up upstart triggers: ..$ ln -s /home/koha/koha-dev/bin/koha-api-daemon.sh /etc/init.d/koha-api-daemon ..$ update-rc.d koha-api-daemon defaults Start hypnotoad: ..$ service koha-api-daemon start Hypnotoad is now listening in 127.0.0.1:8080 and is preconfigured to be production ready. Hypnotoad config is in $KOHA_PATH/api/v1/hypnotoad.conf For more info, read the koha-api-daemon.sh -service -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 --- Comment #3 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 40550 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40550&action=edit Bug 14448 - Nginx reverse proxy config baseline for Koha REST API. Tweaking needed to work with makefile. Uses a self-signed SSL-certificate to service at port 444 by default. Reverse proxies to 127.0.0.1:8080 (expecting hypnotoad to be listening) ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ¤¤ Koha API Nginx configuration ¤¤ ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ Deploy the Nginx configuration ------------------------------ Run make to populate the koha-nginx-kohaapi.conf link to the /etc/nginx/sites-available/ -directory ..$ ln -s /home/koha/koha-dev/etc/koha-nginx-kohaapi.conf /etc/nginx/sites-available/kohaapi and enable with command ..$ ln -s /etc/nginx/sites-available/kohaapi /etc/nginx/sites-enabled/kohaapi Disable the default config ..$ rm /etc/nginx/sites-enabled/default Create a openssl self-signed certificate or use your own. --------------------------------------------------------- ..$ cd /etc/nginx ..$ mkdir ssl ..$ chmod 400 ssl ..$ cd ssl ..$ openssl req -x509 -sha256 -newkey rsa:2048 -keyout key.pem.secure -out cert.pem -days 720 ..$ openssl rsa -in key.pem.secure -out key.pem ..$ chmod 400 * Restart nginx ..$ service nginx restart -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Ere Maijala <ere.maijala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ere.maijala@helsinki.fi -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |olli-antti.kivilahti@jns.fi Attachment #40548|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #40549|0 |1 is obsolete| | --- Comment #4 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41168 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41168&action=edit Bug 14448 - Adding the REST API as a Hypnotoad service, koha-api-daemon. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #40550|0 |1 is obsolete| | --- Comment #5 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41169 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41169&action=edit Bug 14448 - Nginx reverse proxy config baseline for Koha REST API. Tweaking needed to work with makefile. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41168|0 |1 is obsolete| | --- Comment #6 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41333 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41333&action=edit Bug 14448 - Adding the REST API as a Hypnotoad service, koha-api-daemon. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41169|0 |1 is obsolete| | --- Comment #7 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41334 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41334&action=edit Bug 14448 - Nginx reverse proxy config baseline for Koha REST API. Tweaking needed to work with makefile. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41333|0 |1 is obsolete| | --- Comment #8 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41545 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41545&action=edit Bug 14448 - Adding the REST API as a Hypnotoad service, koha-api-daemon. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41334|0 |1 is obsolete| | --- Comment #9 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41546 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41546&action=edit Bug 14448 - Nginx reverse proxy config baseline for Koha REST API. Tweaking needed to work with makefile. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14448 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |14747 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14747 [Bug 14747] RESTful API with reverse proxy configuration -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org