learningequality / kolibri-installer-debian

Kolibri installer source for Debian
MIT License
0 stars 8 forks source link

Targeted systemd implementation with /etc configuration #91

Open benjaoming opened 4 years ago

benjaoming commented 4 years ago

Background

We can adapt our systemd implementation to be more in line with normal systemd services.

As a user/system admin, I prefer reading a simple script in /etc/init.d/kolibri to understand how to run and configure a system service.

As a developer/maintainer, I prefer systemd as it is easier to define services, and we can remove all of kolibri's daemon behavior.

But in light of issues ( #90 ) with the systemd daemon, we could want to maintain a pattern that separates the sysvinit script from systemd and lets systemd manage Kolibri as a New-style daemon.

Example

Here's how simple Kolibri's service file could be, given that we just let systemd manage everything:

image

What doesn't work in this example is that systemd will kill and respawn Kolibri too fast when it does reloads. Kolibri won't be able to re-bind to its TCP port that quickly.

A full implementation

Systemd is designed with patterns for users to override distributed files, e.g. sudo systemctl edit --full kolibri will create a local replacement, and sudo systemctl edit kolibri will amend to the distributed configuration. These are patterns that maybe people will get more used to in the future, as opposed to editing /etc/init.d/kolibri and such anti-patterns.

Ingredients for writing a new systemd service:

Background

benjaoming commented 4 years ago

Related: #85

benjaoming commented 4 years ago

Related: #66

If implementing a more clean systemd version, we should also consider to add calls to kolibri manage migrate to install / upgrade processes in postinst, before starting the service. This can ensure that Kolibri doesn't need migrations while systemctl start kolibri is waiting for the process to fork.