Replacing koha-plack, koha-start-zebra, etc with systemd services?
Hi all, I'm about to start working on a systemd service for running Plack (for a non-package Koha install), and I was wondering if anyone else has thought about or is using systemd services for Plack, Zebra, etc. Mason did a great job with a systemd service https://github.com/KohaAloha/koha-mysql-init/blob/master/koha-mysql-init.ser vice for getting around the autoincrement issue (fixed in MySQL 8.0 https://dev.mysql.com/doc/refman/8.0/en/innodb-auto-increment-handling.html and MariaDB 10.2.4 https://mariadb.com/kb/en/library/auto_increment/). Anyway, once I've got something working, I'm happy to share it. Curious if anyone has any systemd unit files they'd like to share. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Direct: 02 8005 0595
Hi all, Here's what I came up with. I based the command against the koha-plack script. I think a person could use systemd "instances" to make some of the command arguments more dynamic, which you'd want for a package install. One could also explore other configuration options. I suppose we could also have a wrapper script executed instead of executing starman directly. Lots of possibilities! SystemD Service File: ################################################################## [Unit] Description=Koha Test Plack [Service] ExecStart=/usr/bin/starman \ --max-requests 50 \ --workers 2 \ --access-log /opt/koha/logs/plack.log \ --error-log /opt/koha/logs/plack-error.log \ -E deployment \ --socket /opt/koha/var/plack.sock \ /opt/koha/plack.psgi Environment=PERL5LIB=/opt/koha/lib Environment=KOHA_CONF=/opt/koha/etc/koha-conf.xml Environment=KOHA_HOME=/opt/koha Restart=always RestartSec=15 [Install] WantedBy=multi-user.target ################################################################## David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Direct: 02 8005 0595 From: koha-devel-bounces@lists.koha-community.org [mailto:koha-devel-bounces@lists.koha-community.org] On Behalf Of David Cook Sent: Tuesday, 23 October 2018 1:07 PM To: koha-devel@lists.koha-community.org Subject: [Koha-devel] Replacing koha-plack, koha-start-zebra, etc with systemd services? Hi all, I'm about to start working on a systemd service for running Plack (for a non-package Koha install), and I was wondering if anyone else has thought about or is using systemd services for Plack, Zebra, etc. Mason did a great job with a systemd service https://github.com/KohaAloha/koha-mysql-init/blob/master/koha-mysql-init.ser vice for getting around the autoincrement issue (fixed in MySQL 8.0 https://dev.mysql.com/doc/refman/8.0/en/innodb-auto-increment-handling.html and MariaDB 10.2.4 https://mariadb.com/kb/en/library/auto_increment/). Anyway, once I've got something working, I'm happy to share it. Curious if anyone has any systemd unit files they'd like to share. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Direct: 02 8005 0595
On Tue, Oct 23, 2018 at 01:07:17PM +1100, David Cook wrote:
I'm about to start working on a systemd service for running Plack (for a non-package Koha install), and I was wondering if anyone else has thought about or is using systemd services for Plack, Zebra, etc.
I'm currently faking it with init.d-scripts-under-systemd for zebra, sip, and ncip services, but I have created a couple real systemd config files for koha-under-plack. Converting sip/ncip/zebra from init.d scripts is on my to-do list, but, well... I'm no systemd expert (not even a systemd fan, but that's the way the wind is blowing) and don't really know what I'm doing with systemd service files, so they're very basic and could almost certainly be improved upon, but they do work. --- koha-opac.service --- [Unit] Description=Koha opac backend After=network.target [Service] Type=forking PIDFile=/var/run/koha/opac.pid User=www-data Group=www-data ExecStart=/etc/nginx/starman/opac-server.sh ExecReload=/bin/kill -HUP $MAINPID ExecStop=/bin/kill $MAINPID Restart=always [Install] WantedBy=multi-user.target --- koha-staff.service --- [Unit] Description=Koha staff backend After=network.target [Service] Type=forking PIDFile=/var/run/koha/staff.pid User=www-data Group=www-data ExecStart=/etc/nginx/starman/staff-server.sh ExecReload=/bin/kill -HUP $MAINPID ExecStop=/bin/kill $MAINPID Restart=always [Install] WantedBy=multi-user.target -- Dave Sherohman
Hi, Welcome to a new world of SystemD. We run all services with it (on Ubuntu Xenial) : starman, zebra server, zebra indexing and SIP server. Its really easy. We have added some tricks in ExecStartPre and ExecPostStop. Starman launcher uses a config file plack.cfg to allow workers tuning from koha home (awesome). Nginx and Memcached packages uses system launchers. Here are our files, dont hesitate to ask for more details. In the future, we would like to replace crontab. Play with : systemctl --no-legend --all list-units starman.service koha-*.service Regards, Le 23/10/2018 à 04:07, David Cook a écrit :
Hi all,
I'm about to start working on a systemd service for running Plack (for a non-package Koha install), and I was wondering if anyone else has thought about or is using systemd services for Plack, Zebra, etc.
Mason did a great job with a systemd service https://github.com/KohaAloha/koha-mysql-init/blob/master/koha-mysql-init.ser vice for getting around the autoincrement issue (fixed in MySQL 8.0 https://dev.mysql.com/doc/refman/8.0/en/innodb-auto-increment-handling.html and MariaDB 10.2.4 https://mariadb.com/kb/en/library/auto_increment/).
Anyway, once I've got something working, I'm happy to share it. Curious if anyone has any systemd unit files they'd like to share.
David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St
Ultimo, NSW 2007
Australia
Office: 02 9212 0899
Direct: 02 8005 0595
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
-- Fridolin SOMERS <fridolin.somers@biblibre.com> BibLibre, France - software and system maintainer
Thanks, Frido! Looking forward to taking a look. I'd love to replace the crontab some day too! David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Direct: 02 8005 0595 -----Original Message----- From: koha-devel-bounces@lists.koha-community.org [mailto:koha-devel-bounces@lists.koha-community.org] On Behalf Of Fridolin SOMERS Sent: Tuesday, 13 November 2018 7:57 PM To: koha-devel@lists.koha-community.org Subject: Re: [Koha-devel] Replacing koha-plack, koha-start-zebra, etc with systemd services? Hi, Welcome to a new world of SystemD. We run all services with it (on Ubuntu Xenial) : starman, zebra server, zebra indexing and SIP server. Its really easy. We have added some tricks in ExecStartPre and ExecPostStop. Starman launcher uses a config file plack.cfg to allow workers tuning from koha home (awesome). Nginx and Memcached packages uses system launchers. Here are our files, dont hesitate to ask for more details. In the future, we would like to replace crontab. Play with : systemctl --no-legend --all list-units starman.service koha-*.service Regards, Le 23/10/2018 à 04:07, David Cook a écrit :
Hi all,
I'm about to start working on a systemd service for running Plack (for a non-package Koha install), and I was wondering if anyone else has thought about or is using systemd services for Plack, Zebra, etc.
Mason did a great job with a systemd service https://github.com/KohaAloha/koha-mysql-init/blob/master/koha-mysql-in it.ser vice for getting around the autoincrement issue (fixed in MySQL 8.0 https://dev.mysql.com/doc/refman/8.0/en/innodb-auto-increment-handling .html and MariaDB 10.2.4 https://mariadb.com/kb/en/library/auto_increment/).
Anyway, once I've got something working, I'm happy to share it. Curious if anyone has any systemd unit files they'd like to share.
David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St
Ultimo, NSW 2007
Australia
Office: 02 9212 0899
Direct: 02 8005 0595
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
-- Fridolin SOMERS <fridolin.somers@biblibre.com> BibLibre, France - software and system maintainer
participants (3)
-
Dave Sherohman -
David Cook -
Fridolin SOMERS