diff --git a/Dockerfile b/Dockerfile index 50c55a7f..f8d28f36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG BASE_VERSION=22.04 ARG BASE_IMAGE=ubuntu:$BASE_VERSION -FROM ${BASE_IMAGE} as documentserver +FROM ${BASE_IMAGE} AS documentserver LABEL maintainer Ascensio System SIA ARG BASE_VERSION @@ -62,7 +62,6 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ pwgen \ rabbitmq-server \ redis-server \ - software-properties-common \ sudo \ supervisor \ ttf-mscorefonts-installer \ diff --git a/README.md b/README.md index 6e0418e5..298fe097 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ Below is the complete list of parameters that can be set using environment varia - **METRICS_PREFIX**: Defines StatsD metrics prefix for backend services. Defaults to `ds.`. - **LETS_ENCRYPT_DOMAIN**: Defines the domain for Let's Encrypt certificate. - **LETS_ENCRYPT_MAIL**: Defines the domain administator mail address for Let's Encrypt certificate. -- **PLUGINS_ENABLED**: Defines whether to enable default plugins. Defaults to `false`. +- **PLUGINS_ENABLED**: Defines whether to enable default plugins. Defaults to `true`. ## Installing ONLYOFFICE Document Server integrated with Community and Mail Servers diff --git a/config/supervisor/ds/ds-converter.conf b/config/supervisor/ds/ds-converter.conf index 69285cd4..21daf989 100644 --- a/config/supervisor/ds/ds-converter.conf +++ b/config/supervisor/ds/ds-converter.conf @@ -2,7 +2,7 @@ command=/var/www/COMPANY_NAME/documentserver/server/FileConverter/converter directory=/var/www/COMPANY_NAME/documentserver/server/FileConverter user=ds -environment=NODE_ENV=production-linux,NODE_CONFIG_DIR=/etc/COMPANY_NAME/documentserver,NODE_DISABLE_COLORS=1,APPLICATION_NAME=COMPANY_NAME +environment=NODE_ENV=production-linux,NODE_CONFIG_DIR=/etc/COMPANY_NAME/documentserver,NODE_DISABLE_COLORS=1,APPLICATION_NAME=COMPANY_NAME,LD_LIBRARY_PATH=/var/www/COMPANY_NAME/documentserver/server/FileConverter/bin stdout_logfile=/var/log/COMPANY_NAME/documentserver/converter/out.log stdout_logfile_backups=0 stdout_logfile_maxbytes=0 diff --git a/config/supervisor/ds/ds-docservice.conf b/config/supervisor/ds/ds-docservice.conf index 4afbc1bb..7cb28f7b 100644 --- a/config/supervisor/ds/ds-docservice.conf +++ b/config/supervisor/ds/ds-docservice.conf @@ -2,7 +2,7 @@ command=/var/www/COMPANY_NAME/documentserver/server/DocService/docservice directory=/var/www/COMPANY_NAME/documentserver/server/DocService user=ds -environment=NODE_ENV=production-linux,NODE_CONFIG_DIR=/etc/COMPANY_NAME/documentserver,NODE_DISABLE_COLORS=1 +environment=NODE_ENV=production-linux,NODE_CONFIG_DIR=/etc/COMPANY_NAME/documentserver,NODE_DISABLE_COLORS=1,APPLICATION_NAME=COMPANY_NAME stdout_logfile=/var/log/COMPANY_NAME/documentserver/docservice/out.log stdout_logfile_backups=0 stdout_logfile_maxbytes=0 diff --git a/docker-compose.yml b/docker-compose.yml index 6d925019..af3c028a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '2' services: onlyoffice-documentserver: build: diff --git a/run-document-server.sh b/run-document-server.sh index b086e769..79fda7e9 100644 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -2,14 +2,21 @@ umask 0022 +start_process() { + "$@" & + CHILD=$!; wait "$CHILD"; CHILD=""; +} + function clean_exit { + [[ -z "$CHILD" ]] || kill -s SIGTERM "$CHILD" 2>/dev/null if [ ${ONLYOFFICE_DATA_CONTAINER} == "false" ] && \ [ ${ONLYOFFICE_DATA_CONTAINER_HOST} == "localhost" ]; then /usr/bin/documentserver-prepare4shutdown.sh fi + exit } -trap clean_exit SIGTERM +trap clean_exit SIGTERM SIGQUIT SIGABRT SIGINT # Define '**' behavior explicitly shopt -s globstar @@ -25,7 +32,7 @@ DS_LIB_DIR="${LIB_DIR}/documentserver" CONF_DIR="/etc/${COMPANY_NAME}/documentserver" SUPERVISOR_CONF_DIR="/etc/supervisor/conf.d" IS_UPGRADE="false" -PLUGINS_ENABLED=${PLUGINS_ENABLED:-false} +PLUGINS_ENABLED=${PLUGINS_ENABLED:-true} ONLYOFFICE_DATA_CONTAINER=${ONLYOFFICE_DATA_CONTAINER:-false} ONLYOFFICE_DATA_CONTAINER_HOST=${ONLYOFFICE_DATA_CONTAINER_HOST:-localhost} @@ -98,7 +105,9 @@ NGINX_ONLYOFFICE_EXAMPLE_CONF="${NGINX_ONLYOFFICE_EXAMPLE_PATH}/includes/ds-exam NGINX_CONFIG_PATH="/etc/nginx/nginx.conf" NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-1} # Limiting the maximum number of simultaneous connections due to possible memory shortage -[ $(ulimit -n) -gt 1048576 ] && NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-1048576} || NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)} +LIMIT=$(ulimit -n); [ $LIMIT -gt 1048576 ] && LIMIT=1048576 +NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$LIMIT} +RABBIT_CONNECTIONS=${RABBIT_CONNECTIONS:-$LIMIT} JWT_ENABLED=${JWT_ENABLED:-true} @@ -617,7 +626,7 @@ update_nginx_settings(){ sed 's/linux/docker/' -i ${NGINX_ONLYOFFICE_EXAMPLE_CONF} fi - documentserver-update-securelink.sh -s ${SECURE_LINK_SECRET:-$(pwgen -s 20)} -r false + start_process documentserver-update-securelink.sh -s ${SECURE_LINK_SECRET:-$(pwgen -s 20)} -r false } update_log_settings(){ @@ -693,6 +702,8 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then chmod 400 ${RABBITMQ_DATA}/.erlang.cookie fi + echo "ulimit -n $RABBIT_CONNECTIONS" >> /etc/default/rabbitmq-server + LOCAL_SERVICES+=("rabbitmq-server") # allow Rabbitmq startup after container kill rm -rf /var/run/rabbitmq @@ -753,30 +764,32 @@ if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then service cron start fi +# Fix to resolve the `unknown "cache_tag" variable` error +start_process documentserver-flush-cache.sh -r false + # nginx used as a proxy, and as data container status service. # it run in all cases. service nginx start if [ "${LETS_ENCRYPT_DOMAIN}" != "" -a "${LETS_ENCRYPT_MAIL}" != "" ]; then if [ ! -f "${SSL_CERTIFICATE_PATH}" -a ! -f "${SSL_KEY_PATH}" ]; then - documentserver-letsencrypt.sh ${LETS_ENCRYPT_MAIL} ${LETS_ENCRYPT_DOMAIN} + start_process documentserver-letsencrypt.sh ${LETS_ENCRYPT_MAIL} ${LETS_ENCRYPT_DOMAIN} fi fi # Regenerate the fonts list and the fonts thumbnails if [ "${GENERATE_FONTS}" == "true" ]; then - documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER} + start_process documentserver-generate-allfonts.sh ${ONLYOFFICE_DATA_CONTAINER} fi if [ "${PLUGINS_ENABLED}" = "true" ]; then echo -n Installing plugins, please wait... - documentserver-pluginsmanager.sh -r false --update=\"${APP_DIR}/sdkjs-plugins/plugin-list-default.json\" >/dev/null + start_process documentserver-pluginsmanager.sh -r false --update=\"${APP_DIR}/sdkjs-plugins/plugin-list-default.json\" >/dev/null echo Done fi -documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER} +start_process documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER} echo "${JWT_MESSAGE}" -tail -f /var/log/${COMPANY_NAME}/**/*.log & -wait $! +start_process tail -f /var/log/${COMPANY_NAME}/**/*.log diff --git a/tests/damengdb/damengdb.Dockerfile b/tests/damengdb/damengdb.Dockerfile index a0a708c2..f4f6cf1e 100644 --- a/tests/damengdb/damengdb.Dockerfile +++ b/tests/damengdb/damengdb.Dockerfile @@ -32,6 +32,14 @@ wait_dm_ready EOF +COPY <<"EOF" /permissions.sql + +CREATE SYNONYM onlyoffice.DOC_CHANGES FOR sysdba.DOC_CHANGES; +CREATE SYNONYM onlyoffice.TASK_RESULT FOR sysdba.TASK_RESULT; +GRANT ALL PRIVILEGES ON sysdba.DOC_CHANGES TO onlyoffice; +GRANT ALL PRIVILEGES ON sysdba.TASK_RESULT TO onlyoffice; + +EOF RUN bash /opt/startup.sh > /dev/null 2>&1 \ & mkdir -p /schema/damengdb \ @@ -41,6 +49,9 @@ RUN bash /opt/startup.sh > /dev/null 2>&1 \ && cd ${DISQL_BIN} \ && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT -e \ "create user "onlyoffice" identified by "onlyoffice" password_policy 0;" \ + && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT -e \ + "GRANT SELECT ON DBA_TAB_COLUMNS TO onlyoffice;" \ && echo "EXIT" | tee -a /schema/dameng/createdb.sql \ && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT \`/schema/dameng/createdb.sql \ + && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT \`/permissions.sql \ && sleep 10