[SR-Users] systemd kamailio.service - RFC Wants=network-online.target

Kevin Olbrich ko at sv01.de
Tue Nov 6 13:11:49 CET 2018


> Also you may want change
> Restart=on-failure
>

Absolutely agree with this. Should I create a PR on GH for all three
changes?
Any concerns?

Kind regards
Kevin


> вт, 6 нояб. 2018 г. в 14:54, Kevin Olbrich <ko at sv01.de>:
>
>> Hi!
>>
>> The systemd kamailio.service file for debian (in my case, it's stretch)
>> has the following unit options set:
>>
>> [Unit]
>>> Description=Kamailio (OpenSER) - the Open Source SIP Server
>>> After=network.target
>>
>>
>> It would be better to change this to:
>>
>> [Unit]
>>> Description=Kamailio (OpenSER) - the Open Source SIP Server
>>> Wants=network-online.target
>>> After=network-online.target
>>
>>
>> Why? With network.target the service starts as soon as the network setup
>> is started, not explicitly after configuring (=IP) it [1].
>> This creates a race condition on very fast hardware like mine (booting
>> incl. all services takes 10s).
>>
>> Even with static IPs, kamailio often fails directly at boot because eth1
>> (connection to DB cluster) is not up.
>> [I have never met this problem on systems which ran on HDDs.]
>>
>> Setting "network-online.target" as Wants + After makes sure, Kamailio is
>> started after all interfaces are ready to serve.
>>
>> Units that strictly require a configured network connection should pull
>>> in network-online.target (via a Wants= type dependency) and order
>>> themselves after it. This target unit is intended to pull in a service that
>>> delays further execution until the network is sufficiently set up. What
>>> precisely this requires is left to the implementation of the network
>>> managing service.
>>
>>
>> Perfect example for this is the Shorewall package (firewall solution):
>>
>> [Unit]
>>> Description=Shorewall IPv4 firewall
>>> Wants=network-online.target
>>> After=network-online.target
>>> Conflicts=iptables.service firewalld.service
>>
>>
>> RFC
>>
>> Kind regards
>> Kevin
>>
>> [1] https://www.freedesktop.org/software/systemd/man/systemd.special.html
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181106/61697b55/attachment.html>


More information about the sr-users mailing list