deployment: Add installation and deployment files for OpenVidu Enteprise HA - On premises

pull/803/head
cruizba 2023-05-22 16:22:06 +02:00
parent 7b1f411db4
commit 912cdee47f
11 changed files with 2217 additions and 0 deletions

View File

@ -0,0 +1,52 @@
# OpenVidu Enterprise HA Base Services Configuration
# ----------------------
# Documentation: https://docs.openvidu.io/en/stable/deployment/enterprise/on-premises/#high-availability-deployment
# 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.
# Domain name. If you do not have one, the public IP of the machine.
# For example: 198.51.100.1, or openvidu.example.com
# This domain name will be the one that should be used to access the OpenVidu Server
# All nodes in your cluster should have this same value at DOMAIN_OR_PUBLIC_IP
DOMAIN_OR_PUBLIC_IP=
# OpenVidu SECRET used for apps to connect to OpenVidu server and users to access to OpenVidu Dashboard
# This secret is needed for default Openvidu Call app to connect to OpenVidu Server
OPENVIDU_SECRET=
# 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 files inside folder ./owncert
# 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
# If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for notifications
LETSENCRYPT_EMAIL=
# A list separated by commas of the private IP addresses of the nodes in your cluster.
# This machine should be able to reach all the nodes in this list.
# For example: 10.0.0.5,10.0.0.6
OPENVIDU_ENTERPRISE_HA_NODE_IPS=
# Redis password used by OpenVidu Nodes to connect to Redis server
OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD=
# Name of the bucket in S3 where OpenVidu will store the configuration file
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET=openvidu-enterprise
# Configured user for S3 at deployed MinIO server
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_ACCESS_KEY=minioadmin
# Configured password for S3 at deployed MinIO server
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY=
# Kibana And ElasticSearch Basic Auth configuration (Credentials)
# This credentials will aso be valid for Kibana dashboard
ELASTICSEARCH_USERNAME=elasticadmin
ELASTICSEARCH_PASSWORD=

View File

@ -0,0 +1,368 @@
#!/bin/bash
# Support docker compose v1 and v2
shopt -s expand_aliases
alias docker-compose='docker compose'
if ! docker compose version &> /dev/null; then
unalias docker-compose
fi
# Change default http timeout for slow networks
export COMPOSE_HTTP_TIMEOUT=500
export DOCKER_CLIENT_TIMEOUT=500
collect_basic_information() {
LINUX_VERSION=$(lsb_release -d)
DOCKER_PS=$(docker ps)
DOCKER_VERSION=$(docker version --format '{{.Server.Version}}')
DOCKER_COMPOSE_VERSION=$(docker-compose version --short)
OV_FOLDER="${PWD}"
OV_VERSION=$(grep 'Openvidu Version:' "${OV_FOLDER}/docker-compose.yml" | awk '{ print $4 }')
CONTAINERS=$(docker ps | awk '{if(NR>1) print $NF}')
if [ -n "$(grep -E '^ image: openvidu/openvidu-call:.*$' "${OV_FOLDER}/docker-compose.override.yml" | tr -d '[:space:]')" ]; then
OV_CALL_VERSION=$(grep -E 'Openvidu-Call Version:' "${OV_FOLDER}/docker-compose.override.yml" | awk '{ print $4 }')
fi
[ -z "${OV_CALL_VERSION}" ] && OV_CALL_VERSION="No present"
OV_TYPE_INSTALLATION=$(grep 'Installation Mode:' "${OV_FOLDER}/docker-compose.yml" | awk '{ print $4,$5 }')
TREE_OV_DIRECTORY=$(find "." ! -path '*/0/*' | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/")
}
version_ov() {
collect_basic_information
printf '\nOpenvidu Information:'
printf '\n'
printf '\n Openvidu Enterprise HA Base Services'
printf '\n Installation Type: %s' "${OV_TYPE_INSTALLATION}"
printf '\n Openvidu Version: %s' "${OV_VERSION}"
printf '\n Openvidu Call Version: %s' "${OV_CALL_VERSION}"
printf '\n'
printf '\nSystem Information:'
printf '\n'
printf '\n Linux Version:'
printf '\n - %s' "${LINUX_VERSION}"
printf '\n Docker Version: %s' "${DOCKER_VERSION}"
printf '\n Docker Compose Version: %s' "${DOCKER_COMPOSE_VERSION}"
printf '\n'
printf '\nInstallation Information:'
printf '\n'
printf '\n Installation Folder: %s' "${OV_FOLDER}"
printf '\n Installation Folder Tree:'
printf '\n%s' "$(echo "${TREE_OV_DIRECTORY}" | sed -e 's/.//' -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
printf '\n'
printf '\nDocker Running Services:'
printf '\n'
printf '\n %s' "$(echo "${DOCKER_PS}" | sed -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
printf '\n'
}
generate_report() {
collect_basic_information
REPORT_CREATION_DATE=$(date +"%d-%m-%Y")
REPORT_CREATION_TIME=$(date +"%H:%M:%S")
REPORT_NAME="openvidu-report-${REPORT_CREATION_DATE}-$(date +"%H-%M").txt"
REPORT_OUTPUT="${OV_FOLDER}/${REPORT_NAME}"
{
printf "\n ======================================="
printf "\n = REPORT INFORMATION ="
printf "\n ======================================="
printf '\n'
printf '\n Creation Date: %s' "${REPORT_CREATION_DATE}"
printf '\n Creation Time: %s' "${REPORT_CREATION_TIME}"
printf '\n'
printf "\n ======================================="
printf "\n = OPENVIDU INFORMATION ="
printf "\n ======================================="
printf '\n'
printf '\n Openvidu Enterprise HA Base Services'
printf '\n Installation Type: %s' "${OV_TYPE_INSTALLATION}"
printf '\n Openvidu Version: %s' "${OV_VERSION}"
printf '\n Openvidu Call Version: %s' "${OV_CALL_VERSION}"
printf '\n'
printf "\n ======================================="
printf "\n = SYSTEM INFORMATION ="
printf "\n ======================================="
printf '\n'
printf '\n Linux Version:'
printf '\n - %s' "${LINUX_VERSION}"
printf '\n Docker Version: %s' "${DOCKER_VERSION}"
printf '\n Docker Compose Version: %s' "${DOCKER_COMPOSE_VERSION}"
printf '\n'
printf "\n ======================================="
printf "\n = INSTALLATION INFORMATION ="
printf "\n ======================================="
printf '\n'
printf '\n Installation Folder: %s' "${OV_FOLDER}"
printf '\n Installation Folder Tree:'
printf '\n%s' "$(echo "${TREE_OV_DIRECTORY}" | sed -e 's/.//' -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
printf '\n'
printf "\n ======================================="
printf "\n = DOCKER RUNNING SERVICES ="
printf "\n ======================================="
printf '\n'
printf '\n %s' "$(echo "${DOCKER_PS}" | sed -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
printf '\n'
printf "\n ======================================="
printf "\n = CONFIGURATION FILES ="
printf "\n ======================================="
printf '\n'
printf '\n ================ .env ================='
printf '\n'
printf '\n'
cat < "${OV_FOLDER}/.env" | sed -r -e "s/OPENVIDU_SECRET=.+/OPENVIDU_SECRET=****/" -e "s/OPENVIDU_PRO_LICENSE=.+/OPENVIDU_PRO_LICENSE=****/" -e "s/ELASTICSEARCH_PASSWORD=.+/ELASTICSEARCH_PASSWORD=****/"
printf '\n'
printf '\n ========= docker-compose.yml =========='
printf '\n'
printf '\n'
cat "${OV_FOLDER}/docker-compose.yml"
printf '\n'
printf '\n ==== docker-compose.override.yml ===='
printf '\n'
printf '\n'
if [ -f "${OV_FOLDER}/docker-compose.override.yml" ]; then
cat < "${OV_FOLDER}/docker-compose.override.yml"
else
printf '\n The docker-compose.override.yml file is not present'
fi
printf '\n'
printf '\n'
printf "\n ======================================="
printf "\n = LOGS ="
printf "\n ======================================="
for CONTAINER in $CONTAINERS
do
printf '\n'
printf "\n ---------------------------------------"
printf "\n %s" "$CONTAINER"
printf "\n ---------------------------------------"
printf '\n'
docker logs "$CONTAINER"
printf "\n ---------------------------------------"
printf '\n'
printf '\n'
done
printf "\n ======================================="
printf "\n = CONTAINER ENVS VARIABLES ="
printf "\n ======================================="
for CONTAINER in $CONTAINERS
do
printf '\n'
printf "\n ======================================="
printf "\n %s" "$CONTAINER"
printf "\n ---------------------------------------"
printf '\n'
docker exec "$CONTAINER" env
printf "\n ---------------------------------------"
printf '\n'
printf '\n'
done
} >> "${REPORT_OUTPUT}" 2>&1
printf "\n Generation of the report completed with success"
printf "\n You can get your report at path '%s'" "${REPORT_OUTPUT}"
printf "\n"
}
print_env_error() {
printf "\n =======¡ERROR!======="
printf "\n ERROR: You must set the '%s' variable in the .env file" "${1}"
printf "\n"
}
check_non_empty_parameters() {
local NON_EMPTY_ENV_VARS=("$@")
for ENV_VAR_NAME in "${NON_EMPTY_ENV_VARS[@]}" ; do
ENV_VAR_VALUE=$(grep -v '^#' .env | grep "${ENV_VAR_NAME}" | cut -d '=' -f2)
if [[ -z "${ENV_VAR_VALUE}" ]]; then
print_env_error "${ENV_VAR_NAME}"
exit 1
fi
done
}
get_env_var_value() {
local ENV_VAR_NAME=$1
local ENV_VAR_VALUE
ENV_VAR_VALUE=$(grep -v '^#' .env | grep "${ENV_VAR_NAME}" | cut -d '=' -f2)
echo "${ENV_VAR_VALUE}"
}
check_env_var_is_value() {
local ENV_VAR_NAME=$1
local ENV_VAR_VALUE=$2
local ENV_VAR_VALUE_TO_CHECK
ENV_VAR_VALUE_TO_CHECK=$(get_env_var_value "${ENV_VAR_NAME}")
if [[ "${ENV_VAR_VALUE_TO_CHECK}" != "${ENV_VAR_VALUE}" ]]; then
print_env_error "${ENV_VAR_NAME}"
exit 1
fi
}
print_env_error() {
printf "\n =======¡ERROR!======="
printf "\n %s" "$1"
printf "\n"
}
check_non_empty_parameters() {
local NON_EMPTY_ENV_VARS=("$@")
for ENV_VAR_NAME in "${NON_EMPTY_ENV_VARS[@]}" ; do
ENV_VAR_VALUE=$(grep -v '^#' .env | grep "${ENV_VAR_NAME}" | cut -d '=' -f2)
if [[ -z "${ENV_VAR_VALUE}" ]]; then
ERRORS+=("ERROR: You must set the '${ENV_VAR_NAME}' variable in the .env file")
fi
done
}
get_env_var_value() {
local ENV_VAR_NAME=$1
local ENV_VAR_VALUE
ENV_VAR_VALUE=$(grep -v '^#' .env | grep "${ENV_VAR_NAME}" | cut -d '=' -f2)
echo "${ENV_VAR_VALUE}"
}
validate_env_vars() {
ERRORS=()
check_non_empty_parameters "DOMAIN_OR_PUBLIC_IP" \
"OPENVIDU_SECRET" \
"CERTIFICATE_TYPE" \
"OPENVIDU_ENTERPRISE_HA_NODE_IPS" \
"OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD" \
"OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET" \
"OPENVIDU_ENTERPRISE_HA_S3_CONFIG_ACCESS_KEY" \
"OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY" \
"ELASTICSEARCH_USERNAME" \
"ELASTICSEARCH_PASSWORD"
local OPENVIDU_SECRET
OPENVIDU_SECRET=$(get_env_var_value "OPENVIDU_SECRET")
if [[ ! "${OPENVIDU_SECRET}" =~ ^[a-zA-Z0-9_-]+$ ]]; then
ERRORS+=("OPENVIDU_SECRET: Value must be alphanumeric and can include '-' or '_'.")
fi
local CERTIFICATE_TYPE
CERTIFICATE_TYPE=$(get_env_var_value "CERTIFICATE_TYPE")
if [[ "${CERTIFICATE_TYPE}" == "letsencrypt" ]]; then
local LETSENCRYPT_EMAIL
LETSENCRYPT_EMAIL=$(get_env_var_value "LETSENCRYPT_EMAIL")
if [[ -z "${LETSENCRYPT_EMAIL}" ]]; then
ERRORS+=("LETSENCRYPT_EMAIL: Value must not be empty when CERTIFICATE_TYPE is 'letsencrypt'.")
fi
fi
local OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD
OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD=$(get_env_var_value "OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD")
if [[ ! "${OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD}" =~ ^[a-zA-Z0-9_-]+$ ]]; then
ERRORS+=("OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD: Value must be alphanumeric and can include '-' or '_'.")
fi
local OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY=$(get_env_var_value "OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY")
if [[ ! "${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY}" =~ ^[a-zA-Z0-9_-]+$ ]]; then
ERRORS+=("OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY: Value must be alphanumeric and can include '-' or '_'.")
fi
local ELASTICSEARCH_PASSWORD
ELASTICSEARCH_PASSWORD=$(get_env_var_value "ELASTICSEARCH_PASSWORD")
if [[ ! "${ELASTICSEARCH_PASSWORD}" =~ ^[a-zA-Z0-9_-]{7,}$ ]]; then
ERRORS+=("ELASTICSEARCH_PASSWORD: Value must be alphanumeric (and can include '-' or '_') with a minimum length of 7.")
fi
if [[ ${#ERRORS[@]} -ne 0 ]]; then
for error in "${ERRORS[@]}"; do
print_env_error "${error}"
done
exit 1
fi
}
start_openvidu() {
docker-compose up -d
}
usage() {
printf "Usage: \n\t base-services [command]"
printf "\n\nAvailable Commands:"
printf "\n\tstart\t\t\tStart all services"
printf "\n\tstop\t\t\tStop all services"
printf "\n\trestart\t\t\tRestart all stopped and running services"
printf "\n\tlogs\t\t\tShow openvidu-server logs"
printf "\n\tupgrade\t\t\tUpgrade to the latest Openvidu version"
printf "\n\tupgrade [version]\tUpgrade to the specific Openvidu version"
printf "\n\tversion\t\t\tShow version of Openvidu Server"
printf "\n\treport\t\t\tGenerate a report with the current status of Openvidu"
printf "\n\thelp\t\t\tShow help for openvidu command"
printf "\n"
}
[[ -z "${FOLLOW_OPENVIDU_LOGS}" ]] && FOLLOW_OPENVIDU_LOGS=true
case $1 in
start)
validate_env_vars
start_openvidu
if [[ "${FOLLOW_OPENVIDU_LOGS}" == "true" ]]; then
# Docker compose logs of openvidu-server and repliation-manager containers
docker-compose logs -f --tail 10
fi
;;
stop)
docker-compose down
;;
restart)
validate_env_vars
docker-compose down
start_openvidu
if [[ "${FOLLOW_OPENVIDU_LOGS}" == "true" ]]; then
docker-compose logs -f --tail 10
fi
;;
logs)
case "${2-}" in
--follow|-f)
docker-compose logs -f --tail 10
;;
*)
docker-compose logs
;;
esac
;;
version)
version_ov
;;
report)
read -r -p " You are about to generate a report on the current status of Openvidu, this may take some time. Do you want to continue? [y/N]: " response
case "$response" in
[yY][eE][sS]|[yY])
generate_report
;;
*)
exit 0
;;
esac
;;
*)
usage
;;
esac

View File

@ -0,0 +1,32 @@
version: '3.1'
services:
# --------------------------------------------------------------
#
# Change this if your want use your own application.
# It's very important expose your application in port 5442
# and use the http protocol.
#
# Default Application
#
# Openvidu-Call Version: 2.27.0
#
# --------------------------------------------------------------
app:
image: openvidu/openvidu-call:master
restart: on-failure
ports:
- 5442:5442
environment:
- SERVER_PORT=5442
- OPENVIDU_URL=http://loadbalancer:5443
- OPENVIDU_SECRET=${OPENVIDU_SECRET}
- CALL_OPENVIDU_CERTTYPE=${CERTIFICATE_TYPE}
- CALL_PRIVATE_ACCESS=${CALL_PRIVATE_ACCESS:-}
- CALL_USER=${CALL_USER:-}
- CALL_SECRET=${CALL_SECRET:-}
- CALL_ADMIN_SECRET=${CALL_ADMIN_SECRET:-}
- CALL_RECORDING=${CALL_RECORDING:-}
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"

View File

@ -0,0 +1,134 @@
# ------------------------------------------------------------------------------
#
# DO NOT MODIFY THIS FILE !!!
#
# Configuration properties should be specified in .env file
#
# This docker-compose file coordinates all needed services by OpenVidu Enterprise HA
#
# This file will be overridden when updating OpenVidu Enterprise HA
#
# Openvidu Version: 2.27.0
#
# Installation Mode: On Premises
#
# ------------------------------------------------------------------------------
version: '3.1'
services:
loadbalancer:
image: openvidu/openvidu-proxy:master
restart: always
volumes:
- ./certificates:/etc/letsencrypt
- ./owncert:/owncert
- ./custom-nginx-vhosts:/etc/nginx/vhost.d/
- ./custom-nginx-locations:/custom-nginx-locations
- ${OPENVIDU_RECORDING_CUSTOM_LAYOUT:-/opt/openvidu/custom-layout}:/opt/openvidu/custom-layout
ports:
# Nginx letsencrypt port
- "${HTTP_PORT:-80}:${HTTP_PORT:-80}"
# External Load Balancer port
- "${HTTPS_PORT:-443}:${HTTPS_PORT:-443}"
# Internal Load Balancer port
- 5443:5443
environment:
- DOMAIN_OR_PUBLIC_IP=${DOMAIN_OR_PUBLIC_IP}
- CERTIFICATE_TYPE=${CERTIFICATE_TYPE}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
- OPENVIDU_ENTERPRISE_HA_NODE_IPS=${OPENVIDU_ENTERPRISE_HA_NODE_IPS}
- PROXY_HTTP_PORT=${HTTP_PORT:-}
- PROXY_HTTPS_PORT=${HTTPS_PORT:-}
- PROXY_HTTPS_PROTOCOLS=${HTTPS_PROTOCOLS:-}
- PROXY_HTTPS_CIPHERS=${HTTPS_CIPHERS:-}
- PROXY_HTTPS_HSTS=${HTTPS_HSTS:-}
- ALLOWED_ACCESS_TO_DASHBOARD=${ALLOWED_ACCESS_TO_DASHBOARD:-}
- ALLOWED_ACCESS_TO_RESTAPI=${ALLOWED_ACCESS_TO_RESTAPI:-}
- PROXY_MODE=ENTERPRISE_HA
- WITH_APP=true
- REDIRECT_WWW=${REDIRECT_WWW:-false}
- WORKER_CONNECTIONS=${WORKER_CONNECTIONS:-10240}
- PUBLIC_IP=${PROXY_PUBLIC_IP:-auto-ipv4}
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"
minio-s3:
image: minio/minio:RELEASE.2023-01-06T18-11-18Z
restart: always
environment:
- MINIO_ACCESS_KEY=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_ACCESS_KEY}
- MINIO_SECRET_KEY=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY}
- MINIO_BROWSER_REDIRECT_URL=https://${DOMAIN_OR_PUBLIC_IP}:${HTTPS_PORT:-443}/minio/
- CONSOLE_SUBPATH=/minio/
volumes:
- ./minio-s3:/data
ports:
- "9000:9000"
- "9001:9001"
command: server --console-address ":9001" /data
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"
createbuckets:
image: minio/mc:RELEASE.2022-12-24T15-21-38Z
depends_on:
- minio-s3
entrypoint: >
/bin/sh -c "
/usr/bin/mc config host add openvidu-minio \
http://minio-s3:9000 \
'${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_ACCESS_KEY}' \
'${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY}';
/usr/bin/mc mb 'openvidu-minio/${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET}';
exit 0;
"
redis:
image: redis:7.0.8-alpine
restart: always
ports:
- "${OPENVIDU_ENTERPRISE_HA_REDIS_PORT:-6379}:${OPENVIDU_ENTERPRISE_HA_REDIS_PORT:-6379}"
command: /bin/sh -c "redis-server
--bind 0.0.0.0
--port ${OPENVIDU_ENTERPRISE_HA_REDIS_PORT:-6379}
--requirepass ${OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD}"
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"
elasticsearch:
image: openvidu/openvidu-elasticsearch:7.8.0
restart: always
environment:
- discovery.type=single-node
- xpack.security.enabled=true
- "ES_JAVA_OPTS=${ES_JAVA_OPTS:--Xms2g -Xmx2g}"
ports:
- 9200:9200
volumes:
- ./elasticsearch:/usr/share/elasticsearch/data
command: >
/bin/bash -c "elasticsearch-users useradd ${ELASTICSEARCH_USERNAME}
-p ${ELASTICSEARCH_PASSWORD} -r superuser;
elasticsearch-users passwd ${ELASTICSEARCH_USERNAME} -p ${ELASTICSEARCH_PASSWORD};
docker-entrypoint.sh"
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"
kibana:
image: docker.elastic.co/kibana/kibana:7.8.0
restart: always
environment:
- SERVER_BASEPATH="/kibana"
- xpack.security.enabled=true
- ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME}
- ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD}
ports:
- 5601:5601
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"

View File

@ -0,0 +1,321 @@
#!/usr/bin/env bash
# Global variables
OPENVIDU_FOLDER=ov-enterprise-base-services
ELASTICSEARCH_FOLDER=${OPENVIDU_FOLDER}/elasticsearch
OPENVIDU_VERSION=master
OPENVIDU_UPGRADABLE_VERSION="2.27"
DOWNLOAD_URL=https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}
# Support docker compose v1 and v2
shopt -s expand_aliases
alias docker-compose='docker compose'
if ! docker compose version &> /dev/null; then
unalias docker-compose
fi
# Change default http timeout for slow networks
export COMPOSE_HTTP_TIMEOUT=500
export DOCKER_CLIENT_TIMEOUT=500
pull_images() {
OV_DIRECTORY="$1"
pushd "${OV_DIRECTORY}" > /dev/null || fatal_error "Error: can not access to '${OV_DIRECTORY}' folder"
docker-compose pull || fatal_error "Error: can not pull images defined with docker-compose"
popd > /dev/null || fatal_error "Error: can not access to previous folder"
}
fatal_error() {
printf "\n =======¡ERROR!======="
printf "\n %s" "$1"
printf "\n"
exit 1
}
new_ov_installation() {
printf '\n'
printf '\n ======================================='
printf '\n Install OpenVidu Enterprise HA Base Services %s' "${OPENVIDU_VERSION}"
printf '\n ======================================='
printf '\n'
# Create folder openvidu-docker-compose
printf '\n => Creating folder '%s'...' "${OPENVIDU_FOLDER}"
mkdir "${OPENVIDU_FOLDER}" || fatal_error "Error while creating the folder '${OPENVIDU_FOLDER}'"
# Create elasticsearch folder
printf "\n => Creating folder 'elasticsearch'..."
mkdir -p "${ELASTICSEARCH_FOLDER}" || fatal_error "Error while creating the folder 'elasticsearch'"
printf "\n => Changing permission to 'elasticsearch' folder..."
chown 1000:1000 "${ELASTICSEARCH_FOLDER}" || fatal_error "Error while changing permission to 'elasticsearch' folder"
# Download necessary files
printf '\n => Downloading OpenVidu Enterprise HA files:'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/base-services/.env \
--output "${OPENVIDU_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
printf '\n - .env'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/base-services/docker-compose.yml \
--output "${OPENVIDU_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
printf '\n - docker-compose.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/base-services/docker-compose.override.yml \
--output "${OPENVIDU_FOLDER}/docker-compose.override.yml" || fatal_error "Error when downloading the file 'docker-compose.override.yml'"
printf '\n - docker-compose.override.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/base-services/base-services \
--output "${OPENVIDU_FOLDER}/base-services" || fatal_error "Error when downloading the file 'base-services'"
printf '\n - base-services'
# Add execution permissions
printf "\n => Adding permission:"
chmod +x "${OPENVIDU_FOLDER}/base-services" || fatal_error "Error while adding permission to 'base-services' program"
printf '\n - base-services'
# Pull all docker images
pull_images "${OPENVIDU_FOLDER}"
# Ready to use
printf '\n'
printf '\n'
printf '\n ======================================='
printf '\n OpenVidu Enterprise HA successfully installed.'
printf '\n ======================================='
printf '\n'
printf '\n 1. Go to openvidu folder:'
printf '\n ------------------------------------------------'
printf '\n $ cd ov-enterprise-base-services'
printf '\n ------------------------------------------------'
printf '\n'
printf '\n'
printf '\n 2. Configure the .env file with your own values:'
printf '\n Check the documentation for more information:'
printf '\n https://docs.openvidu.io/en/%s/deployment/enterprise/on-premises/#high-availability-deployment' "${OPENVIDU_VERSION//v}"
printf '\n ------------------------------------------------'
printf '\n $ nano .env'
printf '\n ------------------------------------------------'
printf '\n'
printf '\n'
printf '\n 3. Start OpenVidu Enterprise HA Base Services:'
printf '\n ------------------------------------------------'
printf '\n $ ./base-services start'
printf '\n ------------------------------------------------'
printf '\n'
printf '\n'
printf '\n'
exit 0
}
get_previous_env_variable() {
local ENV_VARIABLE_NAME=$1
echo "$(grep -E "${ENV_VARIABLE_NAME}=.*$" "${OPENVIDU_PREVIOUS_FOLDER}/.env" | cut -d'=' -f2)"
}
replace_variable_in_new_env_file() {
local ENV_VARIABLE_NAME=$1
local ENV_VARIABLE_VALUE=$2
[[ -n "${ENV_VARIABLE_VALUE}" ]] && sed -i "s|#${ENV_VARIABLE_NAME}=|${ENV_VARIABLE_NAME}=${ENV_VARIABLE_VALUE}|" "${OPENVIDU_PREVIOUS_FOLDER}/.env-${OPENVIDU_VERSION}"
}
upgrade_ov() {
# Search local Openvidu installation
printf '\n'
printf '\n ========================================================='
printf '\n Search Previous Installation of Openvidu Enterprise HA'
printf '\n ========================================================='
printf '\n'
SEARCH_IN_FOLDERS=(
"${PWD}"
"/opt/${OPENVIDU_FOLDER}"
)
for folder in "${SEARCH_IN_FOLDERS[@]}"; do
printf "\n => Searching in '%s' folder..." "${folder}"
if [ -f "${folder}/docker-compose.yml" ]; then
OPENVIDU_PREVIOUS_FOLDER="${folder}"
printf "\n => Found installation in folder '%s'" "${folder}"
break
fi
done
[ -z "${OPENVIDU_PREVIOUS_FOLDER}" ] && fatal_error "No previous Openvidu installation found"
# Upgrade Openvidu
OPENVIDU_PREVIOUS_VERSION=$(grep 'Openvidu Version:' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml" | awk '{ print $4 }')
[ -z "${OPENVIDU_PREVIOUS_VERSION}" ] && fatal_error "Can't find previous OpenVidu version"
# In this point using the variable 'OPENVIDU_PREVIOUS_VERSION' we can verify if the upgrade is
# posible or not. If it is not posible launch a warning and stop the upgrade.
if [[ "${OPENVIDU_PREVIOUS_VERSION}" != "${OPENVIDU_UPGRADABLE_VERSION}."* ]] && [[ "${OPENVIDU_PREVIOUS_VERSION}" != "${OPENVIDU_VERSION//v}"* ]]; then
fatal_error "You can't update from version ${OPENVIDU_PREVIOUS_VERSION} to ${OPENVIDU_VERSION}.\nNever upgrade across multiple major versions."
fi
printf '\n'
printf '\n ======================================='
printf '\n Upgrade OpenVidu Enterprise HA base services %s to %s' "${OPENVIDU_PREVIOUS_VERSION}" "${OPENVIDU_VERSION}"
printf '\n ======================================='
printf '\n'
ROLL_BACK_FOLDER="${OPENVIDU_PREVIOUS_FOLDER}/.old-${OPENVIDU_PREVIOUS_VERSION}"
TMP_FOLDER="${OPENVIDU_PREVIOUS_FOLDER}/tmp"
ACTUAL_FOLDER="${PWD}"
printf "\n Creating rollback folder '%s'..." ".old-${OPENVIDU_PREVIOUS_VERSION}"
mkdir "${ROLL_BACK_FOLDER}" || fatal_error "Error while creating the folder '.old-${OPENVIDU_PREVIOUS_VERSION}'"
printf "\n Creating temporal folder 'tmp'..."
mkdir "${TMP_FOLDER}" || fatal_error "Error while creating the folder 'temporal'"
# Download necessary files
printf '\n => Downloading new OpenVidu Enterprise HA base services files:'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/base-services/.env \
--output "${TMP_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
printf '\n - .env'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/base-services/docker-compose.yml \
--output "${TMP_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
printf '\n - docker-compose.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/base-services/docker-compose.override.yml \
--output "${TMP_FOLDER}/docker-compose.override.yml" || fatal_error "Error when downloading the file 'docker-compose.override.yml'"
printf '\n - docker-compose.override.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/base-services/base-services \
--output "${TMP_FOLDER}/base-services" || fatal_error "Error when downloading the file 'base-services'"
printf '\n - base-services'
# Downloading new images and stopped actual Openvidu
printf '\n => Downloading new images...'
printf '\n'
sleep 1
printf "\n => Moving to 'tmp' folder..."
printf '\n'
cd "${TMP_FOLDER}" || fatal_error "Error when moving to 'tmp' folder"
printf '\n'
docker-compose pull || true
printf '\n => Stopping base services...'
printf '\n'
sleep 1
printf "\n => Moving to 'base-services' folder..."
printf '\n'
cd "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error when moving to 'base-services' folder"
printf '\n'
docker-compose down || true
printf '\n'
printf '\n => Moving to working dir...'
cd "${ACTUAL_FOLDER}" || fatal_error "Error when moving to working dir"
# Move old files to rollback folder
printf '\n => Moving previous installation files to rollback folder:'
mv "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'docker-compose.yml'"
printf '\n - docker-compose.yml'
mv "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.override.yml" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'docker-compose.override.yml'"
printf '\n - docker-compose.override.yml'
mv "${OPENVIDU_PREVIOUS_FOLDER}/base-services" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'base-services'"
printf '\n - base-services'
cp "${OPENVIDU_PREVIOUS_FOLDER}/.env" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous '.env'"
printf '\n - .env'
# Move tmp files to Openvidu
printf '\n => Updating files:'
mv "${TMP_FOLDER}/docker-compose.yml" "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'docker-compose.yml'"
printf '\n - docker-compose.yml'
mv "${TMP_FOLDER}/docker-compose.override.yml" "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'docker-compose.override.yml'"
printf '\n - docker-compose.override.yml'
mv "${TMP_FOLDER}/.env" "${OPENVIDU_PREVIOUS_FOLDER}/.env-${OPENVIDU_VERSION}" || fatal_error "Error while moving previous '.env'"
printf '\n - .env-%s' "${OPENVIDU_VERSION}"
mv "${TMP_FOLDER}/base-services" "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'base-services'"
printf '\n - base-services'
printf "\n => Deleting 'tmp' folder"
rm -rf "${TMP_FOLDER}" || fatal_error "Error deleting 'tmp' folder"
# Add execution permissions
printf "\n => Adding permission to 'base-services' program..."
chmod +x "${OPENVIDU_PREVIOUS_FOLDER}/base-services" || fatal_error "Error while adding permission to 'base-services' program"
printf '\n - base-services'
# Define old mode: On Premise or Cloud Formation
OLD_MODE=$(grep -E "Installation Mode:.*$" "${ROLL_BACK_FOLDER}/docker-compose.yml" | awk '{ print $4,$5 }')
[ -n "${OLD_MODE}" ] && sed -i -r "s/Installation Mode:.+/Installation Mode: ${OLD_MODE}/" "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"
pull_images "${OPENVIDU_PREVIOUS_FOLDER}"
# Ready to use
printf '\n'
printf '\n'
printf '\n ================================================'
printf "\n Openvidu Enterprise HA base services successfully upgraded to version %s" "${OPENVIDU_VERSION}"
printf '\n ================================================'
printf '\n'
printf "\n 1. A new file 'docker-compose.yml' has been created with the new OpenVidu Enterprise HA %s services" "${OPENVIDU_VERSION}"
printf '\n'
printf "\n 2. The previous file '.env' remains intact, but a new file '.env-%s' has been created." "${OPENVIDU_VERSION}"
printf "\n Transfer any configuration you wish to keep in the upgraded version from '.env' to '.env-%s'." "${OPENVIDU_VERSION}"
printf "\n When you are OK with it, rename and leave as the only '.env' file of the folder the new '.env-%s'." "${OPENVIDU_VERSION}"
printf '\n'
printf "\n 3. If you were using Openvidu Call application, it has been automatically updated in file 'docker-compose.override.yml'."
printf "\n However, if you were using your own application, a file called 'docker-compose.override.yml-%s'" "${OPENVIDU_VERSION}"
printf "\n has been created with the latest version of Openvidu Call. If you don't plan to use it you can delete it."
printf '\n'
printf '\n 3. Start new versions of Openvidu Enterprise HA Base Services'
printf '\n ------------------------------------------------'
printf '\n $ ./base-services start'
printf '\n ------------------------------------------------'
printf '\n'
printf "\n If you want to rollback, all the files from the previous installation have been copied to folder '.old-%s'" "${OPENVIDU_PREVIOUS_VERSION}"
printf '\n'
printf '\n'
printf '\n'
}
# Check docker and docker-compose installation
if ! command -v docker > /dev/null; then
echo "You don't have docker installed, please install it and re-run the command"
exit 1
else
# Check version of docker is equal or higher than 20.10.10
DOCKER_VERSION=$(docker version --format '{{.Server.Version}}' | sed "s/-rc[0-9]*//")
if ! printf '%s\n%s\n' "20.10.10" "$DOCKER_VERSION" | sort -V -C; then
echo "You need a docker version equal or higher than 20.10.10, please update your docker and re-run the command"; \
exit 1
fi
fi
if ! command -v docker-compose > /dev/null; then
echo "You don't have docker-compose installed, please install it and re-run the command"
exit 1
else
COMPOSE_VERSION=$(docker-compose version --short | sed "s/-rc[0-9]*//")
if ! printf '%s\n%s\n' "1.24" "$COMPOSE_VERSION" | sort -V -C; then
echo "You need a docker-compose version equal or higher than 1.24, please update your docker-compose and re-run the command"; \
exit 1
fi
fi
# Check type of installation
if [[ -n "$1" && "$1" == "upgrade" ]]; then
upgrade_ov "$2"
else
new_ov_installation
fi

View File

@ -0,0 +1,327 @@
# OpenVidu configuration
# ----------------------
# Documentation: https://docs.openvidu.io/en/stable/reference-docs/openvidu-config/
# 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.
# --------------------------
# OpenVidu Enterprise HA - General configuration:
# --------------------------
# Domain name. If you do not have one, the public IP of the machine.
# For example: 198.51.100.1, or openvidu.example.com
DOMAIN_OR_PUBLIC_IP=
# OpenVidu Pro License
OPENVIDU_PRO_LICENSE=
# OpenVidu SECRET used for apps to connect to OpenVidu server and users to access to OpenVidu Dashboard
OPENVIDU_SECRET=
# Media Server to use
# Possible values are:
# - kurento
# - mediasoup
OPENVIDU_ENTERPRISE_MEDIA_SERVER=mediasoup
# Port used for the Load Balancer in front of OpenVidu Enterprise Nodes
HTTPS_PORT=443
# ----------------------
# OpenVidu Enterprise HA - Clustering and S3 Configuration:
# ----------------------
# This is the IP address that will be used by the node to communicate with the other nodes in the cluster.
OPENVIDU_ENTERPRISE_HA_NODE_PRIVATE_IP=
# These parameters are used to configure the Redis server used by the cluster.
OPENVIDU_ENTERPRISE_HA_REDIS_HOST=
OPENVIDU_ENTERPRISE_HA_REDIS_PORT=
OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD=
# This parameter is used to configure the S3 service endpoint used by the cluster to store the global configuration file.
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SERVICE_ENDPOINT=
# The specified s3 bucket will be used to store a global configuration file that is used by all the nodes in the cluster.
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET=
# Access key for the s3 bucket defined at OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_ACCESS_KEY=
# Secret key for the s3 bucket defined at OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY=
# Region where the s3 bucket defined at OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET is located
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_REGION=
# Optional. Use path style access for the s3 bucket defined at OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET
# Default value is: false
# Check https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#path-style-access
# With Minio, this property must be set to true
OPENVIDU_ENTERPRISE_HA_S3_CONFIG_PATH_STYLE_ACCESS=true
# Optional: If your S3 bucket needs some specific headers to be set, you can define them here.
# This property is a key-value map of strings, following the format of a JSON object.
# For example, for applying server-side encryption with AES-256, this header is mandatory:
# {"x-amz-server-side-encryption":"AES256"}.
# The list of available headers can be found here: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/Headers.html
# OPENVIDU_ENTERPRISE_HA_S3_CONFIG_HEADERS=
# --------------------------
# OpenVidu Enterprise HA -Kibana And ElasticSearch Configuration
# --------------------------
# If you want to use Elasticsearch and Kibana, this variable should be set to true.
OPENVIDU_PRO_ELASTICSEARCH=true
# Put here the url to elasticsearch and kibana services if OPENVIDU_PRO_ELASTICSEARCH=true
# If you want to use the deployed Elasticsearch and Kibana locally, keep these variables commented.
OPENVIDU_PRO_ELASTICSEARCH_HOST=
OPENVIDU_PRO_KIBANA_HOST=
# Kibana And ElasticSearch Basic Auth configuration (Credentials)
# This credentials will aso be valid for Kibana dashboard
ELASTICSEARCH_USERNAME=elasticadmin
ELASTICSEARCH_PASSWORD=
# --------------------------
# OpenVidu Enterprise HA - Other configuration parameters
# --------------------------
# What parameter should be used to distribute the creation of new sessions
# (and therefore distribution of load) among all available Media Nodes
OPENVIDU_PRO_CLUSTER_LOAD_STRATEGY=streams
# Whether to enable or disable Network Quality API. You can monitor and
# warn users about the quality of their networks with this feature
# OPENVIDU_PRO_NETWORK_QUALITY=false
# If OPENVIDU_PRO_NETWORK_QUALITY=true, how often the network quality
# algorithm will be invoked for each user, in seconds
# OPENVIDU_PRO_NETWORK_QUALITY_INTERVAL=5
# Max days until delete indexes in state of rollover on Elasticsearch
# Type number >= 0
# Default Value is 7
# OPENVIDU_PRO_ELASTICSEARCH_MAX_DAYS_DELETE=
# Speech To Text service module to be enabled. Can be: [disabled, vosk, azure]
# Default is disabled
# OPENVIDU_PRO_SPEECH_TO_TEXT=disabled
# Speech To Text service module Docker image to be used in media nodes
# This parameter is empty by default, because the default image is the one provided by OpenVidu
# If defined, it will override the default image
# OPENVIDU_PRO_SPEECH_TO_TEXT_IMAGE=
# If OPENVIDU_PRO_SPEECH_TO_TEXT=azure, Azure key for the Speech To Text service.
# See https://azure.microsoft.com/en-us/products/cognitive-services/speech-to-text/
# OPENVIDU_PRO_SPEECH_TO_TEXT_AZURE_KEY=
# If OPENVIDU_PRO_SPEECH_TO_TEXT=azure, Azure region in which the Speech To Text service is located (e.g. 'westeurope').
# Default value is empty
# See https://azure.microsoft.com/en-us/products/cognitive-services/speech-to-text/"
# OPENVIDU_PRO_SPEECH_TO_TEXT_AZURE_REGION=
# Where to store recording files. Can be 'local' (local storage) or 's3' (AWS bucket).
# You will need to define a OPENVIDU_PRO_AWS_S3_BUCKET if you use it.
OPENVIDU_PRO_RECORDING_STORAGE=s3
# This parameter is used to configure the S3 service endpoint used by the cluster to store recordings
OPENVIDU_PRO_AWS_S3_SERVICE_ENDPOINT=
# S3 Bucket where to store recording files. May include paths to allow navigating
# folder structures inside the bucket. This property is only taken into account
# if OPENVIDU_PRO_RECORDING_STORAGE=s3
#OPENVIDU_PRO_AWS_S3_BUCKET=
# If OPENVIDU_PRO_RECORDING_STORAGE=s3, the collection of HTTP header values that the internal AWS client will use during
# the upload process. The property is a key-value map of strings, following the format of a JSON object. For example, for applying
# server-side encryption with AES-256, this header is mandatory: {"x-amz-server-side-encryption":"AES256"}.
# The list of available headers can be found here: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/Headers.html
# This property is only taken into account if OPENVIDU_PRO_RECORDING_STORAGE=s3
#OPENVIDU_PRO_AWS_S3_HEADERS=
# This property applies to OPENVIDU_PRO_RECORDING_STORAGE=s3 and/or OPENVIDU_PRO_SPEECH_TO_TEXT=aws.
# It is the AWS long-lived credentials access key. Depending on the service you have enabled:
# - OPENVIDU_PRO_RECORDING_STORAGE=s3: Must have read and write permissions over the bucket defined in property
# OPENVIDU_PRO_AWS_S3_BUCKET. In this case credentials are optional:
# if not provided the internal S3 client will try to use the default AWS credentials of the Master Node, if available
# - OPENVIDU_PRO_SPEECH_TO_TEXT=aws: Must have permissions to manage Amazon Transcribe services.
# In this case credentials are mandatory.
# OPENVIDU_PRO_AWS_ACCESS_KEY=
# This property applies to OPENVIDU_PRO_RECORDING_STORAGE=s3 and/or OPENVIDU_PRO_SPEECH_TO_TEXT=aws.
# It is the AWS long-lived credentials secret key. Depending on the service you have enabled:
# - OPENVIDU_PRO_RECORDING_STORAGE=s3: In this case credentials are optional: if not provided then the internal
# S3 client will try to use the default AWS credentials of the machine, if available.
# - OPENVIDU_PRO_SPEECH_TO_TEXT=aws: In this case credentials are mandatory.
# OPENVIDU_PRO_AWS_SECRET_KEY=
# This property applies to OPENVIDU_PRO_RECORDING_STORAGE=s3 and/or OPENVIDU_PRO_SPEECH_TO_TEXT=aws.
# It is the AWS region hosting the services. Depending on the service you have enabled:
# - OPENVIDU_PRO_RECORDING_STORAGE=s3: AWS region in which the S3 bucket is located (e.g. "eu-west-1").
# If not provided, the region will try to be discovered automatically, although this is not always possible.
# - OPENVIDU_PRO_SPEECH_TO_TEXT=aws: AWS region where Amazon Transcribe will operate. In this case the property is always mandatory.
#OPENVIDU_PRO_AWS_REGION=
# Optional. Use path style access for the s3 bucket defined at OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET
# Default value is: false
# Check https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#path-style-access
# With Minio, this property must be set to true
OPENVIDU_PRO_AWS_S3_WITH_PATH_STYLE_ACCESS=true
# Whether to enable recording module or not
OPENVIDU_RECORDING=false
# Use recording module with debug mode.
OPENVIDU_RECORDING_DEBUG=false
# Openvidu Folder Record used for save the openvidu recording videos. Change it
# with the folder you want to use from your host.
OPENVIDU_RECORDING_PATH=/opt/openvidu/recordings
# System path where OpenVidu Server should look for custom recording layouts
OPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/custom-layout
# if true any client can connect to
# https://OPENVIDU_SERVER_IP:OPENVIDU_PORT/recordings/any_session_file.mp4
# and access any recorded video file. If false this path will be secured with
# OPENVIDU_SECRET param just as OpenVidu Server dashboard at
# https://OPENVIDU_SERVER_IP:OPENVIDU_PORT
# Values: true | false
OPENVIDU_RECORDING_PUBLIC_ACCESS=false
# Which users should receive the recording events in the client side
# (recordingStarted, recordingStopped). Can be all (every user connected to
# the session), publisher_moderator (users with role 'PUBLISHER' or
# 'MODERATOR'), moderator (only users with role 'MODERATOR') or none
# (no user will receive these events)
OPENVIDU_RECORDING_NOTIFICATION=publisher_moderator
# Timeout in seconds for recordings to automatically stop (and the session involved to be closed)
# when conditions are met: a session recording is started but no user is publishing to it or a session
# is being recorded and last user disconnects. If a user publishes within the timeout in either case,
# the automatic stop of the recording is cancelled
# 0 means no timeout
OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT=120
# Maximum video bandwidth sent from clients to OpenVidu Server, in kbps.
# 0 means unconstrained
OPENVIDU_STREAMS_VIDEO_MAX_RECV_BANDWIDTH=1000
# Minimum video bandwidth sent from clients to OpenVidu Server, in kbps.
# 0 means unconstrained
OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300
# Maximum video bandwidth sent from OpenVidu Server to clients, in kbps.
# 0 means unconstrained
OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
# Minimum video bandwidth sent from OpenVidu Server to clients, in kbps.
# 0 means unconstrained
OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
# All sessions of OpenVidu will try to force this codec. If OPENVIDU_STREAMS_ALLOW_TRANSCODING=true
# when a codec can not be forced, transcoding will be allowed
# Values: MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
# Default value is MEDIA_SERVER_PREFERRED
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
# Values: true | false
# Default value is false
# OPENVIDU_STREAMS_ALLOW_TRANSCODING=false
# Use Simulcast video on WebRTC Publishers.
# Senders will encode duplicate video streams with different qualities,
# so the media server is able to select the most appropriate quality stream
# for each Subscriber.
# This setting is honored only if OpenVidu Server was configured to use the
# mediasoup media server. Otherwise, Simulcast will be disabled.
# Values: true | false
# Default: false
#OPENVIDU_WEBRTC_SIMULCAST=false
# Send openvidu-browser logs of clients to Elasticsearch
# Possible values:
# - disabled: Don't send logs. (default)
# - debug: Send all openvidu-browser logs
# - debug_app: Send openvidu-browser logs and frontend app logs
# OPENVIDU_BROWSER_LOGS=disabled
# true to enable OpenVidu Webhook service. false' otherwise
# Values: true | false
OPENVIDU_WEBHOOK=false
# HTTP endpoint where OpenVidu Server will send Webhook HTTP POST messages
# Must be a valid URL: http(s)://ENDPOINT
#OPENVIDU_WEBHOOK_ENDPOINT=
# List of headers that OpenVidu Webhook service will attach to HTTP POST messages
#OPENVIDU_WEBHOOK_HEADERS=
# List of events that will be sent by OpenVidu Webhook service
# Default value is all available events
OPENVIDU_WEBHOOK_EVENTS=[sessionCreated,sessionDestroyed,participantJoined,participantLeft,webrtcConnectionCreated,webrtcConnectionDestroyed,recordingStatusChanged,filterEventDispatched,mediaNodeStatusChanged,nodeCrashed,nodeRecovered]
# How often the garbage collector of non active sessions runs.
# This helps cleaning up sessions that have been initialized through
# REST API (and maybe tokens have been created for them) but have had no users connected.
# Default to 900s (15 mins). 0 to disable non active sessions garbage collector
OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900
# Minimum time in seconds that a non active session must have been in existence
# for the garbage collector of non active sessions to remove it. Default to 3600s (1 hour).
# If non active sessions garbage collector is disabled
# (property 'OPENVIDU_SESSIONS_GARBAGE_INTERVAL' to 0) this property is ignored
OPENVIDU_SESSIONS_GARBAGE_THRESHOLD=3600
# Call Detail Record enabled
# Whether to enable Call Detail Record or not
# Values: true | false
OPENVIDU_CDR=false
# Path where the cdr log files are hosted
OPENVIDU_CDR_PATH=/opt/openvidu/cdr
# Openvidu Server Level logs
# --------------------------
# Uncomment the next line and define this variable to change
# the verbosity level of the logs of Openvidu Service
# RECOMENDED VALUES: INFO for normal logs DEBUG for more verbose logs
# OV_CE_DEBUG_LEVEL=INFO
# OpenVidu Java Options
# --------------------------
# Uncomment the next line and define this to add options to java command
# Documentation: https://docs.oracle.com/cd/E37116_01/install.111210/e23737/configuring_jvm.htm#OUDIG00058
# JAVA_OPTIONS=-Xms2048m -Xmx4096m
# Media Node Configuration
# --------------------------
# You can add any KMS environment variable as described in the
# documentation of the docker image: https://hub.docker.com/r/kurento/kurento-media-server
# If you want to add an environment variable to KMS, you must add a variable using this prefix: 'KMS_DOCKER_ENV_',
# followed by the environment variable you want to setup.
# For example if you want to setup KMS_MIN_PORT to 50000, it would be KMS_DOCKER_ENV_KMS_MIN_PORT=50000
# Docker hub kurento media server: https://hub.docker.com/r/kurento/kurento-media-server
# Uncomment the next line and define this variable with KMS image that you want use
# By default, KMS_IMAGE is defined in media nodes and it does not need to be specified unless
# you want to use a specific version of KMS
# KMS_IMAGE=kurento/kurento-media-server:6.18.0
# Uncomment the next line and define this variable to change
# the verbosity level of the logs of KMS
# Documentation: https://doc-kurento.readthedocs.io/en/stable/features/logging.html
# KMS_DOCKER_ENV_GST_DEBUG=

View File

@ -0,0 +1,88 @@
filebeat.inputs:
- type: container
paths:
- '/var/lib/docker/containers/*/*.log'
- type: log
paths:
- /opt/openvidu/kurento-logs/*.log
fields:
kurento-media-server: true
ip: ${MEDIA_NODE_IP}
cluster_id: ${CLUSTER_ID}
node_id: ${NODE_ID}
node_role: medianode
fields_under_root: true
- type: container
paths:
- '/var/lib/docker/containers/*/*.log'
fields:
cluster_id: ${OPENVIDU_PRO_CLUSTER_ID:${DOMAIN_OR_PUBLIC_IP:undefined}}
node_id: master_${AWS_INSTANCE_ID:${OPENVIDU_PRO_CLUSTER_ID:${DOMAIN_OR_PUBLIC_IP:undefined}}}
node_role: masternode
fields_under_root: true
processors:
- add_docker_metadata:
host: "unix:///var/run/docker.sock"
- add_host_metadata:
netinfo.enabled: true
- decode_json_fields:
fields: ["message"]
target: "json"
overwrite_keys: true
- drop_event:
when.or:
- contains:
container.image.name: docker.elastic.co/beats/filebeat-oss
- contains:
container.image.name: docker.elastic.co/beats/metricbeat-oss
- contains:
container.image.name: openvidu/openvidu-coturn
- contains:
container.image.name: docker.elastic.co/elasticsearch/elasticsearch
- contains:
container.image.name: docker.elastic.co/kibana/kibana
- contains:
container.image.name: docker.elastic.co/beats/filebeat-oss
- contains:
container.image.name: docker.elastic.co/beats/metricbeat-oss
- contains:
container.image.name: openvidu/openvidu-server-pro
output:
elasticsearch:
indices:
- index: "filebeat-kurento-%{+yyyy.MM.dd}"
when.or:
- equals:
kurento-media-server: true
- index: "filebeat-mediasoup-%{+yyyy.MM.dd}"
when.or:
- contains:
container.image.name: openvidu/mediasoup-controller
- index: "filebeat-media-node-controller-%{+yyyy.MM.dd}"
when.or:
- contains:
container.image.name: openvidu/media-node-controller
- index: "filebeat-openvidu-recording-%{+yyyy.MM.dd}"
when.or:
- contains:
container.image.name: openvidu/openvidu-recording
- index: "filebeat-nginx-%{+yyyy.MM.dd}"
when.or:
- contains:
container.image.name: openvidu/openvidu-proxy
- index: "filebeat-openvidu-recording-%{+yyyy.MM.dd}"
when.or:
- contains:
container.image.name: openvidu/openvidu-recording
pipelines:
- pipeline: kurento-pipeline
when.or:
- equals:
kurento-media-server: true
logging.json: true
logging.metrics.enabled: false
setup.ilm.enabled: false

View File

@ -0,0 +1,44 @@
metricbeat.modules:
- module: nginx
metricsets: ["stubstatus"]
enabled: true
period: ${OPENVIDU_PRO_STATS_MONITORING_INTERVAL}s
hosts: ["http://127.0.0.1"]
server_status_path: "nginx_status"
- module: system
metricsets:
- cpu
- diskio
- memory
- network
- filesystem
- fsstat
#- process
- process_summary
- uptime
filesystem.ignore_types: [nfs, smbfs, autofs, devtmpfs, devpts, hugetlbfs, tmpfs, sysfs, securityfs, cgroup2, cgroup, pstore, debugfs, configfs, fusectl, proc, fuse.lxcfs, squashfs]
processes: ['.*']
# process.include_top_n:
# by_cpu: 2
# by_memory: 2
processors:
- drop_event:
when:
or:
- regexp:
system.network.name: '^(veth|lo|docker|br-)($|)'
- regexp:
system.filesystem.mount_point: '^/(sys|cgroup|proc|dev|etc|host)($|/)'
- regexp:
system.filesystem.mount_point: '^/hostfs/(sys|cgroup|proc|dev|etc|host)($|/)'
enabled: true
period: ${OPENVIDU_PRO_STATS_MONITORING_INTERVAL}s
cpu.metrics: [normalized_percentages]
fields:
ip: "${MEDIA_NODE_IP}"
cluster_id: ${OPENVIDU_PRO_CLUSTER_ID:${DOMAIN_OR_PUBLIC_IP:undefined}}
node_id: master_${AWS_INSTANCE_ID:${OPENVIDU_PRO_CLUSTER_ID:${DOMAIN_OR_PUBLIC_IP:undefined}}}
node_role: masternode
pipeline:
queue.mem.events: 0
setup.ilm.enabled: false

View File

@ -0,0 +1,154 @@
# ------------------------------------------------------------------------------
#
# DO NOT MODIFY THIS FILE !!!
#
# Configuration properties should be specified in .env file
#
# This docker-compose file coordinates all services of OpenVidu Enterprise HA Node
#
# This file will be overridden when update OpenVidu Enterprise HA Node
#
# Openvidu Version: 2.27.0
#
# Installation Mode: On Premises
#
# ------------------------------------------------------------------------------
version: '3.1'
services:
openvidu-server:
image: openvidu/openvidu-server-pro:master
container_name: openvidu-server
restart: on-failure
network_mode: host
entrypoint: ['/usr/local/bin/entrypoint.sh']
volumes:
- ./coturn:/run/secrets/coturn
- /var/run/docker.sock:/var/run/docker.sock
- ${OPENVIDU_RECORDING_PATH}:${OPENVIDU_RECORDING_PATH}
- ${OPENVIDU_RECORDING_CUSTOM_LAYOUT}:${OPENVIDU_RECORDING_CUSTOM_LAYOUT}
- ${OPENVIDU_CDR_PATH}:${OPENVIDU_CDR_PATH}
- ./cluster:/opt/openvidu/cluster
- .env:${PWD}/.env
env_file:
- .env
environment:
- SERVER_SSL_ENABLED=false
- SERVER_PORT=5443
- KMS_URIS=[]
- OPENVIDU_WEBHOOK=false
- OPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook
- MULTI_MASTER_REPLICATION_MANAGER_WEBHOOK=http://127.0.0.1:4443/openvidu/replication-manager-webhook?OPENVIDU_SECRET=${OPENVIDU_SECRET}
- COTURN_IP=${COTURN_IP:-auto-ipv4}
- COTURN_PORT=${COTURN_PORT:-3478}
- OPENVIDU_PRO_CLUSTER=true
- OPENVIDU_EDITION=enterprise
- OPENVIDU_PRO_CLUSTER_ENVIRONMENT=${OPENVIDU_PRO_CLUSTER_ENVIRONMENT:-on_premise}
- OPENVIDU_PRO_CLUSTER_MODE=manual
- OPENVIDU_PRO_CLUSTER_AUTOSCALING=false
- OPENVIDU_PRO_RECORDING_STORAGE=${OPENVIDU_PRO_RECORDING_STORAGE:-s3}
- OPENVIDU_PRO_AWS_S3_WITH_PATH_STYLE_ACCESS=${OPENVIDU_PRO_AWS_S3_WITH_PATH_STYLE_ACCESS:-true}
- OPENVIDU_PRO_ELASTICSEARCH=${OPENVIDU_PRO_ELASTICSEARCH:-true}
- OPENVIDU_PRO_KIBANA_HOST=${OPENVIDU_PRO_KIBANA_HOST:-http://127.0.0.1/kibana}
- OPENVIDU_PRO_ELASTICSEARCH_HOST=${OPENVIDU_PRO_ELASTICSEARCH_HOST:-http://127.0.0.1:9200}
- OPENVIDU_PRO_COTURN_IN_MEDIA_NODES=${OPENVIDU_PRO_COTURN_IN_MEDIA_NODES:-false}
- OPENVIDU_PRO_COTURN_PORT_MEDIA_NODES=${OPENVIDU_PRO_COTURN_PORT_MEDIA_NODES:-443}
- OPENVIDU_PRO_MEDIA_NODE_PUBLIC_IP_AUTODISCOVER=${OPENVIDU_PRO_MEDIA_NODE_PUBLIC_IP_AUTODISCOVER:-auto-ipv4}
- WAIT_KIBANA_URL=${OPENVIDU_PRO_KIBANA_HOST:-http://127.0.0.1/kibana}
- MULTI_MASTER_NODE_ID=${OPENVIDU_ENTERPRISE_HA_NODE_PRIVATE_IP}
- DOTENV_PATH=${PWD}
- SUPPORT_DEPRECATED_API=false
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"
replication-manager:
image: openvidu/replication-manager-on-prem:master
container_name: replication-manager
restart: always
network_mode: host
volumes:
- ./:/opt/openvidu
- /var/run/docker.sock:/var/run/docker.sock
environment:
- SERVER_PORT=4443
- SERVER_SSL_ENABLED=false
- OPENVIDU_SECRET=${OPENVIDU_SECRET}
- LOCAL_OPENVIDU_SERVER_URI=http://127.0.0.1:5443/
- OPENVIDU_PRO_CLUSTER_ENVIRONMENT=${OPENVIDU_PRO_CLUSTER_ENVIRONMENT:-on_premise}
- OPENVIDU_PRO_LICENSE=${OPENVIDU_PRO_LICENSE:-}
- OPENVIDU_ENTERPRISE_MEDIA_SERVER=${OPENVIDU_ENTERPRISE_MEDIA_SERVER:-}
- OPENVIDU_ENTERPRISE_HA_REDIS_HOST=${OPENVIDU_ENTERPRISE_HA_REDIS_HOST}
- OPENVIDU_ENTERPRISE_HA_REDIS_PORT=${OPENVIDU_ENTERPRISE_HA_REDIS_PORT}
- OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD=${OPENVIDU_ENTERPRISE_HA_REDIS_PASSWORD}
- REDIS_TIMEOUT=5
- REDIS_DB=replicationmanager
- OPENVIDU_ENTERPRISE_HA_NODE_PRIVATE_IP=${OPENVIDU_ENTERPRISE_HA_NODE_PRIVATE_IP}
- OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SERVICE_ENDPOINT=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SERVICE_ENDPOINT}
- OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_BUCKET}
- OPENVIDU_ENTERPRISE_HA_S3_CONFIG_REGION=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_REGION:-}
- OPENVIDU_ENTERPRISE_HA_S3_CONFIG_ACCESS_KEY=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_ACCESS_KEY:-}
- OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_SECRET_KEY:-}
- OPENVIDU_ENTERPRISE_HA_S3_CONFIG_PATH_STYLE_ACCESS=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_PATH_STYLE_ACCESS:-true}
- OPENVIDU_ENTERPRISE_HA_S3_CONFIG_HEADERS=${OPENVIDU_ENTERPRISE_HA_S3_CONFIG_HEADERS:-}
- OPENVIDU_ENTERPRISE_S3_CONFIG_AUTORESTART=${OPENVIDU_ENTERPRISE_S3_CONFIG_AUTORESTART:-true}
- INITIAL_CONFIG_SYNC=${INITIAL_CONFIG_SYNC:-false}
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"
coturn:
image: openvidu/openvidu-coturn:master
restart: on-failure
env_file:
- .env
ports:
- 443:443/tcp
- 443:443/udp
environment:
- COTURN_INTERNAL_RELAY=${COTURN_INTERNAL_RELAY:-true}
volumes:
- ./coturn:/run/secrets/coturn
command:
- --log-file=stdout
- --external-ip=$$(detect-external-ip)
- --listening-port=${COTURN_PORT:-443}
- --fingerprint
- --min-port=${COTURN_MIN_PORT:-40000}
- --max-port=${COTURN_MAX_PORT:-65535}
- --realm=openvidu
- --verbose
- --use-auth-secret
- --static-auth-secret=$${COTURN_SHARED_SECRET_KEY}
logging:
options:
max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"
media-node-controller:
image: openvidu/media-node-controller:master
restart: always
ulimits:
core: -1
environment:
- MEDIA_NODE_CONTROLLER_RECORDINGS_PATH=/opt/openvidu/mncontroller/recordings
- KMS_IMAGE=kurento/kurento-media-server:7.0.0
- MEDIASOUP_IMAGE=openvidu/mediasoup-controller:master
- METRICBEAT_IMAGE=docker.elastic.co/beats/metricbeat-oss:7.8.0
- FILEBEAT_IMAGE=docker.elastic.co/beats/filebeat-oss:7.8.0
- OPENVIDU_RECORDING_IMAGE=openvidu/openvidu-recording:master
- COTURN_IMAGE=openvidu/openvidu-coturn:master
- SPEECH_TO_TEXT_IMAGE=openvidu/speech-to-text-service:master
- NO_COLOR=true
ports:
- 3000:3000
volumes:
- /opt/openvidu/mncontroller/recordings:/opt/openvidu/mncontroller/recordings
- /opt/openvidu/beats:/opt/openvidu/beats
- /var/run/docker.sock:/var/run/docker.sock
- /opt/openvidu/kurento-logs:/opt/openvidu/kurento-logs
- ./beats:/beats
logging:
options:
max-size: "100M"

View File

@ -0,0 +1,360 @@
#!/usr/bin/env bash
# Global variables
OPENVIDU_FOLDER=openvidu
OPENVIDU_VERSION=master
OPENVIDU_UPGRADABLE_VERSION="2.27"
BEATS_FOLDER=${OPENVIDU_FOLDER}/beats
DOWNLOAD_URL=https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}
IMAGES_MEDIA_NODE_CONTROLLER=(
"kurento-media-server"
"docker.elastic.co/beats/filebeat"
"docker.elastic.co/beats/metricbeat"
"openvidu/mediasoup-controller"
"openvidu/openvidu-recording"
"openvidu/speech-to-text-service"
)
# Support docker compose v1 and v2
shopt -s expand_aliases
alias docker-compose='docker compose'
if ! docker compose version &> /dev/null; then
unalias docker-compose
fi
# Change default http timeout for slow networks
export COMPOSE_HTTP_TIMEOUT=500
export DOCKER_CLIENT_TIMEOUT=500
pull_images() {
OV_DIRECTORY="$1"
echo "Pulling images..."
for image in "${IMAGES_MEDIA_NODE_CONTROLLER[@]}"; do
IMAGE_PULL="$(grep "$image" "${OV_DIRECTORY}"/docker-compose.yml | cut -d "=" -f2)"
docker pull "$IMAGE_PULL" || fatal_error "Error: can not pull '${IMAGE_PULL}'"
done
docker-compose -f "${OV_DIRECTORY}"/docker-compose.yml pull || fatal_error "Error: can not pull images defined with docker-compose"
}
fatal_error() {
printf "\n =======¡ERROR!======="
printf "\n %s" "$1"
printf "\n"
exit 1
}
new_ov_installation() {
printf '\n'
printf '\n ======================================='
printf '\n Install OpenVidu Enterprise HA %s' "${OPENVIDU_VERSION}"
printf '\n ======================================='
printf '\n'
# Create folder openvidu-docker-compose
printf '\n => Creating folder '%s'...' "${OPENVIDU_FOLDER}"
mkdir "${OPENVIDU_FOLDER}" || fatal_error "Error while creating the folder '${OPENVIDU_FOLDER}'"
# Create beats folder
printf "\n => Creating folder 'beats'..."
mkdir -p "${BEATS_FOLDER}" || fatal_error "Error while creating the folder 'beats'"
# Download necessary files
printf '\n => Downloading OpenVidu Enterprise HA files:'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/beats/filebeat.yml \
--output "${BEATS_FOLDER}/filebeat.yml" || fatal_error "Error when downloading the file 'filebeat.yml'"
printf '\n - filebeat.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/beats/metricbeat-elasticsearch.yml \
--output "${BEATS_FOLDER}/metricbeat-elasticsearch.yml" || fatal_error "Error when downloading the file 'metricbeat-elasticsearch.yml'"
printf '\n - metricbeat-elasticsearch.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/.env \
--output "${OPENVIDU_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
printf '\n - .env'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/docker-compose.yml \
--output "${OPENVIDU_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
printf '\n - docker-compose.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/openvidu \
--output "${OPENVIDU_FOLDER}/openvidu" || fatal_error "Error when downloading the file 'openvidu'"
printf '\n - openvidu'
# Add execution permissions
printf "\n => Adding permission:"
chmod +x "${OPENVIDU_FOLDER}/openvidu" || fatal_error "Error while adding permission to 'openvidu' program"
printf '\n - openvidu'
# Change recording folders with all permissions
printf "\n => Adding permission to 'recordings' folder...\n"
mkdir -p "${OPENVIDU_FOLDER}/recordings"
mkdir -p "${OPENVIDU_FOLDER}/mncontroller/recordings"
chmod 777 "${OPENVIDU_FOLDER}/mncontroller/recordings"
# Pull all docker images
pull_images "${OPENVIDU_FOLDER}"
# Ready to use
printf '\n'
printf '\n'
printf '\n ======================================='
printf '\n OpenVidu Enterprise HA successfully installed.'
printf '\n ======================================='
printf '\n'
printf '\n 1. Go to openvidu folder:'
printf '\n ------------------------------------------------'
printf '\n $ cd openvidu'
printf '\n ------------------------------------------------'
printf '\n'
printf '\n'
printf '\n 2. Configure the .env file with your own values:'
printf '\n Check the documentation for more information:'
printf '\n https://docs.openvidu.io/en/%s/deployment/enterprise/on-premises/#high-availability-deployment' "${OPENVIDU_VERSION//v}"
printf '\n ------------------------------------------------'
printf '\n $ nano .env'
printf '\n ------------------------------------------------'
printf '\n'
printf '\n'
printf '\n 3. Start OpenVidu'
printf '\n ------------------------------------------------'
printf '\n $ ./openvidu start'
printf '\n ------------------------------------------------'
printf '\n'
printf '\n'
printf '\n'
exit 0
}
get_previous_env_variable() {
local ENV_VARIABLE_NAME=$1
echo "$(grep -E "${ENV_VARIABLE_NAME}=.*$" "${OPENVIDU_PREVIOUS_FOLDER}/.env" | cut -d'=' -f2)"
}
replace_variable_in_new_env_file() {
local ENV_VARIABLE_NAME=$1
local ENV_VARIABLE_VALUE=$2
[[ -n "${ENV_VARIABLE_VALUE}" ]] && sed -i "s|#${ENV_VARIABLE_NAME}=|${ENV_VARIABLE_NAME}=${ENV_VARIABLE_VALUE}|" "${OPENVIDU_PREVIOUS_FOLDER}/.env-${OPENVIDU_VERSION}"
}
upgrade_ov() {
# Search local Openvidu installation
printf '\n'
printf '\n ========================================================='
printf '\n Search Previous Installation of Openvidu Enterprise HA'
printf '\n ========================================================='
printf '\n'
SEARCH_IN_FOLDERS=(
"${PWD}"
"/opt/${OPENVIDU_FOLDER}"
)
for folder in "${SEARCH_IN_FOLDERS[@]}"; do
printf "\n => Searching in '%s' folder..." "${folder}"
if [ -f "${folder}/docker-compose.yml" ]; then
OPENVIDU_PREVIOUS_FOLDER="${folder}"
printf "\n => Found installation in folder '%s'" "${folder}"
break
fi
done
[ -z "${OPENVIDU_PREVIOUS_FOLDER}" ] && fatal_error "No previous Openvidu installation found"
# Upgrade Openvidu
OPENVIDU_PREVIOUS_VERSION=$(grep 'Openvidu Version:' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml" | awk '{ print $4 }')
[ -z "${OPENVIDU_PREVIOUS_VERSION}" ] && fatal_error "Can't find previous OpenVidu version"
# In this point using the variable 'OPENVIDU_PREVIOUS_VERSION' we can verify if the upgrade is
# posible or not. If it is not posible launch a warning and stop the upgrade.
if [[ "${OPENVIDU_PREVIOUS_VERSION}" != "${OPENVIDU_UPGRADABLE_VERSION}."* ]] && [[ "${OPENVIDU_PREVIOUS_VERSION}" != "${OPENVIDU_VERSION//v}"* ]]; then
fatal_error "You can't update from version ${OPENVIDU_PREVIOUS_VERSION} to ${OPENVIDU_VERSION}.\nNever upgrade across multiple major versions."
fi
# Check installation is a valid OpenVidu edition
if grep -q '.*image:.*\/openvidu-server:.*' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"; then
fatal_error "You can't upgrade. Installed version is OpenVidu CE"
fi
if ! grep -q '.*image:.*\/replication-manager-on-prem:.*' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"; then
fatal_error "You can't upgrade. Installed version is OpenVidu PRO"
fi
printf '\n'
printf '\n ======================================='
printf '\n Upgrade OpenVidu Enterprise HA %s to %s' "${OPENVIDU_PREVIOUS_VERSION}" "${OPENVIDU_VERSION}"
printf '\n ======================================='
printf '\n'
ROLL_BACK_FOLDER="${OPENVIDU_PREVIOUS_FOLDER}/.old-${OPENVIDU_PREVIOUS_VERSION}"
TMP_FOLDER="${OPENVIDU_PREVIOUS_FOLDER}/tmp"
ACTUAL_FOLDER="${PWD}"
printf "\n Creating rollback folder '%s'..." ".old-${OPENVIDU_PREVIOUS_VERSION}"
mkdir "${ROLL_BACK_FOLDER}" || fatal_error "Error while creating the folder '.old-${OPENVIDU_PREVIOUS_VERSION}'"
printf "\n Creating temporal folder 'tmp'..."
mkdir "${TMP_FOLDER}" || fatal_error "Error while creating the folder 'temporal'"
# Download necessary files
printf '\n => Downloading new OpenVidu Enterprise files:'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/beats/filebeat.yml \
--output "${TMP_FOLDER}/filebeat.yml" || fatal_error "Error when downloading the file 'filebeat.yml'"
printf '\n - filebeat.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/beats/metricbeat-elasticsearch.yml \
--output "${TMP_FOLDER}/metricbeat-elasticsearch.yml" || fatal_error "Error when downloading the file 'metricbeat-elasticsearch.yml'"
printf '\n - metricbeat-elasticsearch.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/.env \
--output "${TMP_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
printf '\n - .env'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/docker-compose.yml \
--output "${TMP_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
printf '\n - docker-compose.yml'
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/enterprise-ha/docker-compose/node/openvidu \
--output "${TMP_FOLDER}/openvidu" || fatal_error "Error when downloading the file 'openvidu'"
printf '\n - openvidu'
# Downloading new images and stopped actual Openvidu
printf '\n => Downloading new images...'
printf '\n'
sleep 1
printf "\n => Moving to 'tmp' folder..."
printf '\n'
cd "${TMP_FOLDER}" || fatal_error "Error when moving to 'tmp' folder"
printf '\n'
docker-compose pull || true
printf '\n => Stopping Openvidu...'
printf '\n'
sleep 1
printf "\n => Moving to 'openvidu' folder..."
printf '\n'
cd "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error when moving to 'openvidu' folder"
printf '\n'
docker-compose down || true
printf '\n'
printf '\n => Moving to working dir...'
cd "${ACTUAL_FOLDER}" || fatal_error "Error when moving to working dir"
# Move old files to rollback folder
printf '\n => Moving previous installation files to rollback folder:'
mv "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'docker-compose.yml'"
printf '\n - docker-compose.yml'
mv "${OPENVIDU_PREVIOUS_FOLDER}/openvidu" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'openvidu'"
printf '\n - openvidu'
mv "${OPENVIDU_PREVIOUS_FOLDER}/beats" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'beats'"
printf '\n - beats'
cp "${OPENVIDU_PREVIOUS_FOLDER}/.env" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous '.env'"
printf '\n - .env'
if [ -d "${OPENVIDU_PREVIOUS_FOLDER}/coturn" ]; then
mv "${OPENVIDU_PREVIOUS_FOLDER}/coturn" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous directory 'coturn'"
fi
# Move tmp files to Openvidu
printf '\n => Updating files:'
mv "${TMP_FOLDER}/docker-compose.yml" "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'docker-compose.yml'"
printf '\n - docker-compose.yml'
mv "${TMP_FOLDER}/.env" "${OPENVIDU_PREVIOUS_FOLDER}/.env-${OPENVIDU_VERSION}" || fatal_error "Error while moving previous '.env'"
printf '\n - .env-%s' "${OPENVIDU_VERSION}"
mv "${TMP_FOLDER}/openvidu" "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'openvidu'"
printf '\n - openvidu'
mkdir "${OPENVIDU_PREVIOUS_FOLDER}/beats" || fatal_error "Error while creating the folder 'beats'"
mv "${TMP_FOLDER}/filebeat.yml" "${OPENVIDU_PREVIOUS_FOLDER}/beats/filebeat.yml" || fatal_error "Error while updating 'filebeat.yml'"
printf '\n - beats/filebeat.yml'
mv "${TMP_FOLDER}/metricbeat-elasticsearch.yml" "${OPENVIDU_PREVIOUS_FOLDER}/beats/metricbeat-elasticsearch.yml" || fatal_error "Error while updating 'metricbeat-elasticsearch.yml'"
printf '\n - beats/metricbeat-elasticsearch.yml'
printf "\n => Deleting 'tmp' folder"
rm -rf "${TMP_FOLDER}" || fatal_error "Error deleting 'tmp' folder"
# Add execution permissions
printf "\n => Adding permission to 'openvidu' program..."
chmod +x "${OPENVIDU_PREVIOUS_FOLDER}/openvidu" || fatal_error "Error while adding permission to 'openvidu' program"
printf '\n - openvidu'
# Change recording folder with all permissions
printf "\n => Adding permission to 'recordings' folder..."
mkdir -p "${OPENVIDU_PREVIOUS_FOLDER}/recordings"
# Define old mode: On Premise or Cloud Formation
OLD_MODE=$(grep -E "Installation Mode:.*$" "${ROLL_BACK_FOLDER}/docker-compose.yml" | awk '{ print $4,$5 }')
[ -n "${OLD_MODE}" ] && sed -i -r "s/Installation Mode:.+/Installation Mode: ${OLD_MODE}/" "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"
pull_images "${OPENVIDU_PREVIOUS_FOLDER}"
# Ready to use
printf '\n'
printf '\n'
printf '\n ================================================'
printf "\n Openvidu Enterprise HA successfully upgraded to version %s" "${OPENVIDU_VERSION}"
printf '\n ================================================'
printf '\n'
printf "\n 1. A new file 'docker-compose.yml' has been created with the new OpenVidu Enterprise HA %s services" "${OPENVIDU_VERSION}"
printf '\n'
printf "\n 2. The previous file '.env' remains intact, but a new file '.env-%s' has been created." "${OPENVIDU_VERSION}"
printf "\n Transfer any configuration you wish to keep in the upgraded version from '.env' to '.env-%s'." "${OPENVIDU_VERSION}"
printf "\n When you are OK with it, rename and leave as the only '.env' file of the folder the new '.env-%s'." "${OPENVIDU_VERSION}"
printf '\n'
printf '\n 3. Start new version of Openvidu'
printf '\n ------------------------------------------------'
printf '\n $ ./openvidu start'
printf '\n ------------------------------------------------'
printf '\n'
printf "\n If you want to rollback, all the files from the previous installation have been copied to folder '.old-%s'" "${OPENVIDU_PREVIOUS_VERSION}"
printf '\n'
printf '\n'
printf '\n'
}
# Check docker and docker-compose installation
if ! command -v docker > /dev/null; then
echo "You don't have docker installed, please install it and re-run the command"
exit 1
else
# Check version of docker is equal or higher than 20.10.10
DOCKER_VERSION=$(docker version --format '{{.Server.Version}}' | sed "s/-rc[0-9]*//")
if ! printf '%s\n%s\n' "20.10.10" "$DOCKER_VERSION" | sort -V -C; then
echo "You need a docker version equal or higher than 20.10.10, please update your docker and re-run the command"; \
exit 1
fi
fi
if ! command -v docker-compose > /dev/null; then
echo "You don't have docker-compose installed, please install it and re-run the command"
exit 1
else
COMPOSE_VERSION=$(docker-compose version --short | sed "s/-rc[0-9]*//")
if ! printf '%s\n%s\n' "1.24" "$COMPOSE_VERSION" | sort -V -C; then
echo "You need a docker-compose version equal or higher than 1.24, please update your docker-compose and re-run the command"; \
exit 1
fi
fi
# Check type of installation
if [[ -n "$1" && "$1" == "upgrade" ]]; then
upgrade_ov "$2"
else
new_ov_installation
fi

View File

@ -0,0 +1,337 @@
#!/bin/bash
# Support docker compose v1 and v2
shopt -s expand_aliases
alias docker-compose='docker compose'
if ! docker compose version &> /dev/null; then
unalias docker-compose
fi
# Change default http timeout for slow networks
export COMPOSE_HTTP_TIMEOUT=500
export DOCKER_CLIENT_TIMEOUT=500
# Deployed images by media-node-controller
IMAGES=(
"kurento-media-server"
"docker.elastic.co/beats/filebeat"
"docker.elastic.co/beats/metricbeat"
"openvidu/media-node-controller"
"openvidu/speech-to-text-service"
"openvidu/mediasoup-controller"
"openvidu/openvidu-coturn"
)
docker_command_by_container_image() {
IMAGE_NAME=$1
COMMAND=$2
if [[ -n "${IMAGE_NAME}" ]]; then
CONTAINERS="$(docker ps -a | grep "${IMAGE_NAME}" | awk '{print $1}')"
for CONTAINER_ID in $CONTAINERS; do
if [[ -n "${CONTAINER_ID}" ]] && [[ -n "${COMMAND}" ]]; then
bash -c "docker ${COMMAND} ${CONTAINER_ID}"
fi
done
fi
}
collect_basic_information() {
LINUX_VERSION=$(lsb_release -d)
DOCKER_PS=$(docker ps)
DOCKER_VERSION=$(docker version --format '{{.Server.Version}}')
DOCKER_COMPOSE_VERSION=$(docker-compose version --short)
OV_FOLDER="${PWD}"
OV_VERSION=$(grep 'Openvidu Version:' "${OV_FOLDER}/docker-compose.yml" | awk '{ print $4 }')
CONTAINERS=$(docker ps | awk '{if(NR>1) print $NF}')
OV_TYPE_INSTALLATION=$(grep 'Installation Mode:' "${OV_FOLDER}/docker-compose.yml" | awk '{ print $4,$5 }')
TREE_OV_DIRECTORY=$(find "." ! -path '*/0/*' | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/")
}
version_ov() {
collect_basic_information
printf '\nOpenvidu Information:'
printf '\n'
printf '\n OpenVidu Edition: Enterprise HA'
printf '\n Installation Type: %s' "${OV_TYPE_INSTALLATION}"
printf '\n Openvidu Version: %s' "${OV_VERSION}"
printf '\n'
printf '\nSystem Information:'
printf '\n'
printf '\n Linux Version:'
printf '\n - %s' "${LINUX_VERSION}"
printf '\n Docker Version: %s' "${DOCKER_VERSION}"
printf '\n Docker Compose Version: %s' "${DOCKER_COMPOSE_VERSION}"
printf '\n'
printf '\nInstallation Information:'
printf '\n'
printf '\n Installation Folder: %s' "${OV_FOLDER}"
printf '\n Installation Folder Tree:'
printf '\n%s' "$(echo "${TREE_OV_DIRECTORY}" | sed -e 's/.//' -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
printf '\n'
printf '\nDocker Running Services:'
printf '\n'
printf '\n %s' "$(echo "${DOCKER_PS}" | sed -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
printf '\n'
}
generate_report() {
collect_basic_information
REPORT_CREATION_DATE=$(date +"%d-%m-%Y")
REPORT_CREATION_TIME=$(date +"%H:%M:%S")
REPORT_NAME="openvidu-report-${REPORT_CREATION_DATE}-$(date +"%H-%M").txt"
REPORT_OUTPUT="${OV_FOLDER}/${REPORT_NAME}"
{
printf "\n ======================================="
printf "\n = REPORT INFORMATION ="
printf "\n ======================================="
printf '\n'
printf '\n Creation Date: %s' "${REPORT_CREATION_DATE}"
printf '\n Creation Time: %s' "${REPORT_CREATION_TIME}"
printf '\n'
printf "\n ======================================="
printf "\n = OPENVIDU INFORMATION ="
printf "\n ======================================="
printf '\n'
printf '\n OpenVidu Edition: Enterprise HA'
printf '\n Installation Type: %s' "${OV_TYPE_INSTALLATION}"
printf '\n Openvidu Version: %s' "${OV_VERSION}"
# printf '\n Openvidu Call Version: %s' "${OV_CALL_VERSION}"
printf '\n'
printf "\n ======================================="
printf "\n = SYSTEM INFORMATION ="
printf "\n ======================================="
printf '\n'
printf '\n Linux Version:'
printf '\n - %s' "${LINUX_VERSION}"
printf '\n Docker Version: %s' "${DOCKER_VERSION}"
printf '\n Docker Compose Version: %s' "${DOCKER_COMPOSE_VERSION}"
printf '\n'
printf "\n ======================================="
printf "\n = INSTALLATION INFORMATION ="
printf "\n ======================================="
printf '\n'
printf '\n Installation Folder: %s' "${OV_FOLDER}"
printf '\n Installation Folder Tree:'
printf '\n%s' "$(echo "${TREE_OV_DIRECTORY}" | sed -e 's/.//' -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
printf '\n'
printf "\n ======================================="
printf "\n = DOCKER RUNNING SERVICES ="
printf "\n ======================================="
printf '\n'
printf '\n %s' "$(echo "${DOCKER_PS}" | sed -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
printf '\n'
printf "\n ======================================="
printf "\n = CONFIGURATION FILES ="
printf "\n ======================================="
printf '\n'
printf '\n ================ .env ================='
printf '\n'
printf '\n'
cat < "${OV_FOLDER}/.env" | sed -r -e "s/OPENVIDU_SECRET=.+/OPENVIDU_SECRET=****/" -e "s/OPENVIDU_PRO_LICENSE=.+/OPENVIDU_PRO_LICENSE=****/" -e "s/ELASTICSEARCH_PASSWORD=.+/ELASTICSEARCH_PASSWORD=****/"
printf '\n'
printf '\n ========= docker-compose.yml =========='
printf '\n'
printf '\n'
cat "${OV_FOLDER}/docker-compose.yml"
printf '\n'
printf '\n ==== docker-compose.override.yml ===='
printf '\n'
printf '\n'
if [ -f "${OV_FOLDER}/docker-compose.override.yml" ]; then
cat < "${OV_FOLDER}/docker-compose.override.yml"
else
printf '\n The docker-compose.override.yml file is not present'
fi
printf '\n'
printf '\n'
printf "\n ======================================="
printf "\n = LOGS ="
printf "\n ======================================="
for CONTAINER in $CONTAINERS
do
printf '\n'
printf "\n ---------------------------------------"
printf "\n %s" "$CONTAINER"
printf "\n ---------------------------------------"
printf '\n'
docker logs "$CONTAINER"
printf "\n ---------------------------------------"
printf '\n'
printf '\n'
done
printf "\n ======================================="
printf "\n = CONTAINER ENVS VARIABLES ="
printf "\n ======================================="
for CONTAINER in $CONTAINERS
do
printf '\n'
printf "\n ======================================="
printf "\n %s" "$CONTAINER"
printf "\n ---------------------------------------"
printf '\n'
docker exec "$CONTAINER" env
printf "\n ---------------------------------------"
printf '\n'
printf '\n'
done
} >> "${REPORT_OUTPUT}" 2>&1
printf "\n Generation of the report completed with success"
printf "\n You can get your report at path '%s'" "${REPORT_OUTPUT}"
printf "\n"
}
is_external_url() {
local URL=$1
if [[ -z "$URL" ]]; then
return 1
fi
if [[ "${URL}" == *"localhost"* ]] || [[ "${URL}" == *"127.0.0.1"* ]] || [[ "${URL}" == *"::1"* ]]; then
return 1
else
return 0
fi
}
print_env_error() {
printf "\n ERROR: You must set the '%s' variable in the .env file" "${1}"
printf "\n"
}
check_non_empty_parameters() {
local NON_EMPTY_ENV_VARS=("$@")
for ENV_VAR_NAME in "${NON_EMPTY_ENV_VARS[@]}" ; do
ENV_VAR_VALUE=$(grep -v '^#' .env | grep "${ENV_VAR_NAME}" | cut -d '=' -f2)
if [[ -z "${ENV_VAR_VALUE}" ]]; then
print_env_error "${ENV_VAR_NAME}"
exit 1
fi
done
}
get_env_var_value() {
local ENV_VAR_NAME=$1
local ENV_VAR_VALUE
ENV_VAR_VALUE=$(grep -v '^#' .env | grep "${ENV_VAR_NAME}" | cut -d '=' -f2)
echo "${ENV_VAR_VALUE}"
}
check_env_var_is_value() {
local ENV_VAR_NAME=$1
local ENV_VAR_VALUE=$2
local ENV_VAR_VALUE_TO_CHECK
ENV_VAR_VALUE_TO_CHECK=$(get_env_var_value "${ENV_VAR_NAME}")
if [[ "${ENV_VAR_VALUE_TO_CHECK}" != "${ENV_VAR_VALUE}" ]]; then
print_env_error "${ENV_VAR_NAME}"
exit 1
fi
}
start_openvidu() {
export INITIAL_CONFIG_SYNC=true
if ! docker-compose up --exit-code-from replication-manager replication-manager; then
printf "\n ERROR: Openvidu Node failed to start"
printf "\n"
unset INITIAL_CONFIG_SYNC
docker-compose down
exit 1
fi
docker-compose down
unset INITIAL_CONFIG_SYNC
docker-compose up -d
}
stop_containers() {
printf "Stopping containers..."
for IMAGE in "${IMAGES[@]}"; do
docker_command_by_container_image "${IMAGE}" "rm -f"
done
}
usage() {
printf "Usage: \n\t openvidu [command]"
printf "\n\nAvailable Commands:"
printf "\n\tstart\t\t\tStart all services"
printf "\n\tstop\t\t\tStop all services"
printf "\n\trestart\t\t\tRestart all stopped and running services"
printf "\n\tlogs\t\t\tShow openvidu-server logs"
printf "\n\tupgrade\t\t\tUpgrade to the latest Openvidu version"
printf "\n\tupgrade [version]\tUpgrade to the specific Openvidu version"
printf "\n\tversion\t\t\tShow version of Openvidu Server"
printf "\n\treport\t\t\tGenerate a report with the current status of Openvidu"
printf "\n\thelp\t\t\tShow help for openvidu command"
printf "\n"
}
[[ -z "${FOLLOW_OPENVIDU_LOGS}" ]] && FOLLOW_OPENVIDU_LOGS=true
case $1 in
start)
start_openvidu
if [[ "${FOLLOW_OPENVIDU_LOGS}" == "true" ]]; then
# Docker compose logs of openvidu-server and repliation-manager containers
docker-compose logs -f --tail 10 openvidu-server replication-manager
fi
;;
stop)
docker-compose down
stop_containers
;;
restart)
docker-compose down
stop_containers
start_openvidu
if [[ "${FOLLOW_OPENVIDU_LOGS}" == "true" ]]; then
docker-compose logs -f --tail 10 openvidu-server replication-manager
fi
;;
logs)
case "${2-}" in
--follow|-f)
docker-compose logs -f --tail 10 openvidu-server replication-manager
;;
*)
docker-compose logs openvidu-server replication-manager
;;
esac
;;
version)
version_ov
;;
report)
read -r -p " You are about to generate a report on the current status of Openvidu, this may take some time. Do you want to continue? [y/N]: " response
case "$response" in
[yY][eE][sS]|[yY])
generate_report
;;
*)
exit 0
;;
esac
;;
*)
usage
;;
esac