summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-01-16 20:09:34 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-01-16 20:09:34 +0100
commit12f422fd95e3b5d6228f220c67ae2a203898007c (patch)
tree75b2bf05b5896ce960165a28b9b23b4f18a593c0 /install
parent696671dea6b284eea36affd473d9f036de4db71f (diff)
downloadIshtar-12f422fd95e3b5d6228f220c67ae2a203898007c.tar.bz2
Ishtar-12f422fd95e3b5d6228f220c67ae2a203898007c.zip
Indication of the maximum file size in help for file fields
Diffstat (limited to 'install')
-rwxr-xr-xinstall/ishtar-prepare-instance27
-rw-r--r--install/local_settings.py.sample4
-rw-r--r--install/nginx.conf.template4
3 files changed, 34 insertions, 1 deletions
diff --git a/install/ishtar-prepare-instance b/install/ishtar-prepare-instance
index d9467247b..fec08b119 100755
--- a/install/ishtar-prepare-instance
+++ b/install/ishtar-prepare-instance
@@ -134,6 +134,31 @@ EOF
done
fi
+ if [ ! -z '$MAX_UPLOAD_SIZE' ]; then
+ MAX_UPLOAD_SIZE=''
+ cat >&2 <<-'EOF'
+
+-------------------------------------------------------------------------------
+ A maximum size for file upload is set. By default, the limit is set to 100
+ Mo. Consider raising or lowering this value to fit to your needs.
+ Note: to change this value after the installation change client_max_body_size
+ it in the nginx configuration file and MAX_UPLOAD_SIZE in local_settings.
+
+EOF
+ re_number='^[0-9]+$'
+ while ! [[ "$MAX_UPLOAD_SIZE" =~ $re_number ]]
+ do
+ cecho y "* Max upload size in Mo (default: 100)? "
+ read choice
+ MAX_UPLOAD_SIZE=$choice
+ if [ "$MAX_UPLOAD_SIZE" == '' ]; then
+ MAX_UPLOAD_SIZE=100
+ fi
+ done
+ fi
+
+
+
DEST=$ISHTAR_PATH
cat >&2 <<-'EOF'
@@ -242,6 +267,7 @@ EOF
s|#DB_NAME#|$DB_NAME|g;\
s|#DB_PORT#|$DB_PORT|g;\
s|#DB_PASSWORD#|$DB_PASSWORD|g;\
+ s|#MAX_UPLOAD_SIZE#|$MAX_UPLOAD_SIZE|g;\
s|#URL#|$URL|g;\
s|#APP_DIR#|$APP_DIR|g;\
s|#SECRET_KEY#|$SECRET_KEY|g;" \
@@ -272,6 +298,7 @@ EOF
s|#UWSGI_PORT#|$UWSGI_PORT|g;\
s|#NGINX_PORT#|$NGINX_PORT|g;\
s|#INSTALL_PATH#|$INSTALL_PATH|g;\
+ s|#MAX_UPLOAD_SIZE#|$MAX_UPLOAD_SIZE|g;\
s|#URL#|$URL|g;" \
"install/nginx.conf.template" > \
"$INSTANCE/nginx.conf"
diff --git a/install/local_settings.py.sample b/install/local_settings.py.sample
index dbe4e7e62..93ccdc01a 100644
--- a/install/local_settings.py.sample
+++ b/install/local_settings.py.sample
@@ -13,6 +13,10 @@ LOGFILE = "/var/log/django/ishtar-#APP_NAME#.log"
MEDIA_ROOT = "#APP_DIR#/media/"
+# if you change this parameter do not forget to change it in your nginx
+# configuration
+MAX_UPLOAD_SIZE = #MAX_UPLOAD_SIZE# # in Mo
+
ODT_TEMPLATE = "#INSTALL_PATH#/ishtar_common/static/template.odt"
ALLOWED_HOSTS = ["#URL#"]
diff --git a/install/nginx.conf.template b/install/nginx.conf.template
index 15333393b..cf28553a8 100644
--- a/install/nginx.conf.template
+++ b/install/nginx.conf.template
@@ -4,7 +4,9 @@ server {
root #INSTALL_PATH#;
access_log /var/log/django/#APP_NAME#-access.log;
error_log /var/log/django/#APP_NAME#-error.log;
- client_max_body_size 20M;
+ # if you change client_max_body_size do not forget to change it also
+ # to your corresponding local_settings.py file
+ client_max_body_size #MAX_UPLOAD_SIZE#M;
location /static/ { # STATIC_URL
alias #INSTALL_PATH#/#APP_NAME#/static/; # STATIC_ROOT