From a9f4fc1b3c5dd3016ad19e6cdb3ed969a261cc75 Mon Sep 17 00:00:00 2001 From: Mario Jauvin Date: Mon, 31 Jan 2022 11:40:33 -0500 Subject: [PATCH] Use MESSAGE_SIZE_LIMIT in webmail container also The webmail container should use the same value as the front container. --- webmails/rainloop/Dockerfile | 5 +++-- webmails/rainloop/config.py | 15 +++++++++++++++ webmails/rainloop/config/nginx-rainloop.conf | 7 +++++-- webmails/rainloop/start.py | 1 + 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 webmails/rainloop/config.py diff --git a/webmails/rainloop/Dockerfile b/webmails/rainloop/Dockerfile index 8f77ab5c..3970a785 100644 --- a/webmails/rainloop/Dockerfile +++ b/webmails/rainloop/Dockerfile @@ -36,10 +36,11 @@ RUN apk add --no-cache \ && rm /etc/nginx/http.d/default.conf \ && rm /etc/php7/php-fpm.d/www.conf \ && mkdir -p /run/nginx \ - && mkdir -p /var/www/rainloop + && mkdir -p /var/www/rainloop \ + && mkdir -p /config # nginx / PHP config files -COPY config/nginx-rainloop.conf /etc/nginx/http.d/rainloop.conf +COPY config/nginx-rainloop.conf /config/nginx-rainloop.conf COPY config/php-rainloop.conf /etc/php7/php-fpm.d/rainloop.conf # Rainloop login diff --git a/webmails/rainloop/config.py b/webmails/rainloop/config.py new file mode 100644 index 00000000..88052961 --- /dev/null +++ b/webmails/rainloop/config.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +import os +import logging as log +import sys +from socrate import system, conf + +args = os.environ.copy() + +log.basicConfig(stream=sys.stderr, level=args.get("LOG_LEVEL", "WARNING")) + +# Build final configuration paths +conf.jinja("/config/nginx-rainloop.conf", args, "/etc/nginx/http.d/rainloop.conf") +if os.path.exists("/var/run/nginx.pid"): + os.system("nginx -s reload") diff --git a/webmails/rainloop/config/nginx-rainloop.conf b/webmails/rainloop/config/nginx-rainloop.conf index dfdbf8f7..be40e963 100644 --- a/webmails/rainloop/config/nginx-rainloop.conf +++ b/webmails/rainloop/config/nginx-rainloop.conf @@ -3,7 +3,7 @@ server { listen [::]:80 default_server; root /var/www/rainloop; - + # /dev/stdout (Default), , off access_log off; @@ -12,13 +12,16 @@ server { index index.php; + # set maximum body size to configured limit + client_max_body_size {{ MESSAGE_SIZE_LIMIT|int + 8388608 }}; + location / { try_files $uri /index.php?$query_string; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.*)$; - + fastcgi_intercept_errors on; fastcgi_index index.php; diff --git a/webmails/rainloop/start.py b/webmails/rainloop/start.py index a52b70e9..7bb11a6a 100755 --- a/webmails/rainloop/start.py +++ b/webmails/rainloop/start.py @@ -26,4 +26,5 @@ conf.jinja("/defaults/php.ini", os.environ, "/etc/php7/php.ini") os.system("chown -R nginx:nginx /data") os.system("chmod -R a+rX /var/www/rainloop/") +subprocess.call(["/config.py"]) os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])