diff --git a/build/install/OneClickInstall/install-Debian/install-app.sh b/build/install/OneClickInstall/install-Debian/install-app.sh index aebbc68b50..9e88d16ad9 100644 --- a/build/install/OneClickInstall/install-Debian/install-app.sh +++ b/build/install/OneClickInstall/install-Debian/install-app.sh @@ -31,7 +31,6 @@ if [ "$UPDATE" = "true" ] && [ "$DOCUMENT_SERVER_INSTALLED" = "true" ]; then RECONFIGURE_PRODUCT="true" else - systemctl list-units --type=service | grep -q openresty && systemctl stop openresty apt-get install -y --only-upgrade ${ds_pkg_name}; fi fi @@ -61,8 +60,6 @@ if [ "$DOCUMENT_SERVER_INSTALLED" = "false" ]; then echo ${package_sysname}-documentserver $DS_COMMON_NAME/jwt-enabled select ${DS_JWT_ENABLED} | sudo debconf-set-selections echo ${package_sysname}-documentserver $DS_COMMON_NAME/jwt-secret select ${DS_JWT_SECRET} | sudo debconf-set-selections echo ${package_sysname}-documentserver $DS_COMMON_NAME/jwt-header select ${DS_JWT_HEADER} | sudo debconf-set-selections - - systemctl list-units --type=service | grep -q openresty && systemctl stop openresty if [ "$INSTALLATION_TYPE" = "COMMUNITY" ]; then apt-get install -yq ${package_sysname}-documentserver diff --git a/build/install/OneClickInstall/install-Debian/install-preq.sh b/build/install/OneClickInstall/install-Debian/install-preq.sh index af1631fd6a..21f8af149d 100644 --- a/build/install/OneClickInstall/install-Debian/install-preq.sh +++ b/build/install/OneClickInstall/install-Debian/install-preq.sh @@ -99,13 +99,19 @@ if [ "$DIST" = "ubuntu" ]; then chmod 644 /usr/share/keyrings/redis.gpg fi +#add nginx repo +curl -s http://nginx.org/keys/nginx_signing.key | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/nginx.gpg --import +echo "deb [signed-by=/usr/share/keyrings/nginx.gpg] http://nginx.org/packages/$DIST/ $DISTRIB_CODENAME nginx" | tee /etc/apt/sources.list.d/nginx.list +chmod 644 /usr/share/keyrings/nginx.gpg +#Temporary fix for missing nginx repository for debian bookworm +[ "$DISTRIB_CODENAME" = "bookworm" ] && sed -i "s/$DISTRIB_CODENAME/buster/g" /etc/apt/sources.list.d/nginx.list + #add openresty repo curl -fsSL https://openresty.org/package/pubkey.gpg | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/openresty.gpg --import echo "deb [signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/$DIST $DISTRIB_CODENAME $([ "$DIST" = "ubuntu" ] && echo "main" || echo "openresty" )" | tee /etc/apt/sources.list.d/openresty.list chmod 644 /usr/share/keyrings/openresty.gpg #Temporary fix for missing openresty repository for debian bookworm [ "$DISTRIB_CODENAME" = "bookworm" ] && sed -i "s/$DISTRIB_CODENAME/bullseye/g" /etc/apt/sources.list.d/openresty.list -systemctl list-units --type=service | grep -q nginx && systemctl stop nginx && systemctl disable nginx # setup msttcorefonts echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections @@ -124,7 +130,6 @@ apt-get install -o DPkg::options::="--force-confnew" -yq \ postgresql \ redis-server \ rabbitmq-server \ - openresty \ ffmpeg if ! dpkg -l | grep -q "elasticsearch"; then diff --git a/build/install/OneClickInstall/install-RedHat/install-app.sh b/build/install/OneClickInstall/install-RedHat/install-app.sh index 0950bd6bd9..1f59f43b18 100644 --- a/build/install/OneClickInstall/install-RedHat/install-app.sh +++ b/build/install/OneClickInstall/install-RedHat/install-app.sh @@ -36,7 +36,6 @@ if [ "$UPDATE" = "true" ] && [ "$DOCUMENT_SERVER_INSTALLED" = "true" ]; then DOCUMENT_SERVER_INSTALLED="false" RECONFIGURE_PRODUCT="true" else - systemctl list-units --type=service | grep -q openresty && systemctl stop openresty ${package_manager} -y update ${ds_pkg_name} fi fi @@ -100,8 +99,6 @@ if [ "$DOCUMENT_SERVER_INSTALLED" = "false" ]; then su - postgres -s /bin/bash -c "psql -c \"CREATE USER ${DS_DB_USER} WITH password '${DS_DB_PWD}';\"" su - postgres -s /bin/bash -c "psql -c \"CREATE DATABASE ${DS_DB_NAME} OWNER ${DS_DB_USER};\"" fi - - systemctl list-units --type=service | grep -q openresty && systemctl stop openresty if [ "$INSTALLATION_TYPE" = "COMMUNITY" ]; then ${package_manager} -y install ${package_sysname}-documentserver diff --git a/build/install/OneClickInstall/install-RedHat/install-preq.sh b/build/install/OneClickInstall/install-RedHat/install-preq.sh index bdb2c410cc..48abcc619f 100644 --- a/build/install/OneClickInstall/install-RedHat/install-preq.sh +++ b/build/install/OneClickInstall/install-RedHat/install-preq.sh @@ -92,10 +92,20 @@ autorefresh=1 type=rpm-md END +# add nginx repo +cat > /etc/yum.repos.d/nginx.repo </dev/null 2>&1 systemctl restart openresty echo "OK" @@ -583,7 +578,7 @@ setup_docs() { fi #Changing the Docs port in nginx conf - sed "0,/proxy_pass .*;/{s#proxy_pass .*;#proxy_pass ${DOCUMENT_SERVER_URL_EXTERNAL:-http://$APP_HOST:$DOCUMENT_SERVER_PORT};#}" -i ${NGINX_DIR}/conf.d/${PACKAGE_SYSNAME}.conf + sed "0,/proxy_pass .*;/{s#proxy_pass .*;#proxy_pass ${DOCUMENT_SERVER_URL_EXTERNAL:-http://$APP_HOST:$DOCUMENT_SERVER_PORT};#}" -i ${OPENRESTY_DIR}/conf.d/${PACKAGE_SYSNAME}.conf #Save Docs address and JWT in .json save_undefined_param "${USER_CONF}" "files.docservice.secret.value" "${DOCUMENT_SERVER_JWT_SECRET}" "$EXTERNAL_DOCS_FLAG" @@ -685,8 +680,8 @@ setup_redis() { $JSON $APP_DIR/redis.$ENVIRONMENT.json -e "this.Redis={'Hosts': [ { Host: \"${REDIS_HOST}\", Port: \"${REDIS_PORT}\" } ] }" >/dev/null 2>&1 - sed -i "s~\(redis_host =\).*~\1 \"$REDIS_HOST\"~" "${NGINX_DIR}/conf.d/${PACKAGE_SYSNAME}.conf" - sed -i "s~\(redis_port =\).*~\1 $REDIS_PORT~" "${NGINX_DIR}/conf.d/${PACKAGE_SYSNAME}.conf" + sed -i "s~\(redis_host =\).*~\1 \"$REDIS_HOST\"~" "${OPENRESTY_DIR}/conf.d/${PACKAGE_SYSNAME}.conf" + sed -i "s~\(redis_port =\).*~\1 $REDIS_PORT~" "${OPENRESTY_DIR}/conf.d/${PACKAGE_SYSNAME}.conf" if [ $1 == "LOCAL_REDIS_SERVER" ]; then if [ -f "/etc/redis/redis.conf" ]; then @@ -778,7 +773,7 @@ fi if [[ ! -z $DOCUMENT_SERVER_URL_EXTERNAL ]]; then parse_external_docs_url "$DOCUMENT_SERVER_URL_EXTERNAL" - check_connection_external_services "$DOCUMENT_SERVER_HOST" "$DOCUMENT_SERVER_PORT" "ONLYOFFICE Docs" + check_connection_external_services "$DOCUMENT_SERVER_HOST" "$DOCUMENT_SERVER_PORT" "${PACKAGE_SYSNAME^^} Docs" setup_docs "EXTERNAL_DOCS_SERVER" elif $PACKAGE_MANAGER ${PACKAGE_SYSNAME}-documentserver >/dev/null 2>&1 || $PACKAGE_MANAGER ${PACKAGE_SYSNAME}-documentserver-de >/dev/null 2>&1 || $PACKAGE_MANAGER ${PACKAGE_SYSNAME}-documentserver-ee >/dev/null 2>&1; then setup_docs "LOCAL_DOCS_SERVER" diff --git a/build/install/common/product-ssl-setup b/build/install/common/product-ssl-setup index 2d97d8d587..9e351324e1 100644 --- a/build/install/common/product-ssl-setup +++ b/build/install/common/product-ssl-setup @@ -5,7 +5,7 @@ set -e PRODUCT="docspace" DIR="/usr/bin" LETSENCRYPT="/etc/letsencrypt/live"; -NGINX="/etc/nginx/conf.d" +OPENRESTY="/etc/openresty/conf.d" DHPARAM_FILE="/etc/ssl/certs/dhparam.pem" WEBROOT_PATH="/var/www/${PRODUCT}" @@ -43,14 +43,14 @@ if [ "$#" -ge "2" ]; then PRIVATEKEY_FILE="${PRIVATEKEY_FILE:-"${LETSENCRYPT}/${PRODUCT}/privkey.pem"}" if [ -f "${CERTIFICATE_FILE}" -a -f ${PRIVATEKEY_FILE} ]; then - if [ -f "${NGINX}/onlyoffice-proxy-ssl.conf.template" ]; then - cp -f ${NGINX}/onlyoffice-proxy-ssl.conf.template ${NGINX}/onlyoffice-proxy.conf + if [ -f "${OPENRESTY}/onlyoffice-proxy-ssl.conf.template" ]; then + cp -f ${OPENRESTY}/onlyoffice-proxy-ssl.conf.template ${OPENRESTY}/onlyoffice-proxy.conf ENVIRONMENT=$(grep -oP 'ENVIRONMENT=\K.*' /usr/lib/systemd/system/${PRODUCT}-api.service) sed -i "s/\(\"portal\":\).*/\1 \"https:\/\/${DOMAIN:-$(hostname --fqdn)}\"/" /etc/onlyoffice/docspace/appsettings.$ENVIRONMENT.json - sed -i "s~\(ssl_certificate \).*;~\1${CERTIFICATE_FILE};~g" ${NGINX}/onlyoffice-proxy.conf - sed -i "s~\(ssl_certificate_key \).*;~\1${PRIVATEKEY_FILE};~g" ${NGINX}/onlyoffice-proxy.conf - sed -i "s~\(ssl_dhparam \).*;~\1${DHPARAM_FILE};~g" ${NGINX}/onlyoffice-proxy.conf + sed -i "s~\(ssl_certificate \).*;~\1${CERTIFICATE_FILE};~g" ${OPENRESTY}/onlyoffice-proxy.conf + sed -i "s~\(ssl_certificate_key \).*;~\1${PRIVATEKEY_FILE};~g" ${OPENRESTY}/onlyoffice-proxy.conf + sed -i "s~\(ssl_dhparam \).*;~\1${DHPARAM_FILE};~g" ${OPENRESTY}/onlyoffice-proxy.conf if [[ "${LETSENCRYPT_ENABLE}" = "true" ]]; then # Create and set permissions for ${PRODUCT}-renew-letsencrypt diff --git a/build/install/deb/debian/product-proxy.install b/build/install/deb/debian/product-proxy.install index 3e8885d7d6..56a018e637 100644 --- a/build/install/deb/debian/product-proxy.install +++ b/build/install/deb/debian/product-proxy.install @@ -1,9 +1,9 @@ ## COPY PUBLIC ## ../../../build/install/common/{{product}}-ssl-setup usr/bin -../../../build/install/docker/config/nginx/templates/*.template etc/onlyoffice/{{product}}/nginx -../../../build/install/docker/config/nginx/onlyoffice* etc/nginx/conf.d -../../../config/nginx/onlyoffice*.conf etc/nginx/conf.d -../../../build/install/docker/config/nginx/letsencrypt* etc/nginx/includes -../../../config/nginx/includes/onlyoffice*.conf etc/nginx/includes +../../../build/install/docker/config/nginx/templates/*.template etc/onlyoffice/{{product}}/openresty +../../../build/install/docker/config/nginx/onlyoffice* etc/openresty/conf.d +../../../config/nginx/onlyoffice*.conf etc/openresty/conf.d +../../../build/install/docker/config/nginx/letsencrypt* etc/openresty/includes +../../../config/nginx/includes/onlyoffice*.conf etc/openresty/includes ../../../build/deploy/public/* var/www/{{product}}/public ../../../build/deploy/client/* var/www/{{product}}/client diff --git a/build/install/deb/debian/rules b/build/install/deb/debian/rules index 205c7efef3..4c60f3167b 100755 --- a/build/install/deb/debian/rules +++ b/build/install/deb/debian/rules @@ -49,10 +49,11 @@ override_dh_auto_build: json -I -f ${SRC_PATH}/config/apisystem.json -e "this.core.notify.postman=\"services\"" sed 's_\(minlevel=\)".*"_\1"Warn"_g' -i ${SRC_PATH}/config/nlog.config + sed 's_etc/nginx_etc/openresty_g' -i ${SRC_PATH}/config/nginx/*.conf sed 's/teamlab.info/onlyoffice.com/g' -i ${SRC_PATH}/config/autofac.consumers.json - sed -e 's/$$router_host/127.0.0.1/g' -e '/proxy_set_header/d' -e 's|includes|/etc/nginx/includes|g' -i ${SRC_PATH}/build/install/docker/config/nginx/onlyoffice-proxy*.conf + sed -e 's/$$router_host/127.0.0.1/g' -e 's/the_host/host/g' -e 's/the_scheme/scheme/g' -e 's_includes_/etc/openresty/includes_g' -i ${SRC_PATH}/build/install/docker/config/nginx/onlyoffice-proxy*.conf sed "s_\(.*root\).*;_\1 \"/var/www/${PRODUCT}\";_g" -i ${SRC_PATH}/build/install/docker/config/nginx/letsencrypt.conf - sed -e '/.pid/d' -e '/temp_path/d' -i ${SRC_PATH}/build/install/docker/config/nginx/templates/nginx.conf.template + sed -e '/.pid/d' -e '/temp_path/d' -e 's_etc/nginx_etc/openresty_g' -i ${SRC_PATH}/build/install/docker/config/nginx/templates/nginx.conf.template mv -f ${SRC_PATH}/build/install/docker/config/nginx/onlyoffice-proxy-ssl.conf ${SRC_PATH}/build/install/docker/config/nginx/onlyoffice-proxy-ssl.conf.template for i in ${PRODUCT} $$(ls ${CURRENT_PATH}/debian/*.install | grep -oP 'debian/\K.*' | grep -o '^[^.]*'); do \ diff --git a/build/install/rpm/SPECS/build.spec b/build/install/rpm/SPECS/build.spec index f37cee33c3..61f08b551c 100644 --- a/build/install/rpm/SPECS/build.spec +++ b/build/install/rpm/SPECS/build.spec @@ -20,9 +20,10 @@ json -I -f %{_builddir}/%{sourcename}/config/appsettings.json -e "this.core.noti json -I -f %{_builddir}/%{sourcename}/config/apisystem.json -e "this.core.notify.postman=\"services\"" sed 's_\(minlevel=\)".*"_\1"Warn"_g' -i %{_builddir}/%{sourcename}/config/nlog.config +sed 's_etc/nginx_etc/openresty_g' -i %{_builddir}/%{sourcename}/config/nginx/*.conf sed 's/teamlab.info/onlyoffice.com/g' -i %{_builddir}/%{sourcename}/config/autofac.consumers.json -sed -e 's/$router_host/127.0.0.1/g' -e '/proxy_set_header/d' -e 's|includes|/etc/nginx/includes|g' -i %{_builddir}/%{sourcename}/build/install/docker/config/nginx/onlyoffice-proxy*.conf -sed -e '/.pid/d' -e '/temp_path/d' -i %{_builddir}/%{sourcename}/build/install/docker/config/nginx/templates/nginx.conf.template +sed -e 's/$router_host/127.0.0.1/g' -e 's/the_host/host/g' -e 's/the_scheme/scheme/g' -e 's_includes_/etc/openresty/includes_g' -i %{_builddir}/%{sourcename}/build/install/docker/config/nginx/onlyoffice-proxy*.conf +sed -e '/.pid/d' -e '/temp_path/d' -e 's_etc/nginx_etc/openresty_g' -i %{_builddir}/%{sourcename}/build/install/docker/config/nginx/templates/nginx.conf.template sed -i "s_\(.*root\).*;_\1 \"/var/www/%{product}\";_g" -i %{_builddir}/%{sourcename}/build/install/docker/config/nginx/letsencrypt.conf find %{_builddir}/%{sourcename}/publish/ \ diff --git a/build/install/rpm/SPECS/files.spec b/build/install/rpm/SPECS/files.spec index 20180709e5..4febd6be6c 100644 --- a/build/install/rpm/SPECS/files.spec +++ b/build/install/rpm/SPECS/files.spec @@ -31,7 +31,7 @@ %files common %defattr(-, onlyoffice, onlyoffice, -) %config %attr(640, onlyoffice, onlyoffice) %{_sysconfdir}/onlyoffice/%{product}/* -%exclude %{_sysconfdir}/onlyoffice/%{product}/nginx +%exclude %{_sysconfdir}/onlyoffice/%{product}/openresty %{_docdir}/%{name}-%{version}-%{release}/ %config %{_sysconfdir}/logrotate.d/%{product}-common %{_var}/log/onlyoffice/%{product}/ @@ -73,13 +73,13 @@ %files proxy %defattr(-, onlyoffice, onlyoffice, -) -%config %{_sysconfdir}/nginx/includes/* -%config %{_sysconfdir}/nginx/conf.d/* +%config %{_sysconfdir}/openresty/includes/* +%config %{_sysconfdir}/openresty/conf.d/* %attr(744, root, root) %{_bindir}/%{product}-ssl-setup -%config %{_sysconfdir}/onlyoffice/%{product}/nginx/nginx.conf.template +%config %{_sysconfdir}/onlyoffice/%{product}/openresty/nginx.conf.template %dir %{_sysconfdir}/onlyoffice/ %dir %{_sysconfdir}/onlyoffice/%{product}/ -%dir %{_sysconfdir}/onlyoffice/%{product}/nginx/ +%dir %{_sysconfdir}/onlyoffice/%{product}/openresty/ %{buildpath}/public/ %{buildpath}/client/ diff --git a/build/install/rpm/SPECS/install.spec b/build/install/rpm/SPECS/install.spec index 2ea3d5f577..a1814513c6 100644 --- a/build/install/rpm/SPECS/install.spec +++ b/build/install/rpm/SPECS/install.spec @@ -3,9 +3,10 @@ rm -rf %{buildroot} mkdir -p "%{buildroot}%{_bindir}/" mkdir -p "%{buildroot}%{_docdir}/%{name}-%{version}-%{release}/" mkdir -p "%{buildroot}%{_sysconfdir}/logrotate.d" -mkdir -p "%{buildroot}%{_sysconfdir}/nginx/conf.d/" -mkdir -p "%{buildroot}%{_sysconfdir}/nginx/includes/" +mkdir -p "%{buildroot}%{_sysconfdir}/openresty/conf.d/" +mkdir -p "%{buildroot}%{_sysconfdir}/openresty/includes/" mkdir -p "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/.private/" +mkdir -p "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/openresty" mkdir -p "%{buildroot}%{_var}/log/onlyoffice/%{product}/" mkdir -p "%{buildroot}%{buildpath}/Tools/radicale/plugins/" mkdir -p "%{buildroot}%{buildpath}/products/ASC.Files/client/" @@ -43,8 +44,8 @@ cp -rf %{_builddir}/%{sourcename}/build/install/common/%{product}-configuration cp -rf %{_builddir}/%{sourcename}/build/install/common/systemd/modules/* "%{buildroot}/usr/lib/systemd/system/" cp -rf %{_builddir}/%{sourcename}/build/install/common/logrotate/product-common "%{buildroot}%{_sysconfdir}/logrotate.d/%{product}-common" cp -rf %{_builddir}/%{sourcename}/config/* "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/" -cp -rf %{_builddir}/%{sourcename}/config/nginx/includes/onlyoffice*.conf "%{buildroot}%{_sysconfdir}/nginx/includes/" -cp -rf %{_builddir}/%{sourcename}/config/nginx/onlyoffice*.conf "%{buildroot}%{_sysconfdir}/nginx/conf.d/" +cp -rf %{_builddir}/%{sourcename}/config/nginx/includes/onlyoffice*.conf "%{buildroot}%{_sysconfdir}/openresty/includes/" +cp -rf %{_builddir}/%{sourcename}/config/nginx/onlyoffice*.conf "%{buildroot}%{_sysconfdir}/openresty/conf.d/" cp -rf %{_builddir}/%{sourcename}/products/ASC.Files/Server/DocStore/* "%{buildroot}%{buildpath}/products/ASC.Files/server/DocStore/" cp -rf %{_builddir}/%{sourcename}/publish/products/ASC.Files/server/* "%{buildroot}%{buildpath}/products/ASC.Files/server/" cp -rf %{_builddir}/%{sourcename}/publish/products/ASC.People/server/* "%{buildroot}%{buildpath}/products/ASC.People/server/" @@ -60,8 +61,8 @@ cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Studio.Notify/service/* " cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Web.Api/service/* "%{buildroot}%{buildpath}/studio/ASC.Web.Api/" cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Web.HealthChecks.UI/service/* "%{buildroot}%{buildpath}/services/ASC.Web.HealthChecks.UI/" cp -rf %{_builddir}/%{sourcename}/publish/services/ASC.Web.Studio/service/* "%{buildroot}%{buildpath}/studio/ASC.Web.Studio/" -cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/nginx/onlyoffice-proxy.conf "%{buildroot}%{_sysconfdir}/nginx/conf.d/onlyoffice-proxy.conf" -cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/nginx/onlyoffice-proxy-ssl.conf "%{buildroot}%{_sysconfdir}/nginx/conf.d/onlyoffice-proxy-ssl.conf.template" -cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/nginx/letsencrypt.conf "%{buildroot}%{_sysconfdir}/nginx/includes/letsencrypt.conf" -cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/nginx/templates/nginx.conf.template "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/nginx/nginx.conf.template" +cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/nginx/onlyoffice-proxy.conf "%{buildroot}%{_sysconfdir}/openresty/conf.d/onlyoffice-proxy.conf" +cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/nginx/onlyoffice-proxy-ssl.conf "%{buildroot}%{_sysconfdir}/openresty/conf.d/onlyoffice-proxy-ssl.conf.template" +cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/nginx/letsencrypt.conf "%{buildroot}%{_sysconfdir}/openresty/includes/letsencrypt.conf" +cp -rf %{_builddir}/%{sourcename}/build/install/docker/config/nginx/templates/nginx.conf.template "%{buildroot}%{_sysconfdir}/onlyoffice/%{product}/openresty/nginx.conf.template" cp -rf %{_builddir}/%{sourcename}/build/install/common/%{product}-ssl-setup "%{buildroot}%{_bindir}/%{product}-ssl-setup"