#### Pre-Submission Checklist - [ ] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [ ] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [x] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: - [x] PR should be backported to stable branches - [ ] Tested changes locally - [ ] Related to issue #1827
#### Description 1) tmpfiles creation is implemented via systemd 2) owner of kamailio process implemented via systemd drop-in 3) kamailio started as simple process, that allow systemd check kamailio process without PID file. You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1889
-- Commit Summary --
* Init scripts always create kamailio user and group. * Added kamailio.tmpfiles. Directory /run/kamailio is created by command * Starting kamailio as forground process allow systemd not check kamailio PID.
-- File Changes --
M pkg/kamailio/deb/buster/kamailio.default (11) M pkg/kamailio/deb/buster/kamailio.service (10) A pkg/kamailio/deb/buster/kamailio.tmpfiles (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1889.patch https://github.com/kamailio/kamailio/pull/1889.diff
Hello Victor @linuxmaniac Could you look this PR. Changes is spited by commit. After you approve i will squash commit into one and create new commit message like ``` pkg/kamailio/deb: Updated systemd service and tmpfile files ```
mckaygerhard commented on this pull request.
@@ -4,18 +4,16 @@ Wants=network-online.target
After=network-online.target
[Service] -Type=forking +Type=simple +User=kamailio
Hi!, thanks for this pull request.. finally after many fights and ignored mails, but now a small request (if it can be done): there's a way to pass the user and group from environment or invoke command? i mean for packaging.. in debian exits the /etc/default/kamailio file that set user and group...
sergey-safarov commented on this pull request.
@@ -4,18 +4,16 @@ Wants=network-online.target
After=network-online.target
[Service] -Type=forking +Type=simple +User=kamailio
To change username at runtime need place drop-in into `/run/systemd/system/kamailio.service.d` directory and apply changes by `systemctl daemon-reload` For dynamic unit updates you cannot use `/etc/systemd/system/kamailio.service.d` directory.
Also you can use [service templates](https://fedoramagazine.org/systemd-template-unit-files/)
sergey-safarov commented on this pull request.
@@ -4,18 +4,16 @@ Wants=network-online.target
After=network-online.target
[Service] -Type=forking +Type=simple +User=kamailio
`there's a way to pass the user and group from environment or invoke command?` Please look d3cc4e4c10820e538e7cc73b839140e38df09756 kamailio default have complete description how to change user/group of kamailio process.
verticelo commented on this pull request.
@@ -4,18 +4,16 @@ Wants=network-online.target
After=network-online.target
[Service] -Type=forking +Type=simple
How will this interact with the default setting of fork=yes in the config?
# ExecStart requires a full absolute path
-ExecStart=/usr/sbin/kamailio -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP +ExecStart=/usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
Changing to this mode, will it have any impact on performance of Kamailio? If so, in what direction?
sergey-safarov commented on this pull request.
# ExecStart requires a full absolute path
-ExecStart=/usr/sbin/kamailio -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP +ExecStart=/usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
I did not observe the influence
sergey-safarov commented on this pull request.
@@ -4,18 +4,16 @@ Wants=network-online.target
After=network-online.target
[Service] -Type=forking +Type=simple
This systemd setting not kamailio process. Interactions is not exist.
seems systemd made more problems thatn solves https://github.com/kamailio/kamailio/issues/1898
@mckaygerhard your reference not relevant to systemd.
@linuxmaniac - these changes are on systemd unit for debian packaging. Any conclusion on what to do with this PR?
If decided to merge, quash in a single commit and set a proper formatted commit message, because now the commits do not follow the rules.
I ready to squash and update commit after review.
verticelo commented on this pull request.
@@ -4,18 +4,16 @@ Wants=network-online.target
After=network-online.target
[Service] -Type=forking +Type=simple
But, doesn't this determine how systemd monitors the process after the process has started, ie. if the kamailio process forks or not?
sergey-safarov commented on this pull request.
@@ -4,18 +4,16 @@ Wants=network-online.target
After=network-online.target
[Service] -Type=forking +Type=simple
yes, that is determines how to monitor kamailio process. I suggest to start kamailio with `-DD` option. In this case kamailio main process control own child's, and systemd monitors only kamailio main process.
@linuxmaniac - any conclusion this one?
Does this one still needs to be addressed, or are we fine with the version included in the deb/rpm packages right now?
Daniel-Constantin Mierla writes:
Does this one still needs to be addressed, or are we fine with the version included in the deb/rpm packages right now?
It works right now (with the syslog message), but according systemd documentation, the dir is /run, not /var/run:
https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDi...
Perhaps the best would be to use $RUNTIME_DIRECTORY environment var.
-- Juha
Now unit contains ``` RuntimeDirectory=kamailio ``` According docs
The specified directory names must be relative, and may not include "..". If set, one or more directories by the specified names will be created (including their parents) below the locations defined in the following table, when the unit is started.
According table base patch for relative directory is `/run` (`Below path for system units` column).
Look as current definition correct
sergey-safarov writes:
Now unit contains
RuntimeDirectory=kamailio
...
Look as current definition correct
Yes, RuntimeDirectory is correct, but not this:
PIDFile=/var/run/kamailio/kamailio.pid
since it hardwires /var/run rather than using $RUNTIME_DIRECTORY.
-- Juha
ac21d494253eddd085197e2862c3206efff8233a 0436af5abd8b73e17f65020c74943f0f3b72ba0d
Closed #1889.