mirror of
https://github.com/Mailu/Mailu.git
synced 2025-03-03 14:52:36 +02:00
Merge #3044
3044: Add a sigterm handler to make docker stop go faster r=mergify[bot] a=nextgens ## What type of PR? enhancement ## What does this PR do? - Add a sigterm handler to make ``docker stop`` go way faster - Ensure we don't log requests to /ping in admin - Fixup doc - Upgrade WTForms to fix alias creation ### Related issue(s) ## 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. - [ ] In case of feature or enhancement: documentation updated accordingly - [ ] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file. Co-authored-by: Florent Daigniere <nextgens@freenetproject.org> Co-authored-by: Florent Daigniere <nextgens@users.noreply.github.com>
This commit is contained in:
commit
a1158ec224
@ -12,7 +12,7 @@ import hmac
|
||||
|
||||
class NoPingFilter(logging.Filter):
|
||||
def filter(self, record):
|
||||
if (record.args['{host}i'] == 'localhost' and record.args['r'] == 'GET /ping HTTP/1.1'):
|
||||
if record.args['r'].endswith(' /ping HTTP/1.1'):
|
||||
return False
|
||||
if record.args['r'].endswith(' /internal/rspamd/local_domains HTTP/1.1'):
|
||||
return False
|
||||
|
@ -1,6 +1,7 @@
|
||||
import hmac
|
||||
import logging as log
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import re
|
||||
from pwd import getpwnam
|
||||
@ -69,11 +70,17 @@ def _is_compatible_with_hardened_malloc():
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def sigterm_handler(_signo, _stack_frame):
|
||||
log.critical("Received SIGTERM, terminating.")
|
||||
sys.exit(143)
|
||||
|
||||
def set_env(required_secrets=[], log_filters=[]):
|
||||
if log_filters:
|
||||
sys.stdout = LogFilter(sys.stdout, log_filters)
|
||||
sys.stderr = LogFilter(sys.stderr, log_filters)
|
||||
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", 'WARNING'))
|
||||
signal.signal(signal.SIGTERM, sigterm_handler)
|
||||
|
||||
if not 'LD_PRELOAD' in os.environ and _is_compatible_with_hardened_malloc():
|
||||
log.warning('Your CPU has Advanced Vector Extensions available, we recommend you enable hardened-malloc earlier in the boot process by adding LD_PRELOAD=/usr/lib/libhardened_malloc.so to your mailu.env')
|
||||
|
@ -87,7 +87,7 @@ vobject==0.9.6.1
|
||||
watchdog==3.0.0
|
||||
Werkzeug===2.3.7
|
||||
wrapt==1.15.0
|
||||
WTForms==3.1.0
|
||||
WTForms==3.1.1
|
||||
WTForms-Components==0.10.5
|
||||
xmltodict==0.13.0
|
||||
yarl==1.9.2
|
||||
|
@ -214,9 +214,8 @@ Depending on your particular deployment you most probably will want to change th
|
||||
Advanced settings
|
||||
-----------------
|
||||
|
||||
The ``AUTH_REQUIRE_TOKENS`` (default: False) setting controls whether thick clients can
|
||||
authenticate using passwords or whether they are forced to use tokens/application
|
||||
specific passwords.
|
||||
|
||||
The ``AUTH_REQUIRE_TOKENS`` (default: False) setting controls whether thick clients can authenticate using passwords or whether they are forced to use tokens/application specific passwords.
|
||||
|
||||
The ``API_TOKEN`` (default: None) setting configures the authentication token.
|
||||
This token must be passed as request header to the API as authentication token.
|
||||
|
Loading…
x
Reference in New Issue
Block a user