1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-18 03:21:36 +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
commit b73963aae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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/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
@ -67,11 +68,12 @@ RUN apk add --no-cache \
&& apk del unzip
COPY start.py /start.py
COPY config.py /config.py
EXPOSE 80/tcp
VOLUME ["/data"]
CMD php-fpm7 && /start.py
CMD /start.py
HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1
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

@ -3,7 +3,7 @@ server {
listen [::]:80 default_server;
root /var/www/rainloop;
# /dev/stdout (Default), <path>, 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;

View File

@ -4,6 +4,7 @@ import os
import shutil
import logging as log
import sys
import subprocess
from socrate import system, conf
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/application.ini", os.environ, "/data/_data_/_default_/configs/application.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("chmod -R a+rX /var/www/rainloop/")
subprocess.call(["/config.py"])
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])