GeoNode / geonode-project

A django template project for creating custom GeoNode projects.
http://geonode.org
78 stars 172 forks source link

Current django health check in `docker-compose.yml` useless. #363

Closed sonicnkt closed 2 years ago

sonicnkt commented 2 years ago

In the docker-compose.yml a health for the django container is performed using a simple curl command inside in the container to check if the server is running: test: "curl --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://127.0.0.1:8000/"

But this isn't working anymore since in the default configuration an http-socket isn't configured, this results in curl exiting with code 52 as its getting an empty reply from the server.

This results in a permanent unhealthy status of the container and is misleading.

A solution would be to use uswgi_curl from the uwsi-tools package (pip). It does not offer the same options as curl but results in a correct exit code (0 working, 1 not working).

afabiani commented 2 years ago

We can do something similar to what geonode does

[uwsgi]
uwsgi-socket = 0.0.0.0:8000
http-socket = 0.0.0.0:8001
    healthcheck:
      test: "curl --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://127.0.0.1:8001/"
      start_period: 60s
      interval: 60s
      timeout: 10s
      retries: 10
sonicnkt commented 2 years ago

Guess if running the additional socket isn't using any additional system resources this is fine.