jperelli / osm-static-maps

Openstreetmap static maps is a nodejs lib, CLI and server open source inspired on google static map service
http://osm-static-maps.herokuapp.com/
GNU General Public License v2.0
160 stars 52 forks source link

Add docker healthcheck #19

Closed chapa closed 4 years ago

chapa commented 4 years ago

Hey there,

I had a problem recently: the container stopped working because of a nasty error pthread_create: Resource temporarily unavailable. It stopped working but was always "healthy" from the docker point of view.

This PR adds a HEALTHCHECK in the Dockerfile so that docker can detect if the service is down and restart the container if needed.

I created a special endpoint /health for that, to avoid wasting resources by generating an image on /.

jperelli commented 4 years ago

I think it would be better to set it to unless-stopped instead of always. if we use always, we will have a leftover runnning container when developing.

chapa commented 4 years ago

You're right, I thought always restarts the container if the user stops it (like the behavior of deployment's pods in k8s), but actually it restarts it only when the docker daemon restarts. I'll change to unless-stopped which seems better

jperelli commented 4 years ago

pretty cool, thanks!