mirror of https://github.com/OpenVidu/openvidu.git
deployment: Add volume to configure custom locations in nginx. This is useful to add reverse proxy or other services to the nginx configuration to default HTTPS_PORT configured
parent
197ddc8ce8
commit
110878f4c9
|
@ -103,6 +103,7 @@ services:
|
|||
- ./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
|
||||
environment:
|
||||
- DOMAIN_OR_PUBLIC_IP=${DOMAIN_OR_PUBLIC_IP}
|
||||
|
|
|
@ -60,6 +60,10 @@ new_ov_installation() {
|
|||
printf "\n => Creating folder 'custom-nginx-vhosts'..."
|
||||
mkdir "${OPENVIDU_FOLDER}/custom-nginx-vhosts" || fatal_error "Error while creating the folder 'custom-nginx-vhosts'"
|
||||
|
||||
# Create vhost nginx folder
|
||||
printf "\n => Creating folder 'custom-nginx-locations'..."
|
||||
mkdir "${OPENVIDU_FOLDER}/custom-nginx-locations" || fatal_error "Error while creating the folder 'custom-nginx-locations'"
|
||||
|
||||
# Ready to use
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
|
@ -200,6 +204,11 @@ upgrade_ov() {
|
|||
printf '\n - custom-nginx-vhosts'
|
||||
fi
|
||||
|
||||
if [ -d "${OPENVIDU_PREVIOUS_FOLDER}/custom-nginx-locations" ]; then
|
||||
mv "${OPENVIDU_PREVIOUS_FOLDER}/custom-nginx-locations" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous directory 'custom-nginx-locations'"
|
||||
printf '\n - custom-nginx-locations'
|
||||
fi
|
||||
|
||||
# Move tmp files to Openvidu
|
||||
printf '\n => Updating files:'
|
||||
|
||||
|
|
|
@ -109,6 +109,10 @@ new_ov_installation() {
|
|||
printf "\n => Creating folder 'custom-nginx-vhosts'..."
|
||||
mkdir "${OPENVIDU_FOLDER}/custom-nginx-vhosts" || fatal_error "Error while creating the folder 'custom-nginx-vhosts'"
|
||||
|
||||
# Create vhost nginx folder
|
||||
printf "\n => Creating folder 'custom-nginx-locations'..."
|
||||
mkdir "${OPENVIDU_FOLDER}/custom-nginx-locations" || fatal_error "Error while creating the folder 'custom-nginx-locations'"
|
||||
|
||||
# Ready to use
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
|
@ -291,6 +295,11 @@ upgrade_ov() {
|
|||
printf '\n - custom-nginx-vhosts'
|
||||
fi
|
||||
|
||||
if [ -d "${OPENVIDU_PREVIOUS_FOLDER}/custom-nginx-locations" ]; then
|
||||
mv "${OPENVIDU_PREVIOUS_FOLDER}/custom-nginx-locations" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous directory 'custom-nginx-locations'"
|
||||
printf '\n - custom-nginx-locations'
|
||||
fi
|
||||
|
||||
# Move tmp files to Openvidu
|
||||
printf '\n => Updating files:'
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ services:
|
|||
- ./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
|
||||
environment:
|
||||
- DOMAIN_OR_PUBLIC_IP=${DOMAIN_OR_PUBLIC_IP}
|
||||
|
|
|
@ -109,6 +109,10 @@ new_ov_installation() {
|
|||
printf "\n => Creating folder 'custom-nginx-vhosts'..."
|
||||
mkdir "${OPENVIDU_FOLDER}/custom-nginx-vhosts" || fatal_error "Error while creating the folder 'custom-nginx-vhosts'"
|
||||
|
||||
# Create vhost nginx folder
|
||||
printf "\n => Creating folder 'custom-nginx-locations'..."
|
||||
mkdir "${OPENVIDU_FOLDER}/custom-nginx-locations" || fatal_error "Error while creating the folder 'custom-nginx-locations'"
|
||||
|
||||
# Ready to use
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
|
@ -291,6 +295,11 @@ upgrade_ov() {
|
|||
printf '\n - custom-nginx-vhosts'
|
||||
fi
|
||||
|
||||
if [ -d "${OPENVIDU_PREVIOUS_FOLDER}/custom-nginx-locations" ]; then
|
||||
mv "${OPENVIDU_PREVIOUS_FOLDER}/custom-nginx-locations" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous directory 'custom-nginx-locations'"
|
||||
printf '\n - custom-nginx-locations'
|
||||
fi
|
||||
|
||||
# Move tmp files to Openvidu
|
||||
printf '\n => Updating files:'
|
||||
|
||||
|
|
|
@ -55,4 +55,6 @@ server {
|
|||
root /var/www/certbot;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
{custom_locations}
|
||||
}
|
||||
|
|
|
@ -80,4 +80,6 @@ server {
|
|||
root /var/www/certbot;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
{custom_locations}
|
||||
}
|
||||
|
|
|
@ -262,6 +262,27 @@ sed -e '/{ssl_config}/{r default_nginx_conf/global/ssl_config.conf' -e 'd}' -i /
|
|||
sed -e '/{proxy_config}/{r default_nginx_conf/global/proxy_config.conf' -e 'd}' -i /etc/nginx/conf.d/*
|
||||
sed -i "s/{domain_name}/${DOMAIN_OR_PUBLIC_IP}/g" /etc/nginx/conf.d/*
|
||||
|
||||
# Read custom locations and apply them in configuration
|
||||
if [[ -d /custom-nginx-locations ]]; then
|
||||
TMP_PARSED_CUSTOM_LOCATIONS="$(mktemp)"
|
||||
{
|
||||
for CUSTOM_LOCATION in /custom-nginx-locations/*.conf; do
|
||||
[ -f "${CUSTOM_LOCATION}" ] || break
|
||||
echo " # Custom location loaded from: ${CUSTOM_LOCATION}"
|
||||
while read -r ; do
|
||||
echo " ${REPLY}"
|
||||
done < "${CUSTOM_LOCATION}"
|
||||
echo
|
||||
done
|
||||
} > "${TMP_PARSED_CUSTOM_LOCATIONS}"
|
||||
if [[ -n $(cat "${TMP_PARSED_CUSTOM_LOCATIONS}") ]]; then
|
||||
sed -e "/{custom_locations}/{r ${TMP_PARSED_CUSTOM_LOCATIONS}" -e 'd}' -i /etc/nginx/conf.d/*
|
||||
fi
|
||||
rm "${TMP_PARSED_CUSTOM_LOCATIONS}"
|
||||
fi
|
||||
# Delete custom_locations if not replaced
|
||||
sed -i '/{custom_locations}/d' /etc/nginx/conf.d/*
|
||||
|
||||
# IPv6 listening (RFC 6540)
|
||||
if [ ! -f /proc/net/if_inet6 ]; then
|
||||
sed -i '/\[::\]:{http_port}/d' /etc/nginx/conf.d/*
|
||||
|
|
Loading…
Reference in New Issue