diff --git a/docs/admin-manual/setup/install.md b/docs/admin-manual/setup/install.md index 04844900f..12c0edc58 100644 --- a/docs/admin-manual/setup/install.md +++ b/docs/admin-manual/setup/install.md @@ -150,6 +150,12 @@ When upgrading be sure to run the installer using the same arguments you used du ::: +:::warning + +To update the LibreTime nginx configuration file, for example to change the `--listen-port`, make sure to add the `--update-nginx` flag to allow overwriting the existing configuration file. + +::: + If you need to change some configuration, the install script can be configured using flags or environment variables. Changing the listening port of LibreTime or whether you want to install some dependency by yourself, you could run the following: ```bash diff --git a/install b/install index 425995648..1a83de0a8 100755 --- a/install +++ b/install @@ -73,6 +73,8 @@ Options: --no-setup-postgresql Do not setup Postgresql. --no-setup-rabbitmq Do not setup RabbitMQ. + --update-nginx Update nginx files during upgrades. + Environment variables: Advanced options can be changed using environment variables (flags will take @@ -113,6 +115,9 @@ LIBRETIME_SETUP_POSTGRESQL=${LIBRETIME_SETUP_POSTGRESQL:-true} # > Create a default rabbitmq user with a random password. LIBRETIME_SETUP_RABBITMQ=${LIBRETIME_SETUP_RABBITMQ:-true} +# > Update nginx files during upgrades. +LIBRETIME_UPDATE_NGINX=${LIBRETIME_UPDATE_NGINX:-false} + # > Comma separated list of sections to exclude from packages list. LIBRETIME_PACKAGES_EXCLUDES=${LIBRETIME_PACKAGES_EXCLUDES:-} @@ -130,6 +135,10 @@ while [[ $# -gt 0 ]]; do LIBRETIME_INSTALL_IN_PLACE=true shift 1 ;; + --update-nginx) + LIBRETIME_UPDATE_NGINX=true + shift 1 + ;; --no-setup-icecast) LIBRETIME_SETUP_ICECAST=false shift 1 @@ -730,23 +739,35 @@ template_file cp_if_different \ section "Nginx" -install_packages nginx +if $is_first_install || $LIBRETIME_UPDATE_NGINX; then + install_packages nginx -info "disabling nginx default site" -rm -f "/etc/nginx/sites-enabled/default" + info "disabling nginx default site" + rm -f "/etc/nginx/sites-enabled/default" +fi -info "deploying libretime nginx config" -template_file cp_if_different \ - "${SCRIPT_DIR}/installer/nginx/libretime.conf" \ - "/etc/nginx/sites-available/libretime.conf" \ - sed \ - -e "s|@@LISTEN_PORT@@|${LIBRETIME_LISTEN_PORT}|g" \ +nginx_config_template_args=( + "${SCRIPT_DIR}/installer/nginx/libretime.conf" + "/etc/nginx/sites-available/libretime.conf" + sed + -e "s|@@LISTEN_PORT@@|${LIBRETIME_LISTEN_PORT}|g" -e "s|@@LEGACY_WEB_ROOT@@|${LEGACY_WEB_ROOT}|g" +) -info "enabling libretime nginx config" -ln -s --force \ - "/etc/nginx/sites-available/libretime.conf" \ - "/etc/nginx/sites-enabled/libretime.conf" +if $is_first_install || $LIBRETIME_UPDATE_NGINX; then + info "deploying libretime nginx config" + template_file cp_if_different "${nginx_config_template_args[@]}" +else + info "printing libretime nginx config differences" + template_file diff_if_exists "${nginx_config_template_args[@]}" +fi + +if $is_first_install || $LIBRETIME_UPDATE_NGINX; then + info "enabling libretime nginx config" + ln -s --force \ + "/etc/nginx/sites-available/libretime.conf" \ + "/etc/nginx/sites-enabled/libretime.conf" +fi # Finalize ########################################################################################