Skip to content

apache: uwsgi: Ship a systemd unit file

Currently, two applications - radicale and searx use uwsgi. bepasty is joining them, !1879 (closed). All of these apps are started using a single init.d script. There are several issues:

  • We are unable to provide proper security sandboxing to each of the apps individually.
  • We need to restart all the apps if configuration for one of them changes.
  • To enable/disable the apps, we need to check if their configuration file is linked properly instead of checking if the daemon is enabled.
  • There seem to be issues in the init.d script that prevent proper restart of the apps especially after they are enabled/disabled.
  • Socket activation is not possible.

To fix the problem:

  • Create and ship a systemd unit file as part of the apache module.
  • The unit file will be parametrized. Each app will then be a separate unit/daemon.
  • Disable the old init.d script and migrate the apps to use the new systemd unit.
  • Drop the Uwsgi component if no longer needed and simply use the Daemon component. Remove any unnecessary code.
  • Each app runs under its own user. Preferably with PrivateUsers=True.
  • All logs should be redirected to stdout collected by systemd (or syslog).
  • The unit file must have socket activation enabled.
  • Security sandboxing settings must be enabled.

See examples of systemd units provided by uwsgi documentation.