2020-04-10 01:41:33 +02:00
# Openvidu Platform deployment
2020-03-25 17:30:41 +01:00
2020-03-28 20:41:22 +01:00
> **IMPORTANT NOTE:** This procedure is in development an can change in any moment. Please use it with care and visit the page with frecuency.
2020-03-25 17:30:41 +01:00
2020-04-10 01:41:33 +02:00
This document describes how to deploy OpenVidu Platform. It allows also to deploy OpenVidu Call videoconference application.
2020-03-25 17:30:41 +01:00
2020-04-10 01:41:33 +02:00
OpenVidu Platform is deployed as a set of docker containers managed with a docker-compose (Kubernetes Helm chart is in the works). Docker basic knowledge is not required, but recommended.
This procedure installs the following services:
2020-03-28 20:41:22 +01:00
- **OpenVidu Server (openvidu-server)**: This is the brain of OpenVidu platform. The signaling plane.
- **Kurento Media Server (kms)**: This is the hearth of the OpenVidu platform. In charge of media plane.
2020-03-29 01:10:10 +01:00
- **Coturn (coturn)**: Service used to allow media communications with browsers in certain special networks.
- **Redis (redis)**: Database to manage users in Coturn server.
- **Nginx (nginx)**: A reverse proxy used to configure SSL certificate and to allow both Openvidu Server and the Application in the standard https port (443).
2020-04-10 01:41:33 +02:00
- **Videoconference Application (app)**: OpenVidu Call application or any other application. Can be disabled.
2020-03-28 20:41:22 +01:00
## 1. Prerequisites
2020-04-10 01:41:33 +02:00
OpenVidu Platform can only be installed in Linux. Mac and Windows is not supported for production use. If you want to develop in Mac or Windows, please follow the [tutorials ](https://docs.openvidu.io/en/2.12.0/tutorials/ ) to see how to execute OpenVidu in a single docker container.
You can use any modern Linux distribution supported by docker. We have tested with Ubuntu 18.04.
You will need docker and docker-compose installed in your linux distribution.
2020-03-25 17:30:41 +01:00
- [Install Docker ](https://docs.docker.com/install/linux/docker-ce/ubuntu/ )
- [Install Docker Compose ](https://docs.docker.com/compose/install/ )
2020-03-28 20:41:22 +01:00
Open ports:
2020-04-10 02:27:00 +02:00
- 22 TCP: To connect using SSH to admin OpenVidu.
2020-03-28 20:41:22 +01:00
- 80 TCP: If you select Let's Encrypt to generate an SSL certificate this port is used by the generation process.
- 443 TCP: OpenVidu server and application are published in standard https port.
- 3478 TCP: Used by TURN Server to stablish media connections.
- 3478 UDP: Used by TURN Server to stablish media connections.
- 40000 - 57000 UDP: Ports used by Kurento Media Server to stablish media connections.
- 57001 - 65535 UDP: Used by TURN Server to stablish media connections.
2020-03-30 02:33:36 +02:00
It is important to have a **domain name** pointing to the machine where you are are going to deploy OpenVidu. The platform is deployed using https because is mandatory to use WebRTC. Then, if you do not have a domain name, an ugly warning will appear to your users when enter to your site. And, of course, you can suffer a man in the middle attack. You don't need a valid SSL certificate as one can be created by Let's Encrypt in the installation process.
2020-04-10 01:41:33 +02:00
## 2. Deployment
2020-03-26 16:24:09 +01:00
2020-04-10 01:41:33 +02:00
Execute the following command to download and execute the installation script:
2020-04-08 16:09:09 +02:00
2020-04-10 01:41:33 +02:00
`curl https://raw.githubusercontent.com/OpenVidu/openvidu/master/openvidu-server/docker/openvidu-docker-compose/install_openvidu.sh | bash`
2020-03-26 16:24:09 +01:00
2020-04-10 01:41:33 +02:00
It will donwload all required files into `openvidu` folder and will show this message with basic instructions:
2020-03-26 16:24:09 +01:00
2020-03-28 20:42:58 +01:00
```
2020-03-26 16:24:09 +01:00
2020-04-10 01:41:33 +02:00
Openvidu Platform successfully installed.
1. Go to openvidu folder:
$ cd openvidu
2020-04-08 16:09:09 +02:00
2020-05-04 17:10:11 +02:00
2. Configure DOMAIN_OR_PUBLIC_IP and OPENVIDU_SECRET in .env file:
2020-04-10 01:41:33 +02:00
$ nano .env
2020-04-08 16:09:09 +02:00
2020-04-10 01:41:33 +02:00
3. Start OpenVidu
$ ./openvidu start
2020-04-08 16:09:09 +02:00
2020-04-10 01:41:33 +02:00
For more information, check readme.md
```
2020-04-08 16:09:09 +02:00
2020-03-26 16:24:09 +01:00
2020-04-10 01:41:33 +02:00
## 3. Configuration
2020-03-26 16:24:09 +01:00
2020-04-10 01:41:33 +02:00
OpenVidu Platform configuration is specified in the `.env` file with environment variables.
2020-05-04 17:10:11 +02:00
**YOU MUST** specify the **DOMAIN_OR_PUBLIC_IP** of the machine and the **OPENVIDU_SECRET** . They are empty and execution will fail if you do not specify them.
2020-03-30 02:33:36 +02:00
If you have a domain name, generate a certificate with Let's Encrypt or put your own certificate.
2020-03-29 05:17:33 +02:00
2020-04-10 01:41:33 +02:00
All other configuration properties comes with sane defaults.
2020-03-26 16:24:09 +01:00
2020-04-10 01:41:33 +02:00
The `.env` file looks like this:
2020-03-28 20:41:22 +01:00
```
# OpenVidu configuration
# ----------------------
2020-04-21 19:47:21 +02:00
# Documentation: https://docs.openvidu.io/en/stable/reference-docs/openvidu-config/
2020-03-26 16:24:09 +01:00
2020-04-10 01:41:33 +02:00
# NOTE: This file doesn't need to quote assignment values, like most shells do.
# All values are stored as-is, even if they contain spaces, so don't quote them.
2020-03-26 16:24:09 +01:00
2020-03-28 20:41:22 +01:00
# Domain name. If you do not have one, the public IP of the machine.
2020-04-10 01:41:33 +02:00
# For example: 198.51.100.1, or openvidu.example.com
2020-05-04 17:10:11 +02:00
DOMAIN_OR_PUBLIC_IP=
2020-03-27 16:09:32 +01:00
2020-04-10 01:41:33 +02:00
# OpenVidu SECRET used for apps to connect to OpenVidu server and users to access to OpenVidu Dashboard
OPENVIDU_SECRET=
2020-03-27 16:09:32 +01:00
2020-04-10 01:41:33 +02:00
# Certificate type:
# - selfsigned: Self signed certificate. Not recommended for production use.
2020-03-28 20:41:22 +01:00
# Users will see an ERROR when connected to web page.
# - owncert: Valid certificate purchased in a Internet services company.
2020-04-14 14:27:36 +02:00
# Please put the certificates files inside folder ./owncert
# with names certificate.key and certificate.cert
2020-04-10 01:41:33 +02:00
# - letsencrypt: Generate a new certificate using letsencrypt. Please set the
# required contact email for Let's Encrypt in LETSENCRYPT_EMAIL
2020-03-28 20:41:22 +01:00
# variable.
CERTIFICATE_TYPE=selfsigned
2020-03-27 16:09:32 +01:00
2020-04-14 14:05:01 +02:00
# If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for notifications
2020-03-28 20:41:22 +01:00
LETSENCRYPT_EMAIL=user@example.com
2020-04-10 01:41:33 +02:00
...
2020-03-28 20:41:22 +01:00
```
2020-03-26 16:24:09 +01:00
2020-04-10 01:41:33 +02:00
> **NOTE:** If you want to try OpenVidu in your linux development machine:
2020-05-04 17:10:11 +02:00
> * If you set `DOMAIN_OR_PUBLIC_IP=localhost` then in your browser you have to use `https://localhost/`. If you use `https://127.0.0.1/` instead, you will have some issues.
2020-04-10 01:41:33 +02:00
> * OpenVidu services will use some host ports that have to be available: 80, 3478, 5442, 5443, 8888 and 6379.
2020-03-30 18:56:23 +02:00
2020-03-28 20:41:22 +01:00
### Videoconference application
2020-03-26 16:24:09 +01:00
2020-04-14 13:35:50 +02:00
By default, the [OpenVidu Call application ](https://docs.openvidu.io/en/stable/demos/openvidu-call/ ) is deployed alongside OpenVide Platform. It is accesible in the URL:
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
```
2020-04-10 01:41:33 +02:00
https://openvidu_domain_or_public_ip/
2020-03-28 20:41:22 +01:00
```
2020-03-27 16:09:32 +01:00
2020-04-10 01:41:33 +02:00
This application is defined in the file `docker-compose.override.yml` .
To disable OpenVidu Call application, you can delete the file `docker-compose.override.yml` (or renaming it in case you want to enable again in the future).
2020-03-27 16:09:32 +01:00
2020-04-10 01:41:33 +02:00
You can configure any other application updating the content of `docker-compose.override.yml` with the following requirements:
* Application server port must to be binded to 5442 in the host, as this port is used by NGINX to publish your app in port default https port (443).
2020-03-28 20:41:22 +01:00
* The application must be served in plain http as NGINX is the responsible of managing SSL certificate.
2020-04-10 01:41:33 +02:00
* Application has to know OpenVidu Server URL. You can use the variables ${DOMAIN_OR_PUBLIC_IP} and ${OPENVIDU_SECRET} in `docker-compose.override.yml` file.
2020-04-10 01:48:26 +02:00
* The application and OpenVidu platform are deployed in the same domain. For that reason, the following URLs are reserved for OpenVidu and you cannot use them in the application:
* `/api/`
* `/openvidu/`
* `/dashboard/`
2020-03-27 16:09:32 +01:00
2020-04-10 01:41:33 +02:00
## 4. Execution
2020-03-27 16:09:32 +01:00
2020-04-10 01:41:33 +02:00
To start OpenVidu Platform (and the application if enabled) you can execute this command:
2020-03-27 16:46:32 +01:00
2020-04-10 01:41:33 +02:00
```
$ ./openvidu start
```
2020-03-27 16:46:32 +01:00
2020-04-10 01:41:33 +02:00
Then, all docker images for services will be downloaded (only the first time) and executed.
2020-03-27 16:46:32 +01:00
2020-04-10 01:41:33 +02:00
The first part of the log shows how to docker-compose command execute all services:
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
```
2020-03-29 01:10:10 +01:00
Creating openvidu-docker-compose_coturn_1 ... done
2020-03-28 20:41:22 +01:00
Creating openvidu-docker-compose_app_1 ... done
Creating openvidu-docker-compose_kms_1 ... done
2020-03-29 01:10:10 +01:00
Creating openvidu-docker-compose_nginx_1 ... done
Creating openvidu-docker-compose_redis_1 ... done
2020-03-28 20:41:22 +01:00
Creating openvidu-docker-compose_openvidu-server_1 ... done
```
2020-03-27 16:46:32 +01:00
2020-04-10 01:41:33 +02:00
Then, `openvidu-server` service logs are shown.
2020-03-30 02:33:36 +02:00
2020-03-29 01:10:10 +01:00
When OpenVidu Platform is ready you will see this message:
```
----------------------------------------------------
OpenVidu Platform is ready!
---------------------------
* OpenVidu Server: https://server/
* OpenVidu Dashboard: https://server/dashboard/
----------------------------------------------------
```
2020-04-10 01:41:33 +02:00
You can press `Ctrl+C` to come back to the shell and OpenVidu will be executed in the background.
If the application is enabled, it is available in `https://server/` .
You can open OpenVidu Dashboard to verify if the platform is working as expected go to `https://server/dashboard/` with credentials:
* user: OPENVIDUAPP
* password: the value of OPENVIDU_SECRET in `.env` file.
## 6. Stop execution
To stop the platform execute:
```
$ ./openvidu stop
```
## 6. Changing configuration
2020-03-29 01:10:10 +01:00
2020-04-10 01:41:33 +02:00
To change the configuration:
* Change configuration in `.env` file
* Restart the service with command:
2020-03-29 01:10:10 +01:00
2020-04-10 01:41:33 +02:00
```
$ ./openvidu restart
```
2020-03-30 02:34:27 +02:00
2020-04-10 01:41:33 +02:00
## 5. Problems
### Configuration errors
If you have any problem with the configuration, when you start OpenVidu the following report will be shown:
2020-03-30 02:34:27 +02:00
```
Configuration errors
--------------------
* Property OPENVIDU_SECRET is not set. Cannot be empty.
2020-05-04 17:10:11 +02:00
* Property DOMAIN_OR_PUBLIC_IP is not set. Cannot be empty
2020-03-30 02:34:27 +02:00
Fix config errors
---------------
1) Return to shell pressing Ctrl+C
2) Set correct values in '.env' configuration file
3) Restart OpenVidu with:
2020-04-10 01:41:33 +02:00
$ ./openvidu restart
2020-03-30 02:34:27 +02:00
2020-03-30 18:59:03 +02:00
```
2020-04-10 01:41:33 +02:00
### Docker compose
2020-03-28 20:41:22 +01:00
2020-04-10 01:41:33 +02:00
To solve any other issue, it is important to understand how openvidu is executed.
2020-03-30 18:59:03 +02:00
2020-04-10 01:41:33 +02:00
OpenVidu is executed as a docker-compose file. The commands executed by the script are the standard docker-compose commands:
2020-03-28 20:41:22 +01:00
2020-04-10 01:41:33 +02:00
* start
* `$ docker-compose up -d`
* `$ docker-compose logs -f openvidu-server`
* stop
* `$ docker-compose down`
* restart
* `$ docker-compose down`
* `$ docker-compose up -d`
* `$ docker-compose logs -f openvidu-server`
* logs
* `$ docker-compose logs -f openvidu-server`
As you can see, logs of `openvidu-server` service are shown when platform is started or restarted. This log contains the most important information for the OpenVidu execution.
2020-03-29 01:10:10 +01:00
2020-03-30 02:33:36 +02:00
### Show service logs
2020-03-28 20:41:22 +01:00
2020-03-29 01:10:10 +01:00
Take a look to service logs to see what happen. First, see openvidu-server logs:
```
2020-04-10 01:41:33 +02:00
$ ./openvidu logs
2020-03-29 01:10:10 +01:00
```
Then, you can see all service logs togheter:
2020-03-28 20:41:22 +01:00
`$ docker-compose logs -f`
2020-03-29 01:10:10 +01:00
Or you can inspect one by one the other services:
2020-03-28 20:41:22 +01:00
2020-03-28 20:42:58 +01:00
```
$ docker-compose logs -f kms
2020-03-29 01:10:10 +01:00
$ docker-compose logs -f nginx
$ docker-compose logs -f coturn
$ docker-compose logs -f redis
2020-03-28 20:42:58 +01:00
$ docker-compose logs -f app
```
2020-03-30 02:33:36 +02:00
### Review the configuration
2020-04-10 01:41:33 +02:00
Sometimes, we can have a typo when writing a property name. For this reason, openvidu-server print in the log all the configuration properties you are configured in `.env` file and the default values for all other config properties. In that way, you can double check what openvidu-server *see* .
2020-03-30 02:33:36 +02:00
If `openvidu-server` detects some error, it will show it in the log.
```
Configuration properties
---------------------
* CERTIFICATE_TYPE=selfsigned
* OPENVIDU_CDR=false
2020-04-19 00:56:07 +02:00
* OPENVIDU_CDR_PATH=/opt/openvidu/cdr
2020-05-04 17:10:11 +02:00
* DOMAIN_OR_PUBLIC_IP=my.domain.com
2020-04-21 13:55:45 +02:00
* OPENVIDU_RECORDING=false
2020-03-30 02:33:36 +02:00
* OPENVIDU_RECORDING_AUTOSTOP-TIMEOUT=120
* OPENVIDU_RECORDING_COMPOSED-URL=
...
```
2020-04-15 13:46:58 +02:00
### Java options
To use java options in openvidu-server change the property `JAVA_OPTIONS` in configuration file `.env`
For more information about posible values for java option visit [Configuring Java Options ](https://docs.oracle.com/cd/E37116_01/install.111210/e23737/configuring_jvm.htm#OUDIG00007 )
2020-03-30 02:33:36 +02:00
### Change log level of the services
To change the level of `openvidu-server` logs change the property `OV_CE_DEBUG_LEVEL` .
2020-03-28 20:41:22 +01:00
2020-03-30 02:33:36 +02:00
To change the level of Kurento Media Server `kms` logs change the property `KMS_DEBUG_LEVEL` . For more information about possible values visit https://doc-kurento.readthedocs.io/en/stable/features/logging.html
2020-03-27 16:46:32 +01:00
2020-03-30 02:33:36 +02:00
### Change Kurento Media Server docker image
2020-03-27 16:46:32 +01:00
2020-03-30 02:33:36 +02:00
OpenVidu and Kurento Media Server evolves at different rithm. Sometimes, it is possible that a new KMS is released but OpenVidu is not still updated. In that case, in case you hit a bug and that bug is solved in last KMS version, you can test if updating only KMS is working for you. `KMS_IMAGE` property allows you to specify the new KMS image.