Skip to content
This repository was archived by the owner on Oct 6, 2026. It is now read-only.
This repository was archived by the owner on Oct 6, 2026. It is now read-only.

Targeted systemd implementation with /etc configuration #91

Closed as not planned

Description

@benjaoming

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.

  • We can keep the service's user configuration in /etc/kolibri such that it's shared with.
  • /etc/default/kolibri stops being used.
  • /etc/kolibri/conf.d to ONLY support setting environment variables. Essentially nothing changes since we never documented anything else than setting the environment there.
  • Ensure that sudo service kolibri start also uses the systemd service. CLARIFY
  • Kolibri could adapt to being supervised, like for instance redis --supervised. Maybe we can just use --foreground or make an alias --supervised which we adapt in case behavior changes later.

Ingredients for writing a new systemd service:

  • Load distributed daemon.conf: EnvironmentFile=/etc/kolibri/daemon.conf UNCHANGED
  • Load user added environment: EnvironmentFile=/etc/kolibri/conf.d/*.conf UNCHANGED
  • Set User and Group in [Services]: /etc/systemd/system/kolibri.service.d/user.conf example. This would mean to either stop using /etc/kolibri/username and/or add a utility script that moves it CHANGED

Background

Activity

  1. added a commit that references this issue on Apr 14, 2020
  2. benjaoming commented on Apr 14, 2020

    @benjaoming
    ContributorAuthor

    Related: #85

  3. benjaoming commented on Apr 15, 2020

    @benjaoming
    ContributorAuthor

    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.

  4. rtibbles commented on Oct 4, 2026

    @rtibbles
    Member

    Closing as stale ahead of archiving this repository. The Debian package now lives in the Kolibri monorepo; please open a fresh issue on learningequality/kolibri if this is still wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions