From f54ebc285181f724efa9886b2dfff77cd1b38a06 Mon Sep 17 00:00:00 2001 From: cruizba Date: Tue, 3 Nov 2020 12:38:00 +0100 Subject: [PATCH] openvidu-deployment-pro: New media-node-controller 2.0.0-dev1 --- .../pro/docker-compose/media-node/.env | 30 ------------ .../media-node/beats/filebeat.yml | 16 ++++-- .../media-node/docker-compose.yml | 10 ++-- .../media-node/install_media_node.sh | 49 ++++++++++++------- 4 files changed, 47 insertions(+), 58 deletions(-) delete mode 100644 openvidu-server/deployments/pro/docker-compose/media-node/.env diff --git a/openvidu-server/deployments/pro/docker-compose/media-node/.env b/openvidu-server/deployments/pro/docker-compose/media-node/.env deleted file mode 100644 index fd244380..00000000 --- a/openvidu-server/deployments/pro/docker-compose/media-node/.env +++ /dev/null @@ -1,30 +0,0 @@ -# KMS Configuration -# -------------------------- - -# 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. - -# Kurento Media Server image -# -------------------------- -# Docker hub kurento media server: https://hub.docker.com/r/kurento/kurento-media-server-dev -# Uncomment the next line and define this variable with KMS image that you want use -# KMS_IMAGE=kurento/kurento-media-server-dev:6.14.0 - -# Kurento Media Server Level logs -# ------------------------------- -# 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_DEBUG_LEVEL=3,Kurento*:4,kms*:4,sdp*:4,webrtc*:4,*rtpendpoint:4,rtp*handler:4,rtpsynchronizer:4,agnosticbin:4 - -# Metricbeat ElasticSearch Image -# ------------------------------- -# Docker hub kurento media server: https://www.docker.elastic.co/ -# Uncomment the next line and define this variable with METRICBEAT_IMAGE image that you want use -# METRICBEAT_IMAGE=docker.elastic.co/beats/metricbeat-oss:7.8.0 - -# FileBeat ElasticSearch Image -# ------------------------------- -# Docker hub kurento media server: https://www.docker.elastic.co/ -# Uncomment the next line and define this variable with FILEBEAT_IMAGE image that you want use -# FILEBEAT_IMAGE=docker.elastic.co/beats/filebeat-oss:7.8.0 \ No newline at end of file diff --git a/openvidu-server/deployments/pro/docker-compose/media-node/beats/filebeat.yml b/openvidu-server/deployments/pro/docker-compose/media-node/beats/filebeat.yml index 5a2f4f59..7a54ffaf 100644 --- a/openvidu-server/deployments/pro/docker-compose/media-node/beats/filebeat.yml +++ b/openvidu-server/deployments/pro/docker-compose/media-node/beats/filebeat.yml @@ -5,6 +5,14 @@ filebeat.inputs: multiline.pattern: '^\d*:\d*:\d*' multiline.negate: true multiline.match: after + - type: log + paths: + - /opt/openvidu/kurento-logs/*.log + fields: + kurento-media-server: true + ip: ${MEDIA_NODE_IP} + cluster-id: ${CLUSTER_ID} + fields_under_root: true processors: - add_docker_metadata: @@ -26,13 +34,13 @@ output: indices: - index: "filebeat-kurento-%{+yyyy.MM.dd}" when.or: - - contains: - container.image.name: kurento/kurento-media-server + - equals: + kurento-media-server: true pipelines: - pipeline: kurento-pipeline when.or: - - contains: - container.image.name: kurento/kurento-media-server + - equals: + kurento-media-server: true logging.json: true logging.metrics.enabled: false diff --git a/openvidu-server/deployments/pro/docker-compose/media-node/docker-compose.yml b/openvidu-server/deployments/pro/docker-compose/media-node/docker-compose.yml index 5e568d0b..7eb17be9 100644 --- a/openvidu-server/deployments/pro/docker-compose/media-node/docker-compose.yml +++ b/openvidu-server/deployments/pro/docker-compose/media-node/docker-compose.yml @@ -16,7 +16,7 @@ version: '3.1' services: media-node-controller: - image: openvidu/media-node-controller:1.0.0 + image: openvidu/media-node-controller:2.0.0-dev1 restart: always ulimits: core: -1 @@ -24,14 +24,14 @@ services: env_file: - .env environment: - - KMS_IMAGE=${KMS_IMAGE:-kurento/kurento-media-server:6.14.0} - - KMS_DEBUG_LEVEL=${KMS_DEBUG_LEVEL:-} - - METRICBEAT_IMAGE=${METRICBEAT_IMAGE:-docker.elastic.co/beats/metricbeat-oss:7.8.0} - - FILEBEAT_IMAGE=${FILEBEAT_IMAGE:-docker.elastic.co/beats/filebeat-oss:7.8.0} + - KMS_IMAGE=kurento/kurento-media-server:6.14.0 + - METRICBEAT_IMAGE=docker.elastic.co/beats/metricbeat-oss:7.8.0 + - FILEBEAT_IMAGE=docker.elastic.co/beats/filebeat-oss:7.8.0 ports: - 3000:3000 volumes: - /opt/openvidu/recordings:/opt/openvidu/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 diff --git a/openvidu-server/deployments/pro/docker-compose/media-node/install_media_node.sh b/openvidu-server/deployments/pro/docker-compose/media-node/install_media_node.sh index 45e0eb89..693dc485 100755 --- a/openvidu-server/deployments/pro/docker-compose/media-node/install_media_node.sh +++ b/openvidu-server/deployments/pro/docker-compose/media-node/install_media_node.sh @@ -33,10 +33,6 @@ new_media_node_installation() { --output "${MEDIA_NODE_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/pro/docker-compose/media-node/.env \ - --output "${MEDIA_NODE_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'" - printf '\n - .env' - curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/media_node \ --output "${MEDIA_NODE_FOLDER}/media_node" || fatal_error "Error when downloading the file 'media_node'" printf '\n - media_node' @@ -68,9 +64,9 @@ new_media_node_installation() { # Pull images printf "\n => Pulling images...\n" cd "${MEDIA_NODE_FOLDER}" || fatal_error "Error when moving to '${MEDIA_NODE_FOLDER}' folder" - KMS_IMAGE=$(cat docker-compose.yml | grep KMS_IMAGE | sed 's/\(^.*KMS_IMAGE:-\)\(.*\)\(\}.*$\)/\2/') - METRICBEAT_IMAGE=$(cat docker-compose.yml | grep METRICBEAT_IMAGE | sed 's/\(^.*METRICBEAT_IMAGE:-\)\(.*\)\(\}.*$\)/\2/') - FILEBEAT_IMAGE=$(cat docker-compose.yml | grep FILEBEAT_IMAGE | sed 's/\(^.*FILEBEAT_IMAGE:-\)\(.*\)\(\}.*$\)/\2/') + KMS_IMAGE=$(cat docker-compose.yml | grep KMS_IMAGE | cut -d"=" -f2) + METRICBEAT_IMAGE=$(cat docker-compose.yml | grep METRICBEAT_IMAGE | cut -d"=" -f2) + FILEBEAT_IMAGE=$(cat docker-compose.yml | grep FILEBEAT_IMAGE | cut -d"=" -f2) docker pull $KMS_IMAGE || fatal "Error while pulling docker image: $KMS_IMAGE" docker pull $METRICBEAT_IMAGE || fatal "Error while pulling docker image: $METRICBEAT_IMAGE" docker pull $FILEBEAT_IMAGE || fatal "Error while pulling docker image: $FILEBEAT_IMAGE" @@ -81,13 +77,25 @@ new_media_node_installation() { printf '\n =======================================' printf "\n Media Node successfully installed." printf '\n =======================================' - printf "\n" + printf '\n' printf '\n 1. Go to kms folder:' printf '\n $ cd kms' - printf "\n" + printf '\n' printf '\n 2. Start Media Node Controller' printf '\n $ ./media_node start' printf '\n' + printf '\n 3. Add the private ip of this media node in `KMS_URIS=[]` in OpenVidu Pro machine' + printf '\n in the file located at "/opt/openvidu/.env" with this format:' + printf '\n ...' + printf '\n KMS_URIS=["ws://:8888/kurento"]' + printf '\n ...' + printf '\n You can also add this node from inspector' + printf '\n After that start or restart OpenVidu Pro and all containers will be provisioned in all media nodes' + printf '\n automatically to all the media nodes configured in "KMS_URIS"' + printf '\n More info about Media Nodes deployment here:' + printf "\n --> https://docs.openvidu.io/en/${OPENVIDU_VERSION//v}/openvidu-pro/deployment/on-premises/#set-the-number-of-media-nodes-on-startup" + printf '\n' + printf '\n' printf "\n For more information, check:" printf "\n https://docs.openvidu.io/en/${OPENVIDU_VERSION//v}/openvidu-pro/deployment/on-premises/#deployment-instructions" printf '\n' @@ -151,10 +159,6 @@ upgrade_media_node() { --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/pro/docker-compose/media-node/.env \ - --output "${TMP_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'" - printf '\n - .env' - curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/media_node \ --output "${TMP_FOLDER}/media_node" || fatal_error "Error when downloading the file 'media_node'" printf '\n - media_node' @@ -231,9 +235,6 @@ upgrade_media_node() { mv "${TMP_FOLDER}/docker-compose.yml" "${MEDIA_NODE_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'docker-compose.yml'" printf '\n - docker-compose.yml' - mv "${TMP_FOLDER}/.env" "${MEDIA_NODE_PREVIOUS_FOLDER}/.env-${MEDIA_NODE_VERSION}" || fatal_error "Error while moving previous '.env'" - printf '\n - .env-%s' "${MEDIA_NODE_VERSION}" - mv "${TMP_FOLDER}/media_node" "${MEDIA_NODE_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'media_node'" printf '\n - media_node' @@ -275,13 +276,23 @@ upgrade_media_node() { printf '\n' printf "\n 1. A new file 'docker-compose.yml' has been created with the new OpenVidu %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 2. This new version %s does not need any .env file. Everything is configured from OpenVidu Pro" "${OPENVIDU_VERSION}" printf '\n' printf '\n 3. Start new version of Media Node' printf '\n $ ./media_node start' printf '\n' + printf '\n 4. Add the private ip of this media node in `KMS_URIS=[]` in OpenVidu Pro machine' + printf '\n in the file located at "/opt/openvidu/.env" with this format:' + printf '\n ...' + printf '\n KMS_URIS=["ws://:8888/kurento"]' + printf '\n ...' + printf '\n You can also add this node from inspector' + printf '\n After that start or restart OpenVidu Pro and all containers will be provisioned' + printf '\n automatically to all the media nodes configured in "KMS_URIS"' + printf '\n More info about Media Nodes deployment here:' + printf "\n --> https://docs.openvidu.io/en/${OPENVIDU_VERSION//v}/openvidu-pro/deployment/on-premises/#set-the-number-of-media-nodes-on-startup" + 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'