1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-09-16 09:06:32 +02:00
2207: Update webmail container configuration to support MESSAGE_SIZE_LIMIT r=mergify[bot] a=marioja

## What type of PR?

bug-fix

## What does this PR do?

### Related issue(s)
- Auto close an issue like: closes #2186 

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.


Co-authored-by: Mario Jauvin <marioja@users.noreply.github.com>
This commit is contained in:
bors[bot]
2022-02-17 14:04:59 +00:00
committed by GitHub
5 changed files with 30 additions and 5 deletions

View File

@@ -0,0 +1 @@
Will update /etc/nginx/nginx.conf and /etc/nginx/http.d/rainloop.conf in webmail container to support MESSAGE_SIZE_LIMIT

View File

@@ -36,10 +36,11 @@ RUN apk add --no-cache \
&& rm /etc/nginx/http.d/default.conf \ && rm /etc/nginx/http.d/default.conf \
&& rm /etc/php7/php-fpm.d/www.conf \ && rm /etc/php7/php-fpm.d/www.conf \
&& mkdir -p /run/nginx \ && mkdir -p /run/nginx \
&& mkdir -p /var/www/rainloop && mkdir -p /var/www/rainloop \
&& mkdir -p /config
# nginx / PHP config files # 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 COPY config/php-rainloop.conf /etc/php7/php-fpm.d/rainloop.conf
# Rainloop login # Rainloop login
@@ -67,11 +68,12 @@ RUN apk add --no-cache \
&& apk del unzip && apk del unzip
COPY start.py /start.py COPY start.py /start.py
COPY config.py /config.py
EXPOSE 80/tcp EXPOSE 80/tcp
VOLUME ["/data"] VOLUME ["/data"]
CMD php-fpm7 && /start.py CMD /start.py
HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1 HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1
RUN echo $VERSION >> /version RUN echo $VERSION >> /version

15
webmails/rainloop/config.py Executable file
View File

@@ -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")

View File

@@ -12,6 +12,9 @@ server {
index index.php; index index.php;
# set maximum body size to configured limit
client_max_body_size {{ MESSAGE_SIZE_LIMIT|int + 8388608 }};
location / { location / {
try_files $uri /index.php?$query_string; try_files $uri /index.php?$query_string;
} }

View File

@@ -4,6 +4,7 @@ import os
import shutil import shutil
import logging as log import logging as log
import sys import sys
import subprocess
from socrate import system, conf from socrate import system, conf
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
@@ -22,8 +23,11 @@ os.makedirs(base + "configs", exist_ok=True)
conf.jinja("/defaults/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini") conf.jinja("/defaults/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini")
conf.jinja("/defaults/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini") conf.jinja("/defaults/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini")
conf.jinja("/defaults/php.ini", os.environ, "/etc/php7/php.ini") conf.jinja("/defaults/php.ini", os.environ, "/etc/php7/php.ini")
# Start the fastcgi process manager now that config files have been adjusted
os.system("php-fpm7")
os.system("chown -R nginx:nginx /data") os.system("chown -R nginx:nginx /data")
os.system("chmod -R a+rX /var/www/rainloop/") os.system("chmod -R a+rX /var/www/rainloop/")
subprocess.call(["/config.py"])
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"]) os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])