Add systemd service file

Bug #1666456 reported by Danilo Bargen
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coturn (Ubuntu)
New
Undecided
Unassigned

Bug Description

Coturn provides a service file example here: https://github.com/coturn/coturn/blob/master/rpm/turnserver.service.fc Would be great if this could be added to the package to replace the init script.

Revision history for this message
Danilo Bargen (gwrtheyrn) wrote :

Here is an example file that seems to work fine:

```
[Unit]
Description=coturn
Documentation=man:coturn(1) man:turnadmin(1) man:turnserver(1)
After=syslog.target network.target

[Service]
Type=forking
User=turnserver
Group=turnserver
RuntimeDirectory=turnserver
RuntimeDirectoryMode=0750
EnvironmentFile=/etc/default/coturn
PIDFile=/run/turnserver/turnserver.pid
ExecStart=/usr/bin/turnserver --daemon --pidfile /run/turnserver/turnserver.pid --syslog -c /etc/turnserver.conf $EXTRA_OPTIONS
Restart=on-abort
LimitCORE=infinity
LimitNOFILE=1000000
LimitNPROC=60000
LimitRTPRIO=infinity
LimitRTTIME=7000000
CPUSchedulingPolicy=other
UMask=0007

[Install]
WantedBy=multi-user.target
```

To enable verbose logging, /etc/default/coturn should contain `EXTRA_OPTIONS=-v`.

To bind to port 443, the /usr/bin/turnserver binary needs the CAP_NET_BIND_SERVICE capability (`setcap /usr/bin/turnserver cap_net_bind_service=+ep`).

Revision history for this message
pablo (pablo-platt) wrote :

Danilo, is it possible to install the package, disable the init script and manually add this service file?
Maybe leaving TURNSERVER_ENABLED=0 in /etc/default/coturn is enough?

Revision history for this message
Danilo Bargen (gwrtheyrn) wrote :

Yes, it is possible to manually add a systemd unit file to the package, but it would be good if this were supported natively by the Ubuntu package.

Revision history for this message
pablo (pablo-platt) wrote :

Why does this unit file have differences compared to the rpm unit file?
https://github.com/coturn/coturn/blob/master/rpm/turnserver.service.fc

1. The PIDFile is under /run although both the rpm and the ubuntu init.d file use /var/run
2. ExecStart adds --pidfile in addition to PIDFile. Isn't this redundant?
3. ExecStart adds --syslog. why?
4. ExecStopPost is removed.
5. LimitNOFILE=1000000 compared to 999999

Thanks

Revision history for this message
Danilo Bargen (gwrtheyrn) wrote :

Hm, I don't actually remember where I based that file on, sorry... The difference are not deliberate, or at least not by me.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.