<div dir="auto">This is another area where I think our thoughts align David.  I've also wanted to split his into even smaller units for a while..  a clear example is our move to background jobs. I see those as prime targets for horizontal scaling.. but as you've highlighted, at the moment to get the library of core code you may want to write a job you need to install the whole app.. koha-libs would certainly help with that</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 20 Apr 2021, 2:12 am , <<a href="mailto:dcook@prosentient.com.au">dcook@prosentient.com.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mason,<br>
<br>
[FYI this started as a response and turned into a stream-of-consciousness.][Also really keen to hear from Tomas and Agustin about their work with Docker/Kubernetes/Helm/etc.]<br>
<br>
The idea with "koha-core" was to separate out the third-party systems away from the core application. In this case, "koha-libs" would be about separating the core libraries away from the core application. <br>
<br>
Consider that the "koha-core" package contains the full Koha application (including code, templates, images, other assets, etc) and its application dependencies (e.g. at, cron, daemon, starman, sudo, unzip, xmlstarlet, yaz, mysql-client). My latest koha-core package alone was 38MB. A "koha-libs" package would probably be measured in terms of KB.<br>
<br>
I'm thinking about the absolute minimum required to run things like the SIP server or some other service/microservice (e.g. z3950-responder, REST service, etc). The koha-libs package would need to contain the Koha .pm files and koha-libs would depend on koha-perldeps. <br>
<br>
In theory, over time, some of the libraries and dependencies would probably move out of koha-libs and koha-perldeps to live in the individual services, but I don't have a full vision for that yet.  <br>
<br>
You could think about a koha-libs package as a Perl API rather than a HTTP API, which could be used by Koha's existing background services, and it could be used by new separate services.<br>
<br>
I have a vision for creating a service that depends on koha-libs, points at a koha-conf.xml file, and then implements its own functionality separate from the main Koha codebase. <br>
<br>
It could allow for a lot of power and flexibility. <br>
<br>
--<br>
<br>
That said, maybe I'm thinking too small and too Debian-focused. Maybe a CPAN distribution of Koha/ modules makes more sense (or both koha-libs and a CPAN distribution). Apparently we could use the cpanfile to specify the dependencies for the CPAN distribution too. Then you could install it on any suitable OS/container. In a container environment, you could always install the Koha/ modules and dependencies on a volume, and then share that volume with your containers. That would have some pros and cons. <br>
<br>
I'm mostly just brainstorming. Thinking about how we can re-organize things to take advantage of modern technology. But then to what end?<br>
<br>
One advantage of Docker is to run different versions of the same software on the same virtual machine...<br>
<br>
While I was thinking about 1+ containers per Koha library, maybe we do just go with a 20.05 Koha container, a 20.11 Koha container, a 21.05 Koha container. I suppose each of those versions could have multiple containers though. For example, a SIP server container, a Z39.50 responder container, a Zebra indexer container, a Zebra server container, etc. Technically speaking, if we planned the volumes right, the Koha "etc" config and "share" and "var" volumes could all be shared across those containers. Of course, that means that all the containers have to be running on the same host. At the scale of most Koha libraries, that would probably be fine. I suppose the main change here would be to the debian scripts and koha-common init script...<br>
<br>
--<br>
<br>
Overall, I suppose though most vendors would win from improved multi-tenancy. Having 100 Starman instances for 50 Koha libraries where only 3 libraries might have requests at a time is massive overhead. <br>
<br>
I imagine improved multi-tenancy coupled with multiple versions per host via Docker... that would be a nicer setup. <br>
<br>
Preloading Koha::REST::V1 and getting its work done in the master starman process rather than the child processes would be better too...<br>
<br>
Ok, that's enough ranting for me for now heh. Too many ideas and never enough time.<br>
<br>
David Cook<br>
Software Engineer<br>
Prosentient Systems<br>
Suite 7.03<br>
6a Glen St<br>
Milsons Point NSW 2061<br>
Australia<br>
<br>
Office: 02 9212 0899<br>
Online: 02 8005 0595<br>
<br>
-----Original Message-----<br>
From: Koha-devel <<a href="mailto:koha-devel-bounces@lists.koha-community.org" target="_blank" rel="noreferrer">koha-devel-bounces@lists.koha-community.org</a>> On Behalf Of Mason James<br>
Sent: Friday, 16 April 2021 3:50 PM<br>
To: <a href="mailto:koha-devel@lists.koha-community.org" target="_blank" rel="noreferrer">koha-devel@lists.koha-community.org</a><br>
Subject: Re: [Koha-devel] Packaging idea (for decoupling systems, Docker, etc)<br>
<br>
hi David<br>
<br>
i think we may already have this functionality with the 'koha-core' package?<br>
<br>
<br>
On 15/04/21 3:32 pm, <a href="mailto:dcook@prosentient.com.au" target="_blank" rel="noreferrer">dcook@prosentient.com.au</a> wrote:<br>
><br>
> Hey all,<br>
><br>
> What do people think about creating a “koha-libs” package which just contains Koha’s libraries (ie C4/, Koha/, etc)?<br>
><br>
> I’m not as familiar with DEB packaging as I am with RPM packaging, but I recently did it with a RPM-based project I manage. It allowed me to easily create other services with the same dependencies. I created these other services in other Docker containers, and I was able to use my core application libraries without having to install the entire application in every container. I share the application configuration file between them and that’s it.<br>
><br>
> It’s not a perfect solution. Really what I want is app-service1, app-service2, app-service3, and app-common with app-common containing the shared libraries. But I like it as an intermediate step.<br>
><br>
> And I would be lying if it didn’t have pros and cons. One con is updating a library in app-libs, when I need a change in app-service1, and then making sure that all my deployments have the right updated library. More overhead than just having a monolithic application. On the other hand, if I want to make a change just to app-service1, I can just update it without having to affect any other parts of the application. That added overhead also gives incentive for writing cleaner testable code which does the right thing in the first place.<br>
><br>
> Anyway, just food for thought.<br>
><br>
> David Cook<br>
><br>
> Software Engineer<br>
><br>
> Prosentient Systems<br>
><br>
> Suite 7.03<br>
><br>
> 6a Glen St<br>
><br>
> Milsons Point NSW 2061<br>
><br>
> Australia<br>
><br>
> Office: 02 9212 0899<br>
><br>
> Online: 02 8005 0595<br>
><br>
><br>
> _______________________________________________<br>
> Koha-devel mailing list<br>
> <a href="mailto:Koha-devel@lists.koha-community.org" target="_blank" rel="noreferrer">Koha-devel@lists.koha-community.org</a><br>
> <a href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer noreferrer" target="_blank">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
> website : <a href="https://www.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://www.koha-community.org/</a> git : <br>
> <a href="https://git.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://git.koha-community.org/</a> bugs : <br>
> <a href="https://bugs.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://bugs.koha-community.org/</a><br>
<br>
_______________________________________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org" target="_blank" rel="noreferrer">Koha-devel@lists.koha-community.org</a><br>
<a href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer noreferrer" target="_blank">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
website : <a href="https://www.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://www.koha-community.org/</a> git : <a href="https://git.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://git.koha-community.org/</a> bugs : <a href="https://bugs.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://bugs.koha-community.org/</a><br>
<br>
<br>
_______________________________________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org" target="_blank" rel="noreferrer">Koha-devel@lists.koha-community.org</a><br>
<a href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer noreferrer" target="_blank">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
website : <a href="https://www.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://www.koha-community.org/</a><br>
git : <a href="https://git.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://git.koha-community.org/</a><br>
bugs : <a href="https://bugs.koha-community.org/" rel="noreferrer noreferrer" target="_blank">https://bugs.koha-community.org/</a><br>
</blockquote></div>