mirror of https://github.com/OpenVidu/openvidu.git
openvidu-pro: Fix some Elasticsearch and Kibana config inconsistencies.
- 1. `ELASTICSEARCH_PASSWORD` must be greater than 6 characters - 2. Port 443 and 80 is no longer needed to be specified when defining `OPENVIDU_PRO_ELASTICSEARCH_HOST` and `OPENVIDU_PRO_KIBANA_HOST` - 3. OpenVidu Pro can run without Elasticsearch and Kibana by using `OPENVIDU_PRO_ELASTICSEARCH_ENABLED`pull/780/head
parent
53e75e5f83
commit
cb8d87aecc
|
@ -154,6 +154,9 @@ OPENVIDU_PRO_CLUSTER_LOAD_STRATEGY=streams
|
|||
# algorithm will be invoked for each user, in seconds
|
||||
# OPENVIDU_PRO_NETWORK_QUALITY_INTERVAL=5
|
||||
|
||||
# If you want to use Elasticsearch and Kibana, this variable should be set to true.
|
||||
OPENVIDU_PRO_ELASTICSEARCH_ENABLED=true
|
||||
|
||||
# Max days until delete indexes in state of rollover on Elasticsearch
|
||||
# Type number >= 0
|
||||
# Default Value is 7
|
||||
|
|
|
@ -46,6 +46,7 @@ services:
|
|||
- COTURN_IP=${COTURN_IP:-auto-ipv4}
|
||||
- COTURN_PORT=${COTURN_PORT:-3478}
|
||||
- OPENVIDU_PRO_CLUSTER=true
|
||||
- OPENVIDU_PRO_ELASTICSEARCH_ENABLED=${OPENVIDU_PRO_ELASTICSEARCH_ENABLED:-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}
|
||||
|
@ -126,6 +127,23 @@ services:
|
|||
- /proc:/hostfs/proc:ro
|
||||
- /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro
|
||||
- /:/hostfs:ro
|
||||
entrypoint: >
|
||||
/bin/bash -c 'if [[ $${OPENVIDU_PRO_ELASTICSEARCH_HOST} =~ ^(https?://)?([^:/]+)(:([0-9]+))?(/.*)?$$ ]]; then
|
||||
ES_PROTO=$${BASH_REMATCH[1]}
|
||||
ES_HOST=$${BASH_REMATCH[2]}
|
||||
ES_PATH=$${BASH_REMATCH[5]}
|
||||
if [[ $$ES_PROTO == "https://" ]] && [[ -z $${BASH_REMATCH[4]} ]]; then
|
||||
ES_PORT=443
|
||||
else
|
||||
ES_PORT=80
|
||||
fi;
|
||||
OPENVIDU_PRO_ELASTICSEARCH_HOST=$${ES_PROTO}$${ES_HOST}:$${ES_PORT}$${ES_PATH}
|
||||
else
|
||||
echo "Invalid OPENVIDU_PRO_ELASTICSEARCH_HOST"
|
||||
echo "It must be a valid URL"
|
||||
exit 1
|
||||
fi;
|
||||
/bin/bash -c "$$@"'
|
||||
command: >
|
||||
/bin/bash -c "metricbeat -e -strict.perms=false -e -system.hostfs=/hostfs
|
||||
`if [ ! -z $ELASTICSEARCH_USERNAME ]; then echo '-E output.elasticsearch.username=$ELASTICSEARCH_USERNAME'; fi`
|
||||
|
@ -147,6 +165,23 @@ services:
|
|||
- ./beats/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
|
||||
- /var/lib/docker:/var/lib/docker:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
entrypoint: >
|
||||
/bin/bash -c 'if [[ $${OPENVIDU_PRO_ELASTICSEARCH_HOST} =~ ^(https?://)?([^:/]+)(:([0-9]+))?(/.*)?$$ ]]; then
|
||||
ES_PROTO=$${BASH_REMATCH[1]}
|
||||
ES_HOST=$${BASH_REMATCH[2]}
|
||||
ES_PATH=$${BASH_REMATCH[5]}
|
||||
if [[ $$ES_PROTO == "https://" ]] && [[ -z $${BASH_REMATCH[4]} ]]; then
|
||||
ES_PORT=443
|
||||
else
|
||||
ES_PORT=80
|
||||
fi;
|
||||
OPENVIDU_PRO_ELASTICSEARCH_HOST=$${ES_PROTO}$${ES_HOST}:$${ES_PORT}$${ES_PATH}
|
||||
else
|
||||
echo "Invalid OPENVIDU_PRO_ELASTICSEARCH_HOST"
|
||||
echo "It must be a valid URL"
|
||||
exit 1
|
||||
fi;
|
||||
/bin/bash -c "$$@"'
|
||||
command: >
|
||||
/bin/bash -c "filebeat -e -strict.perms=false
|
||||
`if [ ! -z $ELASTICSEARCH_USERNAME ]; then echo '-E output.elasticsearch.username=$ELASTICSEARCH_USERNAME'; fi`
|
||||
|
|
|
@ -108,6 +108,9 @@ OPENVIDU_PRO_CLUSTER_LOAD_STRATEGY=streams
|
|||
# algorithm will be invoked for each user, in seconds
|
||||
# OPENVIDU_PRO_NETWORK_QUALITY_INTERVAL=5
|
||||
|
||||
# If you want to use Elasticsearch and Kibana, this variable should be set to true.
|
||||
OPENVIDU_PRO_ELASTICSEARCH_ENABLED=true
|
||||
|
||||
# Max days until delete indexes in state of rollover on Elasticsearch
|
||||
# Type number >= 0
|
||||
# Default Value is 7
|
||||
|
|
|
@ -43,6 +43,7 @@ services:
|
|||
- COTURN_IP=${COTURN_IP:-auto-ipv4}
|
||||
- COTURN_PORT=${COTURN_PORT:-3478}
|
||||
- OPENVIDU_PRO_CLUSTER=true
|
||||
- OPENVIDU_PRO_ELASTICSEARCH_ENABLED=${OPENVIDU_PRO_ELASTICSEARCH_ENABLED:-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}
|
||||
- WAIT_KIBANA_URL=${OPENVIDU_PRO_KIBANA_HOST:-http://127.0.0.1/kibana}
|
||||
|
|
|
@ -230,6 +230,47 @@ is_external_url() {
|
|||
fi
|
||||
}
|
||||
|
||||
is_elasticsearch_enabled() {
|
||||
local ELASTICSEARCH_ENABLED
|
||||
ELASTICSEARCH_ENABLED=$(grep -v '^#' .env | grep OPENVIDU_PRO_ELASTICSEARCH_ENABLED | cut -d '=' -f2)
|
||||
|
||||
# First check if empty
|
||||
if [[ -z "$ELASTICSEARCH_ENABLED" ]]; then
|
||||
# If empty, then elasticsearch is enabled
|
||||
return 0
|
||||
fi
|
||||
|
||||
# If not empty, then check if true
|
||||
if [[ "$ELASTICSEARCH_ENABLED" == "true" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_elasticsearch_secured() {
|
||||
local ELASTICSEARCH_USER
|
||||
local ELASTICSEARCH_PASSWORD
|
||||
ELASTICSEARCH_USER=$(grep -v '^#' .env | grep ELASTICSEARCH_USER | cut -d '=' -f2)
|
||||
ELASTICSEARCH_PASSWORD=$(grep -v '^#' .env | grep ELASTICSEARCH_PASSWORD | cut -d '=' -f2)
|
||||
|
||||
# First check if empty
|
||||
if [[ -z "$ELASTICSEARCH_USER" ]] || [[ -z "$ELASTICSEARCH_PASSWORD" ]]; then
|
||||
# If empty, then elasticsearch is not secured
|
||||
printf "ERROR: The elasticsearch user or password is empty."
|
||||
printf "\nVariables ELASTICSEARCH_USER and ELASTICSEARCH_PASSWORD in the .env file are mandatory"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check that password is greater than 6 characters
|
||||
if [[ ${#ELASTICSEARCH_PASSWORD} -lt 6 ]]; then
|
||||
printf "ERROR: Variable ELASTICSEARCH_PASSWORD in the .env file must be greater than 6 characters"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
start_openvidu() {
|
||||
local RUN_LOCAL_ES
|
||||
local RUN_LOCAL_KIBANA
|
||||
|
@ -240,22 +281,43 @@ start_openvidu() {
|
|||
COTURN_IN_MEDIA_NODES=$(grep -v '^#' .env | grep COTURN_IN_MEDIA_NODES | cut -d '=' -f2)
|
||||
RUN_LOCAL_ES=true
|
||||
RUN_LOCAL_KIBANA=true
|
||||
RUN_LOCAL_FILEBEAT=true
|
||||
RUN_LOCAL_METRICBEAT=true
|
||||
|
||||
# Default values
|
||||
if [[ -z "${COTURN_IN_MEDIA_NODES}" ]]; then
|
||||
COTURN_IN_MEDIA_NODES=false
|
||||
fi
|
||||
if is_external_url "${CONFIGURED_ELASTICSEARCH_HOST}"; then
|
||||
printf "Configured external elasticsearch: %s" "${CONFIGURED_ELASTICSEARCH_HOST}"
|
||||
printf "\n"
|
||||
|
||||
if is_elasticsearch_enabled; then
|
||||
RUN_LOCAL_ES=false
|
||||
fi
|
||||
if is_external_url "${CONFIGURED_KIBANA_HOST}"; then
|
||||
printf "Configured external kibana: %s" "${CONFIGURED_KIBANA_HOST}"
|
||||
printf "\n"
|
||||
RUN_LOCAL_KIBANA=false
|
||||
RUN_LOCAL_FILEBEAT=false
|
||||
RUN_LOCAL_METRICBEAT=false
|
||||
else
|
||||
# If elastic is not enabled, check credentials, and check if external elasticsearch is configured
|
||||
if ! is_elasticsearch_secured; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if is_external_url "${CONFIGURED_ELASTICSEARCH_HOST}"; then
|
||||
printf "Configured external elasticsearch: %s" "${CONFIGURED_ELASTICSEARCH_HOST}"
|
||||
printf "\n"
|
||||
RUN_LOCAL_ES=false
|
||||
fi
|
||||
if is_external_url "${CONFIGURED_KIBANA_HOST}"; then
|
||||
printf "Configured external kibana: %s" "${CONFIGURED_KIBANA_HOST}"
|
||||
printf "\n"
|
||||
RUN_LOCAL_KIBANA=false
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
docker-compose up -d \
|
||||
$(if [ "${RUN_LOCAL_ES}" == "false" ]; then echo '--scale elasticsearch=0'; fi) \
|
||||
$(if [ "${RUN_LOCAL_KIBANA}" == "false" ]; then echo '--scale kibana=0'; fi) \
|
||||
$(if [ "${RUN_LOCAL_FILEBEAT}" == "false" ]; then echo '--scale filebeat=0'; fi) \
|
||||
$(if [ "${RUN_LOCAL_METRICBEAT}" == "false" ]; then echo '--scale metricbeat=0'; fi) \
|
||||
$(if [ "${COTURN_IN_MEDIA_NODES}" == "true" ]; then echo '--scale coturn=0'; fi)
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,9 @@ OPENVIDU_PRO_CLUSTER_LOAD_STRATEGY=streams
|
|||
# algorithm will be invoked for each user, in seconds
|
||||
# OPENVIDU_PRO_NETWORK_QUALITY_INTERVAL=5
|
||||
|
||||
# If you want to use Elasticsearch and Kibana, this variable should be set to true.
|
||||
OPENVIDU_PRO_ELASTICSEARCH_ENABLED=true
|
||||
|
||||
# Max days until delete indexes in state of rollover on Elasticsearch
|
||||
# Type number >= 0
|
||||
# Default Value is 7
|
||||
|
|
|
@ -43,6 +43,7 @@ services:
|
|||
- COTURN_IP=${COTURN_IP:-auto-ipv4}
|
||||
- COTURN_PORT=${COTURN_PORT:-3478}
|
||||
- OPENVIDU_PRO_CLUSTER=true
|
||||
- OPENVIDU_PRO_ELASTICSEARCH_ENABLED=${OPENVIDU_PRO_ELASTICSEARCH_ENABLED:-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}
|
||||
- WAIT_KIBANA_URL=${OPENVIDU_PRO_KIBANA_HOST:-http://127.0.0.1/kibana}
|
||||
|
@ -159,6 +160,23 @@ services:
|
|||
- /proc:/hostfs/proc:ro
|
||||
- /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro
|
||||
- /:/hostfs:ro
|
||||
entrypoint: >
|
||||
/bin/bash -c 'if [[ $${OPENVIDU_PRO_ELASTICSEARCH_HOST} =~ ^(https?://)?([^:/]+)(:([0-9]+))?(/.*)?$$ ]]; then
|
||||
ES_PROTO=$${BASH_REMATCH[1]}
|
||||
ES_HOST=$${BASH_REMATCH[2]}
|
||||
ES_PATH=$${BASH_REMATCH[5]}
|
||||
if [[ $$ES_PROTO == "https://" ]] && [[ -z $${BASH_REMATCH[4]} ]]; then
|
||||
ES_PORT=443
|
||||
else
|
||||
ES_PORT=80
|
||||
fi;
|
||||
OPENVIDU_PRO_ELASTICSEARCH_HOST=$${ES_PROTO}$${ES_HOST}:$${ES_PORT}$${ES_PATH}
|
||||
else
|
||||
echo "Invalid OPENVIDU_PRO_ELASTICSEARCH_HOST"
|
||||
echo "It must be a valid URL"
|
||||
exit 1
|
||||
fi;
|
||||
/bin/bash -c "$$@"'
|
||||
command: >
|
||||
/bin/bash -c "metricbeat -e -strict.perms=false -e -system.hostfs=/hostfs
|
||||
`if [ ! -z $ELASTICSEARCH_USERNAME ]; then echo '-E output.elasticsearch.username=$ELASTICSEARCH_USERNAME'; fi`
|
||||
|
@ -180,6 +198,23 @@ services:
|
|||
- ./beats/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
|
||||
- /var/lib/docker:/var/lib/docker:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
entrypoint: >
|
||||
/bin/bash -c 'if [[ $${OPENVIDU_PRO_ELASTICSEARCH_HOST} =~ ^(https?://)?([^:/]+)(:([0-9]+))?(/.*)?$$ ]]; then
|
||||
ES_PROTO=$${BASH_REMATCH[1]}
|
||||
ES_HOST=$${BASH_REMATCH[2]}
|
||||
ES_PATH=$${BASH_REMATCH[5]}
|
||||
if [[ $$ES_PROTO == "https://" ]] && [[ -z $${BASH_REMATCH[4]} ]]; then
|
||||
ES_PORT=443
|
||||
else
|
||||
ES_PORT=80
|
||||
fi;
|
||||
OPENVIDU_PRO_ELASTICSEARCH_HOST=$${ES_PROTO}$${ES_HOST}:$${ES_PORT}$${ES_PATH}
|
||||
else
|
||||
echo "Invalid OPENVIDU_PRO_ELASTICSEARCH_HOST"
|
||||
echo "It must be a valid URL"
|
||||
exit 1
|
||||
fi;
|
||||
/bin/bash -c "$$@"'
|
||||
command: >
|
||||
/bin/bash -c "filebeat -e -strict.perms=false
|
||||
`if [ ! -z $ELASTICSEARCH_USERNAME ]; then echo '-E output.elasticsearch.username=$ELASTICSEARCH_USERNAME'; fi`
|
||||
|
|
|
@ -206,6 +206,47 @@ is_external_url() {
|
|||
fi
|
||||
}
|
||||
|
||||
is_elasticsearch_enabled() {
|
||||
local ELASTICSEARCH_ENABLED
|
||||
ELASTICSEARCH_ENABLED=$(grep -v '^#' .env | grep OPENVIDU_PRO_ELASTICSEARCH_ENABLED | cut -d '=' -f2)
|
||||
|
||||
# First check if empty
|
||||
if [[ -z "$ELASTICSEARCH_ENABLED" ]]; then
|
||||
# If empty, then elasticsearch is enabled
|
||||
return 0
|
||||
fi
|
||||
|
||||
# If not empty, then check if true
|
||||
if [[ "$ELASTICSEARCH_ENABLED" == "true" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_elasticsearch_secured() {
|
||||
local ELASTICSEARCH_USER
|
||||
local ELASTICSEARCH_PASSWORD
|
||||
ELASTICSEARCH_USER=$(grep -v '^#' .env | grep ELASTICSEARCH_USER | cut -d '=' -f2)
|
||||
ELASTICSEARCH_PASSWORD=$(grep -v '^#' .env | grep ELASTICSEARCH_PASSWORD | cut -d '=' -f2)
|
||||
|
||||
# First check if empty
|
||||
if [[ -z "$ELASTICSEARCH_USER" ]] || [[ -z "$ELASTICSEARCH_PASSWORD" ]]; then
|
||||
# If empty, then elasticsearch is not secured
|
||||
printf "ERROR: The elasticsearch user or password is empty."
|
||||
printf "\nVariables ELASTICSEARCH_USER and ELASTICSEARCH_PASSWORD in the .env file are mandatory"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check that password is greater than 6 characters
|
||||
if [[ ${#ELASTICSEARCH_PASSWORD} -lt 6 ]]; then
|
||||
printf "ERROR: Variable ELASTICSEARCH_PASSWORD in the .env file must be greater than 6 characters"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
start_openvidu() {
|
||||
local RUN_LOCAL_ES
|
||||
local RUN_LOCAL_KIBANA
|
||||
|
@ -216,22 +257,43 @@ start_openvidu() {
|
|||
COTURN_IN_MEDIA_NODES=$(grep -v '^#' .env | grep COTURN_IN_MEDIA_NODES | cut -d '=' -f2)
|
||||
RUN_LOCAL_ES=true
|
||||
RUN_LOCAL_KIBANA=true
|
||||
RUN_LOCAL_FILEBEAT=true
|
||||
RUN_LOCAL_METRICBEAT=true
|
||||
|
||||
# Default values
|
||||
if [[ -z "${COTURN_IN_MEDIA_NODES}" ]]; then
|
||||
COTURN_IN_MEDIA_NODES=false
|
||||
fi
|
||||
if is_external_url "${CONFIGURED_ELASTICSEARCH_HOST}"; then
|
||||
printf "Configured external elasticsearch: %s" "${CONFIGURED_ELASTICSEARCH_HOST}"
|
||||
printf "\n"
|
||||
|
||||
if is_elasticsearch_enabled; then
|
||||
RUN_LOCAL_ES=false
|
||||
fi
|
||||
if is_external_url "${CONFIGURED_KIBANA_HOST}"; then
|
||||
printf "Configured external kibana: %s" "${CONFIGURED_KIBANA_HOST}"
|
||||
printf "\n"
|
||||
RUN_LOCAL_KIBANA=false
|
||||
RUN_LOCAL_FILEBEAT=false
|
||||
RUN_LOCAL_METRICBEAT=false
|
||||
else
|
||||
# If elastic is not enabled, check credentials, and check if external elasticsearch is configured
|
||||
if ! is_elasticsearch_secured; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if is_external_url "${CONFIGURED_ELASTICSEARCH_HOST}"; then
|
||||
printf "Configured external elasticsearch: %s" "${CONFIGURED_ELASTICSEARCH_HOST}"
|
||||
printf "\n"
|
||||
RUN_LOCAL_ES=false
|
||||
fi
|
||||
if is_external_url "${CONFIGURED_KIBANA_HOST}"; then
|
||||
printf "Configured external kibana: %s" "${CONFIGURED_KIBANA_HOST}"
|
||||
printf "\n"
|
||||
RUN_LOCAL_KIBANA=false
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
docker-compose up -d \
|
||||
$(if [ "${RUN_LOCAL_ES}" == "false" ]; then echo '--scale elasticsearch=0'; fi) \
|
||||
$(if [ "${RUN_LOCAL_KIBANA}" == "false" ]; then echo '--scale kibana=0'; fi) \
|
||||
$(if [ "${RUN_LOCAL_FILEBEAT}" == "false" ]; then echo '--scale filebeat=0'; fi) \
|
||||
$(if [ "${RUN_LOCAL_METRICBEAT}" == "false" ]; then echo '--scale metricbeat=0'; fi) \
|
||||
$(if [ "${COTURN_IN_MEDIA_NODES}" == "true" ]; then echo '--scale coturn=0'; fi)
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,12 @@ if [[ -z "${COTURN_SHARED_SECRET_KEY}" ]]; then
|
|||
sed 's/\r$//' | awk '/=/ {print $1}')"
|
||||
fi
|
||||
|
||||
# Wait for kibana
|
||||
# Don't wait for Kibana if Elasticsearch is disabled
|
||||
if [ "${OPENVIDU_PRO_ELASTICSEARCH_ENABLED}" == "false" ]; then
|
||||
unset WAIT_KIBANA_URL
|
||||
fi
|
||||
|
||||
# Wait for Kibana service
|
||||
if [ -n "${WAIT_KIBANA_URL}" ]; then
|
||||
printf "\n"
|
||||
printf "\n ======================================="
|
||||
|
|
Loading…
Reference in New Issue