mirror of
https://github.com/optim-enterprises-bv/Mailu.git
synced 2025-11-24 10:14:58 +00:00
Merge #2606
2606: Modify the healtchecks to make them disapear from the logs. r=nextgens a=nextgens ## What type of PR? enhancement ## What does this PR do? Modify the healtchecks to make them disapear from the logs. This is not perfect... - dovecot now complains about waitpid/finding a new process - postfix is still regularly pinging rspamd / his milter and that generates a few lines worth of logs each time. ### 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 - [x] 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>
This commit is contained in:
@@ -23,7 +23,7 @@ RUN set -euxo pipefail \
|
||||
RUN echo $VERSION >/version
|
||||
|
||||
#EXPOSE 80/tcp
|
||||
HEALTHCHECK CMD curl -skfLo /dev/null http://localhost/sso/login?next=ui.index
|
||||
HEALTHCHECK CMD curl -skfLo /dev/null http://localhost/ping
|
||||
|
||||
VOLUME ["/data","/dkim"]
|
||||
|
||||
|
||||
@@ -5,9 +5,24 @@ import flask
|
||||
import flask_bootstrap
|
||||
|
||||
from mailu import utils, debug, models, manage, configuration
|
||||
from gunicorn import glogging
|
||||
import logging
|
||||
|
||||
import hmac
|
||||
|
||||
class NoPingFilter(logging.Filter):
|
||||
def filter(self, record):
|
||||
if not (record.args['{host}i'] == 'localhost' and record.args['r'] == 'GET /ping HTTP/1.1'):
|
||||
return True
|
||||
|
||||
class Logger(glogging.Logger):
|
||||
def setup(self, cfg):
|
||||
super().setup(cfg)
|
||||
|
||||
# Add filters to Gunicorn logger
|
||||
logger = logging.getLogger("gunicorn.access")
|
||||
logger.addFilter(NoPingFilter())
|
||||
|
||||
def create_app_from_config(config):
|
||||
""" Create a new application based on the given configuration
|
||||
"""
|
||||
@@ -69,6 +84,10 @@ def create_app_from_config(config):
|
||||
def format_datetime(value):
|
||||
return utils.flask_babel.format_datetime(value) if value else ''
|
||||
|
||||
def ping():
|
||||
return ''
|
||||
app.route('/ping')(ping)
|
||||
|
||||
# Import views
|
||||
from mailu import ui, internal, sso, api
|
||||
app.register_blueprint(ui.ui, url_prefix=app.config['WEB_ADMIN'])
|
||||
|
||||
@@ -53,8 +53,11 @@ def test_DNS():
|
||||
test_DNS()
|
||||
|
||||
start_command=" ".join([
|
||||
"gunicorn --threads ", str(os.cpu_count()),
|
||||
"gunicorn",
|
||||
f"--threads {str(os.cpu_count())}",
|
||||
"-b :80",
|
||||
"--logger-class mailu.Logger",
|
||||
"--worker-tmp-dir /dev/shm",
|
||||
"--access-logfile -" if (log.root.level<=log.INFO) else "",
|
||||
"--error-logfile -",
|
||||
"--preload",
|
||||
|
||||
@@ -16,7 +16,7 @@ COPY start.py /
|
||||
RUN echo $VERSION >/version
|
||||
|
||||
EXPOSE 110/tcp 143/tcp 993/tcp 4190/tcp 2525/tcp
|
||||
HEALTHCHECK --start-period=350s CMD echo QUIT|nc localhost 110|grep "Dovecot ready."
|
||||
HEALTHCHECK CMD echo PING|nc -w2 localhost 5001|grep "PONG"
|
||||
|
||||
VOLUME ["/mail"]
|
||||
|
||||
|
||||
@@ -95,6 +95,13 @@ service auth-worker {
|
||||
}
|
||||
}
|
||||
|
||||
service health-check {
|
||||
executable = script -p health-check.sh
|
||||
inet_listener health-check {
|
||||
port = 5001
|
||||
}
|
||||
}
|
||||
|
||||
###############
|
||||
# IMAP & POP
|
||||
###############
|
||||
|
||||
@@ -31,6 +31,8 @@ module(load="imuxsock")
|
||||
# Discard messages from local test requests
|
||||
:msg, contains, "connect from localhost[127.0.0.1]" ~
|
||||
:msg, contains, "connect from localhost[::1]" ~
|
||||
:msg, contains, "haproxy read: short protocol header: QUIT" ~
|
||||
:msg, contains, "discarding EHLO keywords: PIPELINING" ~
|
||||
|
||||
{% if POSTFIX_LOG_FILE %}
|
||||
# Log mail logs to file
|
||||
|
||||
1
towncrier/newsfragments/2606.misc
Normal file
1
towncrier/newsfragments/2606.misc
Normal file
@@ -0,0 +1 @@
|
||||
Modify the healtchecks to make them disapear from the logs.
|
||||
Reference in New Issue
Block a user