openvidu/openvidu-server/docker/openvidu-docker-compose/readme.md

179 lines
7.8 KiB
Markdown
Raw Normal View History

2020-03-28 20:41:22 +01:00
# Openvidu CE deployment with docker-compose
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-03-28 20:41:22 +01:00
This document describes how to deploy OpenVidu CE alongside OpenVidu Call (a basic videoconference application) using docker-compose.
2020-03-25 17:30:41 +01:00
2020-03-28 20:41:22 +01:00
Services installed following these instructions are:
- **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.
- **TURN Server (openvidu-coturn)**: Service used to allow media communications with browsers in certain networks.
- **Redis (redis-db)**: Database to manage users in TURN server.
- **Nginx (openvidu-proxy)**: A reverse proxy used to configure SSL certificate and to allow both Openvidu Server and the Application in the standard https port (443).
- **Videoconference Application (app)**: A videoconference application deployed for demo porpouses. This application can be easily unistalled or changed by other application.
> TODO: Change the service names for generic ones: openvidu-coturn > coturn, redis-db > redis, openvidu-proxy > nginx.
## 1. Prerequisites
You will need docker and docker-compose installed in your linux distribution. In theory, you can use any modern linux distribution, but we have tested with Ubuntu 18.04.
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
It is recommended to know basic concepts about docker and docker-compose to deploy and operate OpenVidu CE platform.
2020-03-25 17:30:41 +01:00
2020-03-28 20:41:22 +01:00
Open ports:
2020-03-26 16:24:09 +01:00
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.
- 57001 - 65535 TCP: Used by TURN Server to stablish media connections.
## 2. Deployment Instructions
2020-03-26 16:24:09 +01:00
### Clone Repository
2020-03-28 20:41:22 +01:00
First clone this repository and move to openvidu-docker-compose folder:
2020-03-26 16:24:09 +01:00
```
$ git clone https://github.com/OpenVidu/openvidu.git
$ cd openvidu
$ git checkout -b deploy-docker-compose origin/deploy-docker-compose
$ cd openvidu-server/docker/openvidu-docker-compose
```
2020-03-26 16:24:09 +01:00
2020-03-28 20:41:22 +01:00
### OpenVidu configuration
2020-03-26 16:24:09 +01:00
2020-03-28 20:41:22 +01:00
OpenVidu configuration is specified in the `.env` file with environment variables.
2020-03-26 16:24:09 +01:00
2020-03-28 20:41:22 +01:00
**YOU MUST** specify the public IP or public domain name of your machine and OpenVidu password. All other values have sane defaults.
2020-03-26 16:24:09 +01:00
2020-03-28 20:41:22 +01:00
```
# OpenVidu configuration
# ----------------------
# Documentation: https://openvidu.io/docs/reference-docs/openvidu-server-params/
2020-03-26 16:24:09 +01:00
2020-03-28 20:41:22 +01:00
# OpenVidu SECRET used for apps and to access to the inspector. Change it.
OPENVIDU_SECRET=MY_SECRET
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.
DOMAIN_OR_PUBLIC_IP=openvidu.example.com
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
# Openvidu Folder Record used for save the openvidu recording videos. Change it
# with the folder you want to use from your host.
OPENVIDU_RECORDING_FOLDER=/opt/recordings
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
# Certificate type:
# - selfsigned: Self signed certificate. Not recommended for production use.
# Users will see an ERROR when connected to web page.
# - owncert: Valid certificate purchased in a Internet services company.
# Please put the certificates in same folder as docker-compose.yml
# file with names certificate.key and certificate.cert.
# - letsencrypt: Generate a new certificate using letsencrypt. Please set the
# required contact email for Let's Encrypt in LETSENCRYPT_EMAIL
# variable.
CERTIFICATE_TYPE=selfsigned
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
# If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for
# notifications
LETSENCRYPT_EMAIL=user@example.com
```
2020-03-26 16:24:09 +01:00
2020-03-28 20:41:22 +01:00
### Videoconference application
2020-03-26 16:24:09 +01:00
2020-03-28 20:41:22 +01:00
By default, the [OpenVidu Call application](https://openvidu.io/docs/demos/openvidu-call/) is deployed alongside OpenVide CE platform. This application is defined in the file `docker-compose.override.yml`.
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
```
version: '3.1'
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
services:
# Change this if your want use your own application.
# It's very important expose your application in port 5443
# and use the http protocol.
app:
image: openvidu/openvidu-call:2.13.0-beta1
restart: on-failure
ports:
- "5442:80"
environment:
- OPENVIDU_URL=https://${DOMAIN_OR_PUBLIC_IP}
- OPENVIDU_SECRET=${OPENVIDU_SECRET}
```
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
You can disable it deleting 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-03-28 20:41:22 +01:00
You can configure other dockerized application if you want updating the content of `docker-compose.override.yml` with the following requirements:
* You have to bind your application port to 5442 in the host, as this port is used by NGINX to publish your app in port 443.
* The application must be served in plain http as NGINX is the responsible of managing SSL certificate.
* Remember that application needs to know how to connect to OpenVidu, for that, you can use the variables ${DOMAIN_OR_PUBLIC_IP} and ${OPENVIDU_SECRET} as shown in the sample file.
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
### Start services
2020-03-27 16:09:32 +01:00
2020-03-28 20:41:22 +01:00
To download and start the services (OpenVidu platform and the application) you can execute this command:
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
`$ docker-compose up -d`
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
Then, all services will be downloaded (only the first time) and executed.
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
The services will be started when you see this output in the shell:
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
```
Creating openvidu-docker-compose_openvidu-coturn_1 ... done
Creating openvidu-docker-compose_app_1 ... done
Creating openvidu-docker-compose_kms_1 ... done
Creating openvidu-docker-compose_openvidu-proxy_1 ... done
Creating openvidu-docker-compose_redis-db_1 ... done
Creating openvidu-docker-compose_openvidu-server_1 ... done
```
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
Then you can visit https://<DOMAIN_OR_PUBLIC_IP>/ and the application will appear. If get any error, please retry in a few seconds as it is possible that services are still starting.
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
### Stop services
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
To stop the application exec this command:
`docker-compose stop`
### How to operate the services
#### Change configuration
To change the configuration follow this steps:
* Stop the services: `$ docker-compose stop`
* Change configuration in `.env` file
* Start the services: `$ docker-compose up -d`
> TODO: Review that changing domain name with CERTIFICATE_TYPE=letsencrypt regenerates the certificate.
#### Show service logs
If you want to see logs of all services execute this command:
`$ docker-compose logs -f`
If you only want to see the logs of a service execute any of the following commands:
```
$ docker-compose logs -f openvidu-server
$ docker-compose logs -f kms
$ docker-compose logs -f openvidu-proxy
$ docker-compose logs -f openvidu-coturn
$ docker-compose logs -f redis-db
$ docker-compose logs -f app
```
2020-03-28 20:41:22 +01:00
#### Updating the log level of the services
2020-03-27 16:46:32 +01:00
##### Openvidu Server Level logs
If it was necessary to change the level of the kms logs. In the .en file we go to the section "Openvidu Server Level logs" and change the variable `OV_CE_DEBUG_LEVEL`
2020-03-28 20:41:22 +01:00
##### Kurento Media Server Level logs
If it was necessary to change the level of the kms logs. In the .en file we go to the section "Kurento Media Server Level logs" and change the variable `KMS_DEBUG_LEVEL` for more information https://doc-kurento.readthedocs.io/en/stable/features/logging.html
2020-03-27 16:46:32 +01:00
2020-03-28 20:41:22 +01:00
### Use other Kurento Media Server docker image
2020-03-27 16:46:32 +01:00
If is necessaries change the Kurento Media Server image, go to the Kurento Media Server image section in the .env file and change the variable `KMS_IMAGE` with the new image that your want use