Coturn server going down? Use Monit along with this configuration...

192 views
Skip to first unread message

AB

unread,
Mar 2, 2021, 11:02:09 PM3/2/21
to BigBlueButton-dev
Monit is a fantastic utility for keeping tabs on anything and everything in your *nix environment, and automating execution of predefined commands based on pre-defined criteria. 

One frequent issue with Coturn is that it goes down, and one of the best ways I've found to detect and resolve an outage is using Monit with the following configuration:

Once you install monit, decide whether or not you need the GUI. I would recommend against it and just to stick with command-line. 

// Configuration

check process coturn with pidfile /run/turnserver.pid
start program = "/etc/init.d/coturn start" with timeout 30 seconds
stop program  = "/etc/init.d/coturn start"
if failed port 3478 then restart


Once installed, you can check the logs at /var/log/monit.log to see entries based on identified issues, and subsequent startup activities. 

It's a good idea to give it a few trial runs. You can test your turn server from another host by running:  stunclient --mode full --localport 9999 turn.myturnserver.com

Lorenz Schori

unread,
Mar 3, 2021, 2:55:04 AM3/3/21
to bigblueb...@googlegroups.com
Hi,

On Tue, 2 Mar 2021 20:02:09 -0800 (PST)
AB <abo...@gmail.com> wrote:

> check process coturn with pidfile /run/turnserver.pid
> start program = "/etc/init.d/coturn start" with timeout 30 seconds
> stop program = "/etc/init.d/coturn start"
> if failed port 3478 then restart

Most Linux distributions switched to systemd a long time ago. You
shouldn't be calling init scripts nowadays.

That said, Ubuntu 18.04 regrettably still ships coturn with an init
script which is "converted" into a systemd unit automatically using the
systemd-sysv-generator utility. The problem with that approach is that
systemd will not restart coturn automatically when it goes down. Also
note that in that configuration coturn will unnecessarily run as root.

This is all fixed in Ubuntu 20.04. Thus, please just update your coturn
server to 20.04 (or Debian buster) and it will run as an unprivileged
user and will also be restarted when it crashes.

Cheers,
Lorenz

Sam Raj

unread,
Mar 3, 2021, 3:29:48 AM3/3/21
to bigblueb...@googlegroups.com
My coturn server works properly for 3-4 months and after that the video and screen sharing stops working...Starts working when I restart server but keeps having issues with video and screen sharing..I have to reinstall coturn and again it works for 3-4 months and the process ...continues. So basically every 3-4 months I keep reinstalling coturn. Any ideas on solution.

Sent from my iPhone

> On 03-Mar-2021, at 1:25 PM, Lorenz Schori <lorenz...@gmail.com> wrote:
>
> Hi,
> --
> You received this message because you are subscribed to the Google Groups "BigBlueButton-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bigbluebutton-...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bigbluebutton-dev/20210303085457.1bcc7347%40bonemachine.

AB

unread,
Mar 3, 2021, 8:27:12 AM3/3/21
to BigBlueButton-dev
Good feedback, but the script runs impeccably for me as as of now. Recommendations on command line modifications for launch? I'll test them out and update the post accordingly for the benefit of the community. 

Lorenz Schori

unread,
Mar 3, 2021, 8:50:50 AM3/3/21
to AB, bigblueb...@googlegroups.com
Hi,

On Wed, 3 Mar 2021 05:27:12 -0800 (PST)
AB <abo...@gmail.com> wrote:

> Recommendations on command line modifications for launch

start program = "/bin/systemctl start coturn.service"
stop program = "/bin/systemctl stop coturn.service"

Cheers,
Lorenz

Paulo Lanzarin

unread,
Mar 3, 2021, 9:01:52 AM3/3/21
to bigblueb...@googlegroups.com, AB
> So basically every 3-4 months I keep reinstalling coturn. Any ideas on solution.

There is rarely a grand unified "solution" for things like that. There is a set of prophylactic measures/good practices
you can adopt, though.

Add proper monitoring to your coturn instances.
Do not rely on a single coturn instance. Add failovers. Could be as simple as a DNS round robin.
Try not keeping a single coturn instance up for 4 months straight. Recycle them periodically (as in just restart the service), as you would
do with periodic system updates and reboots.
Do not use coturn on Xenial or Bionic. Prefer the latest stable releases of anything you wish to use (Focal, Buster).

s,

prlanzarin


--
You received this message because you are subscribed to the Google Groups "BigBlueButton-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bigbluebutton-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages