Files
tinypilot-kvm/debian-pkg
Jason Wallace dd8f36e350 Override Janus systemd config (#1622)
Resolves https://github.com/tiny-pilot/tinypilot/issues/1578

This PR overrides the default Janus systemd config in order set
additional systemd settings. Specifically:
```diff
 [Unit]
 Description=Janus WebRTC gateway
 After=network.target
 Documentation=https://janus.conf.meetecho.com/docs/index.html
+# Give up if we restart on failure 20 times within 5 minutes (300 seconds).
+StartLimitIntervalSec=300
+StartLimitBurst=20

 [Service]
 Type=forking
 ExecStart=/usr/bin/janus --disable-colors --daemon --log-stdout
 Restart=on-failure
+RestartSec=1
 LimitNOFILE=65536

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

Janus with STUN requires the network to be online, otherwise `janus`
fails to start. Theses additional settings are needed to allow Janus
with STUN settings a better chance of starting up successfully, by
giving it more chances to restart on failure. Seeing as STUN is an
optional setting, we didn't want Janus to always require an online
network because it might unnecessarily delay TinyPilot's H.264 video
stream.

### Testing

To enable STUN, append the following block to `/etc/janus/janus.jcfg`:

```
nat: {
  stun_server = "stun.gmx.de"
  stun_port = 3478
}
```

Now if you restart your device, the `janus` service should start
successfully on boot. On my device `janus` restarted 8 times in 12
seconds before successfully running.

<a data-ca-tag
href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1622"><img
src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review
on CodeApprove" /></a>
2023-09-14 13:09:48 +02:00
..