Running docker healthcheck in uwsgi application

Viewed 28

I'm trying to run a curl command inside a docker container (which runs a uwsgi python process). the end goal is to add a health check. But for some reason the health check curl command returns an empty response and fails. Here is the command I'm trying to run:


root@3e8a0dbcbd3e:/srv/src# curl localhost:8000 -v
* Expire in 0 ms for 6 (transfer 0x55cb5d2cffb0)
* Expire in 1 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 0 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 1 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 0 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 0 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 2 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 0 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 0 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 2 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 1 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 1 ms for 1 (transfer 0x55cb5d2cffb0)
* Expire in 1 ms for 1 (transfer 0x55cb5d2cffb0)
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 149997 ms for 3 (transfer 0x55cb5d2cffb0)
* Expire in 200 ms for 4 (transfer 0x55cb5d2cffb0)
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET / HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.64.0
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

Here is my config file. Does anyone see what's missing?

[uwsgi]


# process related settings
master              = true
harakiri            = $(UWSGI_HARAKIRI)
worker-reload-mercy = $(UWSGI_WORKER_RELOAD_MERCY)

# monitoring (use with `uwsgitop :1717`, for example)
stats = :1717
memory-report = true

# Overrideable default of 2 uWSGI processes.
if-env = UWSGI_WORKERS_COUNT
workers = %(_)
endif =
if-not-env = UWSGI_WORKERS_COUNT
workers = 2
endif =

# activate cheaper mode
if-env = UWSGI_CHEAPER_WORKERS_COUNT
cheaper-algo = spare
cheaper = %(_)
cheaper-initial = %(_)
cheaper-step = 2
cheaper-overload = 1
endif =

# stop spawning new workers if total memory consumption grows too large
if-env = UWSGI_CHEAPER_RSS_LIMIT_SOFT
cheaper-rss-limit-soft = %(_)
endif =
if-not-env = UWSGI_CHEAPER_RSS_LIMIT_SOFT
cheaper-rss-limit-soft = %(2 * 1024 * 1024 * 1024)
endif =

# respawn processes after serving UWSGI_MAX_REQUESTS requests (default 5000)
if-env = UWSGI_MAX_REQUESTS
max-requests = %(_)
endif =

# respawn workers when their memory consumption grows too large
if-env = UWSGI_RELOAD_ON_RSS_MB
reload-on-rss = %(_)
endif =
if-not-env = UWSGI_RELOAD_ON_RSS_MB
reload-on-rss = 512
endif =

socket          = 0.0.0.0:8000
buffer-size     = 32768
listen          = @(/proc/sys/net/core/somaxconn)

#uid             = wsgi
#gid             = wsgi
die-on-term     = true

# uWSGI does not pass locale information to the application by default
env = LC_ALL=en_US.UTF-8

# Required for Raven/Sentry
enable-threads  = true
0 Answers
Related