From 4209059223a40fe4ca14b93f325a31048ba904ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Sat, 12 Mar 2022 17:23:04 +0100 Subject: [PATCH] Add option to enlarge the file limits --- docker-compose.yml | 5 +++++ largeFiles.sh | 22 ++++++++++++++++++++++ run-document-server.sh | 4 ++++ 3 files changed, 31 insertions(+) create mode 100755 largeFiles.sh diff --git a/docker-compose.yml b/docker-compose.yml index 91863c7..992cd4d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,11 @@ services: #- JWT_SECRET=secret #- JWT_HEADER=AuthorizationJwt #- JWT_IN_BODY=true + + # Uncomment strings below to enable larger files + #- LARGER_FILES = true + #- MAX_DOWNLOAD_SIZE = 104857600 # Download size in bytes + #- MAX_UNCOMPRESSED_SIZE = 300 # Uncompressed of a file in MB ports: - '80:80' - '443:443' diff --git a/largeFiles.sh b/largeFiles.sh new file mode 100755 index 0000000..3e9e820 --- /dev/null +++ b/largeFiles.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +LARGER_FILES=${LARGER_FILES:-false} +MAX_DOWNOAD_SIZE=${MAX_DOWNLOAD_SIZE:-104857600} +MAX_UNCOMPRESSED_SIZE=${MAX_UNCOMPRESSED_SIZE:-300} +if [ "$LARGER_FILES" = true ]; then + + sed -i -e 's/104857600/${MAX_DOWNLOAD_SIZE}/g' /etc/onlyoffice/documentserver-example/production-linux.json + + sed -i '9iclient_max_body_size ${MAX_DOWNLOAD_SIZE};' /etc/onlyoffice/documentserver-example/nginx/includes/ds-example.conf + sed -i '16iclient_max_body_size ${MAX_DOWLOAD_SIZE};' /etc/nginx/nginx.conf + + sed -i -e 's/104857600/${MAX_DOWNLOAD_SIZE}/g' /etc/onlyoffice/documentserver/default.json + sed -i -e 's/50MB/${MAX_UNCOMPRESSED_SIZE}MB/g' /etc/onlyoffice/documentserver/default.json + sed -i -e 's/300MB/${MAX_UNCOMPRESSED_SIZE}MB/g' /etc/onlyoffice/documentserver/default.json + + sed -i 's/^client_max_body_size 100m;$/client_max_body_size ${MAX_DOWNLOAD_SIZE};/' /etc/onlyoffice/documentserver/nginx/includes/ds-common.conf +fi + +touch /app/ds/largeFiles.lck +#service nginx restart +#supervisorctl restart all diff --git a/run-document-server.sh b/run-document-server.sh index 2bcdcc2..99295df 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -1,5 +1,9 @@ #!/bin/bash +if [! -f /app/ds/largeFiles.lck]; then + /app/ds/largeFiles.sh +fi + function clean_exit { /usr/bin/documentserver-prepare4shutdown.sh }