I have a weird problem, which is probably related to my Dockerfile, but I fail to see it - I've tried different settings, but nothing helps. Here is my uwsgi.ini
file:
[uwsgi]
strict = true
socket = 0.0.0.0:8000
protocol = http
module = my_django_project.wsgi
env = DJANGO_SETTINGS_MODULE=my_django_project.settings
master = true
enable-threads = true
vacuum = true
single-interpreter = true
die-on-term = true
need-app = true
harakiri = 60
max-requests = 1000
max-worker-lifetime = 3600
reload-on-rss = 2048
worker-reload-mercy = 60
cheaper-algo = busyness
processes = 128
cheaper = 8
cheaper-initial = 16
cheaper-overload = 1
cheaper-step = 16
cheaper-busyness-multiplier = 30
cheaper-busyness-min = 20
cheaper-busyness-max = 70
cheaper-busyness-backlog-alert = 16
cheaper-busyness-backlog-step = 2
static-map = /static=/static
route = ^/healthz/?$ donotlog:
route = ^/metrics/?$ donotlog:
# spooler setup
spooler = ./spooler
spooler-processes = 2
spooler-frequency = 10
When I'll install all modules on my VM (CentOS) in the python virtual environment and run uwsgi --ini uwsgi.ini
, everything works fine and I can see the following message in the console output:
*** dumping internal routing table ***
[rule: 0] subject: path_info regexp: ^/healthz/?$ action: donotlog:
[rule: 1] subject: path_info regexp: ^/metrics/?$ action: donotlog:
*** end of the internal routing table ***
Now, if I'll run exactly the same in Docker, I'll get the following error:
web_1_c2d4cafeeae0 | [uWSGI] getting INI configuration from uwsgi.ini
web_1_c2d4cafeeae0 | [strict-mode] unknown config directive: route
Here is my Dockerfile
:
FROM python:3.7.5-alpine3.10
RUN set -ex && \
apk update && \
apk add postgresql-dev \
gcc \
make \
python3-dev \
musl-dev \
linux-headers \
libffi-dev \
libxslt-dev \
python-dev \
libxml2 \
libxml2-dev \
py3-lxml && \
pip install --upgrade pip && \
mkdir /sources
COPY . /sources
WORKDIR /sources
RUN pip install uwsgi==2.0.18 && pip install -e . && python manage.py collectstatic --noinput
EXPOSE 8000
CMD ["uwsgi", "--ini", "uwsgi.ini"]
I've tried different base images, different versions of the uwsgi (I got the same in virtual env, so it shouldn't be the case).
The application works perfectly fine if I'll remove the two route
directives, but I need them since they are polluting my logs.
Why uwsgi doesn't work as expected in Docker?