From 4cdb7d05d3a25c1335a0a8ab4d2237bc5e698278 Mon Sep 17 00:00:00 2001 From: Evgeniy Antonyuk Date: Tue, 29 Aug 2023 14:27:48 +0500 Subject: [PATCH 1/4] Fix redis value substitution for mail service --- run-community-server.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/run-community-server.sh b/run-community-server.sh index e832c9c..fa36c2e 100644 --- a/run-community-server.sh +++ b/run-community-server.sh @@ -497,6 +497,10 @@ if [ ${REDIS_SERVER_HOST} ]; then sed 's///' -i ${APP_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.config sed -E 's///' -i ${APP_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.config + sed -e "s/\"Host\": \"[^\"]*\"/\"Host\": \"${REDIS_SERVER_HOST}\"/" -e "s/\"Port\": \"[^\"]*\"/\"Port\": \"${REDIS_SERVER_CACHEPORT}\"/" -e "s/\"Ssl\": [^,]*,/\"Ssl\": ${REDIS_SERVER_SSL},/" -e "s/\"Database\": [^,]*,/\"Database\": ${REDIS_SERVER_DATABASE},/" -e "s/\"ConnectTimeout\": [^,]*,/\"ConnectTimeout\": ${REDIS_SERVER_CONNECT_TIMEOUT},/" -e "s/\"SyncTimeout\": [^,]*,/\"SyncTimeout\": ${REDIS_SERVER_SYNC_TIMEOUT},/" -i ${APP_CONFIG_DIR}/mail.json + + [ -n "$REDIS_SERVER_PASSWORD" ] && sed "/\"Port\": \"${REDIS_SERVER_CACHEPORT}\"/a \ \"Password\": \"${REDIS_SERVER_PASSWORD}\"," -i "${APP_CONFIG_DIR}/mail.json" + APP_SERVICES_SOCKET_IO_PATH=${APP_SERVICES_DIR}/ASC.Socket.IO/config/config.json; jq '.redis |= . + {"host":"'${REDIS_SERVER_HOST}'","port":'${REDIS_SERVER_CACHEPORT}',"db":'${REDIS_SERVER_DATABASE}',"pass":"'${REDIS_SERVER_PASSWORD}'"}'\ From 415e0739bca7af702e1e63801808a5a526defc6d Mon Sep 17 00:00:00 2001 From: Evgeniy Antonyuk Date: Fri, 1 Sep 2023 12:39:09 +0500 Subject: [PATCH 2/4] Fix issue #199 - Fix redis value substitution --- run-community-server.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/run-community-server.sh b/run-community-server.sh index fa36c2e..3053309 100644 --- a/run-community-server.sh +++ b/run-community-server.sh @@ -497,14 +497,13 @@ if [ ${REDIS_SERVER_HOST} ]; then sed 's///' -i ${APP_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.config sed -E 's///' -i ${APP_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.config - sed -e "s/\"Host\": \"[^\"]*\"/\"Host\": \"${REDIS_SERVER_HOST}\"/" -e "s/\"Port\": \"[^\"]*\"/\"Port\": \"${REDIS_SERVER_CACHEPORT}\"/" -e "s/\"Ssl\": [^,]*,/\"Ssl\": ${REDIS_SERVER_SSL},/" -e "s/\"Database\": [^,]*,/\"Database\": ${REDIS_SERVER_DATABASE},/" -e "s/\"ConnectTimeout\": [^,]*,/\"ConnectTimeout\": ${REDIS_SERVER_CONNECT_TIMEOUT},/" -e "s/\"SyncTimeout\": [^,]*,/\"SyncTimeout\": ${REDIS_SERVER_SYNC_TIMEOUT},/" -i ${APP_CONFIG_DIR}/mail.json - - [ -n "$REDIS_SERVER_PASSWORD" ] && sed "/\"Port\": \"${REDIS_SERVER_CACHEPORT}\"/a \ \"Password\": \"${REDIS_SERVER_PASSWORD}\"," -i "${APP_CONFIG_DIR}/mail.json" + sed -e "s/\"Host\": \"[^\"]*\"/\"Host\": \"${REDIS_SERVER_HOST}\"/" -e "s/\"Port\": \"[^\"]*\"/\"Port\": \"${REDIS_SERVER_CACHEPORT}\"/" -e "s/\"Ssl\": [^,]*,/\"Ssl\": ${REDIS_SERVER_SSL},/" -e "s/\"Database\": [^,]*,/\"Database\": ${REDIS_SERVER_DATABASE},/" -e "s/\"ConnectTimeout\": [^,]*,/\"ConnectTimeout\": ${REDIS_SERVER_CONNECT_TIMEOUT},/" -e "s/\"SyncTimeout\": [^,]*,/\"SyncTimeout\": ${REDIS_SERVER_SYNC_TIMEOUT},/" -i ${APP_CONFIG_DIR}/mail.json + + [ -n "$REDIS_SERVER_PASSWORD" ] && sed "/\"Port\": \"${REDIS_SERVER_CACHEPORT}\"/a \ \"Password\": \"${REDIS_SERVER_PASSWORD}\"," -i "${APP_CONFIG_DIR}/mail.json" - APP_SERVICES_SOCKET_IO_PATH=${APP_SERVICES_DIR}/ASC.Socket.IO/config/config.json; + APP_SERVICES_SOCKET_IO_PATH=${APP_SERVICES_DIR}/ASC.Socket.IO/config/config.UNIX.SERVER.json - jq '.redis |= . + {"host":"'${REDIS_SERVER_HOST}'","port":'${REDIS_SERVER_CACHEPORT}',"db":'${REDIS_SERVER_DATABASE}',"pass":"'${REDIS_SERVER_PASSWORD}'"}'\ - ${APP_SERVICES_SOCKET_IO_PATH} > ${APP_SERVICES_SOCKET_IO_PATH}.tmp && mv ${APP_SERVICES_SOCKET_IO_PATH}.tmp ${APP_SERVICES_SOCKET_IO_PATH} + jq '.redis |= . + {"host":"'"$REDIS_SERVER_HOST"'","port":'"$REDIS_SERVER_CACHEPORT"',"db":"'"$REDIS_SERVER_DATABASE"'","pass":"'"$REDIS_SERVER_PASSWORD"'"}' ${APP_SERVICES_SOCKET_IO_PATH} > ${APP_SERVICES_SOCKET_IO_PATH}.tmp && mv ${APP_SERVICES_SOCKET_IO_PATH}.tmp ${APP_SERVICES_SOCKET_IO_PATH} REDIS_SERVER_EXTERNAL=true; fi From 71d343c016afb4c13c431bef6dca587a3a77ba79 Mon Sep 17 00:00:00 2001 From: Evgeniy Antonyuk Date: Fri, 1 Sep 2023 15:08:19 +0500 Subject: [PATCH 3/4] Updating the nodejs repository installation to an up-to-date version --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 374ddb8..0188635 100644 --- a/Dockerfile +++ b/Dockerfile @@ -68,7 +68,10 @@ RUN apt-get -y update && \ sudo dpkg -i packages-microsoft-prod.deb && \ rm packages-microsoft-prod.deb && \ printf "Package: * \nPin: origin \"packages.microsoft.com\"\nPin-Priority: 1001" > /etc/apt/preferences && \ - curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - && \ + echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \ + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/nodesource.gpg --import && \ + chmod 644 /usr/share/keyrings/nodesource.gpg && \ + apt-get -y update && \ apt-get install -yq gnupg2 \ ca-certificates \ software-properties-common \ From eb0ea3b8d6fa2f8e03f1302ce7196f4943119954 Mon Sep 17 00:00:00 2001 From: Evgeniy Antonyuk Date: Mon, 22 Jan 2024 12:41:11 +0700 Subject: [PATCH 4/4] Limit the default worker_processes to one --- run-community-server.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run-community-server.sh b/run-community-server.sh index 3053309..213db28 100644 --- a/run-community-server.sh +++ b/run-community-server.sh @@ -34,6 +34,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" NGINX_CONF_DIR="/etc/nginx/sites-enabled" CPU_PROCESSOR_COUNT=${CPU_PROCESSOR_COUNT:-$(cat /proc/cpuinfo | grep -i processor | awk '{print $1}' | grep -i processor | wc -l)}; NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)}; +NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-1} SERVICE_SSO_AUTH_HOST_ADDR=${SERVICE_SSO_AUTH_HOST_ADDR:-${CONTROL_PANEL_PORT_80_TCP_ADDR}}; DEFAULT_APP_CORE_MACHINEKEY="$(sudo sed -n '/"core.machinekey"/s!.*value\s*=\s*"\([^"]*\)".*!\1!p' ${APP_ROOT_DIR}/web.appsettings.config)"; IS_UPDATE="false" @@ -286,7 +287,7 @@ fi cp ${NGINX_ROOT_DIR}/includes/onlyoffice-communityserver-nginx.conf.template ${NGINX_ROOT_DIR}/nginx.conf -sed 's/^worker_processes.*/'"worker_processes ${CPU_PROCESSOR_COUNT};"'/' -i ${NGINX_ROOT_DIR}/nginx.conf +sed 's/^worker_processes.*/'"worker_processes ${NGINX_WORKER_PROCESSES};"'/' -i ${NGINX_ROOT_DIR}/nginx.conf sed 's/worker_connections.*/'"worker_connections ${NGINX_WORKER_CONNECTIONS};"'/' -i ${NGINX_ROOT_DIR}/nginx.conf cp ${NGINX_ROOT_DIR}/includes/onlyoffice-communityserver-common-init.conf.template ${NGINX_CONF_DIR}/onlyoffice