Hi folks,

TL;DR my app doesn't work because "Embedded mode of mod_wsgi disabled by 
runtime configuration" and I don't know why...

-- Background
 
I've got an apache2/mod_wsgi docker environment set up for multiple 
(30-ish) microservices to migrate to, but we've hit a major sticking point: 
these docker containers all run in kubernetes, and have these requirements:

- the service must run as PID 1, and
- all logging must go to stdout/stderr
- all logging must be in JSON format for ingest by ELK

I've configured apache to sent ErrorLog and AccessLog to stdout, no 
problems. I've also configured them to log JSON (not pretty, but it works). 
The application (Django) is also configured to log JSON, and that's where 
the problem comes in: apache captures *all* output from the Django app and 
formats it into the ErrorLog, producing invalid JSON.

I can't seem to get Django to circumvent apache's output capture. Getting 
Django to log directly to /dev/stdout doesn't work.

Graham suggested on twitter I should use mod_wsgi-express to solve my 
logging problems, so the below is my current state of trying to get it 
working.

Our apache configuration is not trivial (amongst other things it includes 
mod_kerb). I've developed the docker image using Debian slim (based off 
existing work folks here have done with mod_kerb and other components) and 
have followed the standard Debian apache configuration patterns. Through 
benchmarking and load testing we've configured our servers and threads to 
suit a particular memory usage model. So switching to mod_wsgi-express has 
been ... challenging. I'm struggling to find documentation for 
mod_wsgi-express - the PyPI page says docs are at www.modwsgi.org but that 
says the docs are on PyPI. The `start-server --help` is helping though I'm 
not entirely sure what the difference between setup-server and start-server 
is (or if I even should care).

-- Where I'm stuck

So far I've got this command line:

    mod_wsgi-express start-server --include-file /etc/apache2/apache2.conf 
--server-root /etc/apache2 /app/main/wsgi.py

My configuration is used \o/ though we configure StartServers and 
ThreadsPerChild but those seem to be trumped by the --processes and 
--threads command line options. Is there something I've missed here?

That niggle aside, the application doesn't run. I get "Embedded mode of 
mod_wsgi disabled by runtime configuration: /app/main/wsgi.py" I think it's 
related to mod_wsgi "daemon" mode, but I can't see any mod_wsgi-express 
option related to that. My wsgi.py is very simple:

from django.core.wsgi import get_wsgi_application


def application(env, start_response):

    return get_wsgi_application()(env, start_response)


My mod_wsgi-related apache configuration is:

WSGIScriptAlias / /app/main/wsgi.py

WSGIPythonHome /venv

WSGIPythonPath /app


So I'm not sure where to go from here...


Thanks,

     Richard

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to