Deploying on Ubuntu with native services and executables


Installation process

If you prefer having KMS installed in your EC2 machine and your own version of openvidu-server, follow these few steps. Ubuntu xenial 14.04 and Ubuntu trusty 16.04 are supported.

1. Install KMS (in first command: xenial for 16.04, trusty for 14.04)

echo "deb http://ubuntu.kurento.org xenial kms6" | sudo tee /etc/apt/sources.list.d/kurento.list
wget -O - http://ubuntu.kurento.org/kurento.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install kurento-media-server-6.0

2. Install COTURN

sudo apt-get -y install coturn

This is a great implementation of a STUN/TURN server, necessary for connecting your users under some complicated circumstances. You can check its documentation here. If there's any problem with the installation on Ubuntu trusty 14.04:

wget -c http://ftp.us.debian.org/debian/pool/main/c/coturn/coturn_4.2.1.2-1_amd64.deb
sudo dpkg -i coturn_4.2.1.2-1_amd64.deb
sudo apt-get -f -y install
sudo dpkg -i coturn_4.2.1.2-1_amd64.deb

3. File /etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini

stunServerAddress=YOUR_MACHINE_PUBLIC_IP
stunServerPort=3478
turnURL=USER:PASS@YOUR_MACHINE_PUBLIC_IP:3478

4. File /etc/turnserver.conf

external-ip=YOUR_MACHINE_PUBLIC_IP
fingerprint
user=USER:PASS
lt-cred-mech
realm=kurento.org
log-file=/var/log/turnserver/turnserver.log
simple-log

5. File /etc/default/coturn

TURNSERVER_ENABLED=1

6. Init services

sudo service coturn restart
sudo service kurento-media-server-6.0 restart

7A. Init openvidu-server Docker container...

sudo docker run -d -p 8443:8443 -e openvidu.secret=YOUR_SECRET --net="host" openvidu/openvidu-server

To quickly install the latest official stable version of Docker CE:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y install docker-ce

Go to Using your own certificate to add your certificate to the container instead of using the self-signed default one (which will launch a security warning on the user's browser).

7B. ...or init your own openvidu-server executable

java -jar -Dopenvidu.secret=YOUR_SECRET openvidu-server.jar &

Go to Using your own certificate to add your certificate to the JAR instead of using the self-signed default one (which will launch a security warning on the user's browser).

8. Finally check your server

You can connect to OpenVidu dashboard through https://YOUR_MACHINE_PUBLIC_IP:8443 (authorization is OPENVIDUAPP:YOUR_SECRET). Make sure you allow TCP and UDP inbound connections to your machine!

Now you can deploy your application in the same machine (if the app is not pure frontend HTML/CSS/JS and has a secure backend, connect it to OpenVidu Server through https://localhost:8443) or in a different one (connect to OpenVidu server through https://YOUR_MACHINE_PUBLIC_IP:8443).

Server network requirements

In order for this deployment to work, you will have to meet 2 sets of needs in the machine hosting your services:

  • First of all, you certainly need the machine to have a public, reachable IP. The reason is pretty simple: we are precisely installing COTURN service to cover those situations where the final users are hidden behind NATs or complex networks (learn more). If the COTURN itself is running inside an unreachable machine, your video transmission could fail in certain cases.

  • Besides, the server needs some ports opened in the firewall:

    • 3478 TCP & UDP (COTURN listens on port 3478 by default)
    • 49152 - 65535 UDP (WebRTC exchanges media through any of these ports)

If you were still in trouble, we provide a ready-to-use Amazon CloudFormation Stack to easily deploy OpenVidu in a few minutes here.

Architectures

You can have the following scenarios depending on how many machines you have and what architecture you prefer. What are the advantages and disadvantages of each one of them? Well, it really depends on the power of the machine, the nature of your application and the load expected. In general, having all the services running in one machine will reduce its performance and scalability, but on the other hand, makes it easier the process of installation, configuration and launching.

If you are deploying with these instructions for the first time, we recommend using only one machine. When you verify that everything is working as expected, you can try different configurations to compare overall performance and load capacity.

  1. App, OpenVidu Server and KMS run in the same machine
  2. App runs in its own machine. OpenVidu Server and KMS run in the same machine
  3. App, OpenVidu Server and KMS all run in different machines

The instructions above portray scenarios 1 and 2 in the image. In other words, we are supposing that OpenVidu Server and KMS will be hosted in the same machine. The only difference between options 1-2 and option 3 is that for steps 7A and 7B, another parameter is required when launching your openvidu-server:

7A

sudo docker run -d -p 8443:8443 -e openvidu.secret=YOUR_SECRET -e kms.uris=[\"ws://YOUR_KMS_MACHINE_IP:8888/kurento\"] openvidu/openvidu-server

7B

java -jar -Dopenvidu.secret=YOUR_SECRET -Dkms.uris=[\"ws://YOUR_KMS_MACHINE_IP:8888/kurento\"] openvidu-server.jar &