[Koha-bugs] [Bug 20582] Turn Koha into a Mojolicious application (?)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 19 08:49:37 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20582

Julian Maurice <julian.maurice at biblibre.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #74173|0                           |1
        is obsolete|                            |

--- Comment #6 from Julian Maurice <julian.maurice at biblibre.com> ---
Created attachment 74517
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74517&action=edit
Bug 20582: Turn Koha into a Mojolicious application

This patch is a proof-of-concept of Koha as a Mojolicious application

This has several benefits:
- Run `morbo bin/koha` and you're set : fully functional Koha without
  apache2/nginx (URL rewrites and static files are handled by the app)
- apache2/nginx configuration is much simpler (an example of nginx
  configuration is included in the patch)
- starman and plack middlewares can still be used for debug or gzip
  compression for instance (see bin/koha.psgi)
- All that is needed to run koha is in the source code and not hidden in
  an obscure directory (I'm looking at you, debian/templates/plack.psgi)
- Using Test::Mojo we can test the whole application, as we do with the
  REST API (which is a Mojolicious application too)
- It's another step in the direction of dropping CGI support
- It also opens a way for converting CGI scripts into Mojolicious
  controllers and actions (even if that's not possible at the moment
  because of the authentication code)
- It requires zero changes to existing files, so it should apply nicely
  forever (no rebase needed \o/)

A few downsides too:
- It is not complete : some things from debian/templates/plack.psgi are
  missing, like the L1 cache flush or Koha::Middleware::SetEnv. But that
  shouldn't be too hard to add.
- Already mentioned above, but the actual state of get_template_and_user
  and checkauth completely forbids the use of Mojolicious controllers.
  We really need to rewrite C4::Auth
- Not sure if it's a downside or not, but as OPAC and Intranet are on
  the same host:port, if you authenticate on OPAC you will be
  authenticated on Intranet too.
  This can probably be changed if it's really a problem.
- ... see FIXME in the code

Other remarks:
- It uses the same mechanism as Plack::App::CGIBin to deal with CGI
  scripts, so it should be equivalent in terms of performance

How to test ?
- Run `morbo bin/koha`, then go to:
  - http://localhost:3000/  -  Redirects to OPAC main page
  - Then navigate in the OPAC, searching for bugs
  - http://localhost:3000/intranet  -  Redirects to intranet main page
  - Then navigate in the Intranet, still searching for bugs
  - http://localhost:3000/api/v1/...  -  The REST API
  - Test the web installer
- Read the code (and the comments), it's not very long

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list