Pull from upstream
This commit is contained in:
commit
2e1e603daf
13 changed files with 681 additions and 73 deletions
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
umask 0022
|
||||
|
||||
function clean_exit {
|
||||
/usr/bin/documentserver-prepare4shutdown.sh
|
||||
}
|
||||
|
@ -37,7 +39,14 @@ if [ "${RELEASE_DATE}" != "${PREV_RELEASE_DATE}" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
SSL_CERTIFICATES_DIR="${DATA_DIR}/certs"
|
||||
SSL_CERTIFICATES_DIR="/usr/share/ca-certificates/ds"
|
||||
mkdir -p ${SSL_CERTIFICATES_DIR}
|
||||
if [[ -d ${DATA_DIR}/certs ]] && [ -e ${DATA_DIR}/certs/*.crt ]; then
|
||||
cp -f ${DATA_DIR}/certs/* ${SSL_CERTIFICATES_DIR}
|
||||
chmod 644 ${SSL_CERTIFICATES_DIR}/*.crt ${SSL_CERTIFICATES_DIR}/*.pem
|
||||
chmod 400 ${SSL_CERTIFICATES_DIR}/*.key
|
||||
fi
|
||||
|
||||
if [[ -z $SSL_CERTIFICATE_PATH ]] && [[ -f ${SSL_CERTIFICATES_DIR}/${COMPANY_NAME}.crt ]]; then
|
||||
SSL_CERTIFICATE_PATH=${SSL_CERTIFICATES_DIR}/${COMPANY_NAME}.crt
|
||||
else
|
||||
|
@ -64,9 +73,10 @@ 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}
|
||||
NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)}
|
||||
# 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)}
|
||||
|
||||
JWT_ENABLED=${JWT_ENABLED:-false}
|
||||
JWT_ENABLED=${JWT_ENABLED:-true}
|
||||
|
||||
# validate user's vars before usinig in json
|
||||
if [ "${JWT_ENABLED}" == "true" ]; then
|
||||
|
@ -75,7 +85,9 @@ else
|
|||
JWT_ENABLED="false"
|
||||
fi
|
||||
|
||||
JWT_SECRET=${JWT_SECRET:-secret}
|
||||
[ -z $JWT_SECRET ] && JWT_MESSAGE='JWT is enabled by default. A random secret is generated automatically. Run the command "docker exec $(sudo docker ps -q) sudo documentserver-jwt-status.sh" to get information about JWT.'
|
||||
|
||||
JWT_SECRET=${JWT_SECRET:-$(pwgen -s 20)}
|
||||
JWT_HEADER=${JWT_HEADER:-Authorization}
|
||||
JWT_IN_BODY=${JWT_IN_BODY:-false}
|
||||
|
||||
|
@ -83,7 +95,7 @@ WOPI_ENABLED=${WOPI_ENABLED:-false}
|
|||
|
||||
GENERATE_FONTS=${GENERATE_FONTS:-true}
|
||||
|
||||
if [[ ${PRODUCT_NAME} == "documentserver" ]]; then
|
||||
if [[ ${PRODUCT_NAME}${PRODUCT_EDITION} == "documentserver" ]]; then
|
||||
REDIS_ENABLED=false
|
||||
else
|
||||
REDIS_ENABLED=true
|
||||
|
@ -188,7 +200,7 @@ parse_rabbitmq_url(){
|
|||
# extract the host
|
||||
local hostport="$(echo ${url/$userpass@/} | cut -d/ -f1)"
|
||||
# by request - try to extract the port
|
||||
local port="$(echo $hostport | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')"
|
||||
local port="$(echo $hostport | grep : | sed -r 's_^.*:+|/.*$__g')"
|
||||
|
||||
local host
|
||||
if [ -n "$port" ]; then
|
||||
|
@ -295,6 +307,11 @@ update_redis_settings(){
|
|||
${JSON} -I -e "if(this.services.CoAuthoring.redis===undefined)this.services.CoAuthoring.redis={};"
|
||||
${JSON} -I -e "this.services.CoAuthoring.redis.host = '${REDIS_SERVER_HOST}'"
|
||||
${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'"
|
||||
|
||||
if [ -n "${REDIS_SERVER_PASS}" ]; then
|
||||
${JSON} -I -e "this.services.CoAuthoring.redis.options = {'password':'${REDIS_SERVER_PASS}'}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
update_ds_settings(){
|
||||
|
@ -410,12 +427,15 @@ update_welcome_page() {
|
|||
WELCOME_PAGE="${APP_DIR}-example/welcome/docker.html"
|
||||
if [[ -e $WELCOME_PAGE ]]; then
|
||||
DOCKER_CONTAINER_ID=$(basename $(cat /proc/1/cpuset))
|
||||
(( ${#DOCKER_CONTAINER_ID} < 12 )) && DOCKER_CONTAINER_ID=$(hostname)
|
||||
if (( ${#DOCKER_CONTAINER_ID} >= 12 )); then
|
||||
if [[ -x $(command -v docker) ]]; then
|
||||
DOCKER_CONTAINER_NAME=$(docker inspect --format="{{.Name}}" $DOCKER_CONTAINER_ID)
|
||||
sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_NAME#/}"'/' -i $WELCOME_PAGE
|
||||
JWT_MESSAGE=$(echo $JWT_MESSAGE | sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_NAME#/}"'/')
|
||||
else
|
||||
sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_ID::12}"'/' -i $WELCOME_PAGE
|
||||
JWT_MESSAGE=$(echo $JWT_MESSAGE | sed 's/$(sudo docker ps -q)/'"${DOCKER_CONTAINER_ID::12}"'/')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -468,6 +488,8 @@ update_nginx_settings(){
|
|||
if [ -f "${NGINX_ONLYOFFICE_EXAMPLE_CONF}" ]; then
|
||||
sed 's/linux/docker/' -i ${NGINX_ONLYOFFICE_EXAMPLE_CONF}
|
||||
fi
|
||||
|
||||
documentserver-update-securelink.sh -s ${SECURE_LINK_SECRET:-$(pwgen -s 20)} -r false
|
||||
}
|
||||
|
||||
update_supervisor_settings(){
|
||||
|
@ -475,6 +497,8 @@ update_supervisor_settings(){
|
|||
cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisor /etc/init.d/
|
||||
# Copy modified supervisor config
|
||||
cp ${SYSCONF_TEMPLATES_DIR}/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
sed "s/COMPANY_NAME/${COMPANY_NAME}/g" -i ${SYSCONF_TEMPLATES_DIR}/supervisor/ds/*.conf
|
||||
cp ${SYSCONF_TEMPLATES_DIR}/supervisor/ds/*.conf etc/supervisor/conf.d/
|
||||
}
|
||||
|
||||
update_log_settings(){
|
||||
|
@ -503,7 +527,7 @@ for i in ${DS_LIB_DIR}/App_Data/cache/files ${DS_LIB_DIR}/App_Data/docbuilder ${
|
|||
done
|
||||
|
||||
# change folder rights
|
||||
for i in ${LOG_DIR} ${LIB_DIR} ${DATA_DIR}; do
|
||||
for i in ${LOG_DIR} ${LIB_DIR}; do
|
||||
chown -R ds:ds "$i"
|
||||
chmod -R 755 "$i"
|
||||
done
|
||||
|
@ -577,6 +601,8 @@ else
|
|||
update_welcome_page
|
||||
fi
|
||||
|
||||
find /etc/${COMPANY_NAME} -exec chown ds:ds {} \;
|
||||
|
||||
#start needed local services
|
||||
for i in ${LOCAL_SERVICES[@]}; do
|
||||
service $i start
|
||||
|
@ -625,29 +651,32 @@ if [ "${GENERATE_FONTS}" == "true" ]; then
|
|||
fi
|
||||
documentserver-static-gzip.sh ${ONLYOFFICE_DATA_CONTAINER}
|
||||
|
||||
echo "${JWT_MESSAGE}"
|
||||
|
||||
# Check if lager file limits should be set
|
||||
if [ "$LARGER_FILE_LIMITS" = "true" ]; then
|
||||
if [ -e /app/ds/file_limits_set ]; then
|
||||
echo ""
|
||||
echo ""
|
||||
else
|
||||
touch /app/ds/file_limits_set
|
||||
touch /app/ds/file_limits_set
|
||||
|
||||
sed -i -e 's/104857600/10485760000/g' /etc/onlyoffice/documentserver-example/production-linux.json
|
||||
|
||||
sed -i '9iclient_max_body_size 1000M;' /etc/onlyoffice/documentserver-example/nginx/includes/ds-example.conf
|
||||
sed -i '16iclient_max_body_size 1000M;' /etc/nginx/nginx.conf
|
||||
|
||||
sed -i -e 's/104857600/10485760000/g' /etc/onlyoffice/documentserver/default.json
|
||||
sed -i -e 's/50MB/5000MB/g' /etc/onlyoffice/documentserver/default.json
|
||||
sed -i -e 's/300MB/3000MB/g' /etc/onlyoffice/documentserver/default.json
|
||||
|
||||
sed -i 's/^client_max_body_size 100m;$/client_max_body_size 1000m;/' /etc/onlyoffice/documentserver/nginx/includes/ds-common.conf
|
||||
sed -i -e 's/104857600/10485760000/g' /etc/onlyoffice/documentserver-example/production-linux.json
|
||||
|
||||
sed -i '9iclient_max_body_size 1000M;' /etc/onlyoffice/documentserver-example/nginx/includes/ds-example.conf
|
||||
sed -i '16iclient_max_body_size 1000M;' /etc/nginx/nginx.conf
|
||||
|
||||
sed -i -e 's/104857600/10485760000/g' /etc/onlyoffice/documentserver/default.json
|
||||
sed -i -e 's/50MB/5000MB/g' /etc/onlyoffice/documentserver/default.json
|
||||
sed -i -e 's/300MB/3000MB/g' /etc/onlyoffice/documentserver/default.json
|
||||
|
||||
sed -i 's/^client_max_body_size 100m;$/client_max_body_size 1000m;/' /etc/onlyoffice/documentserver/nginx/includes/ds-common.conf
|
||||
|
||||
service nginx restart
|
||||
supervisorctl restart all
|
||||
|
||||
service nginx restart
|
||||
supervisorctl restart all
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
tail -f /var/log/${COMPANY_NAME}/**/*.log &
|
||||
wait $!
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue