nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.33k stars 323 forks source link

Container: How to terminate Nginx unit container from application code. #748

Open Dawoodkhorsandi opened 2 years ago

Dawoodkhorsandi commented 2 years ago

Hey, I was wondering if there is a way to stop running the Nginx unit container from the application code.

In our scenario, we've some pre-conditions and the container should be down in case any conditions are not met.

tippexs commented 2 years ago

Hi @Dawoodkhorsandi If I understand you correctly you would like to stop the container? In this case you should talk to the docker control socket.

But I would do this from outside the container using something like a health-check or something similar.

mm3906078 commented 2 years ago

Hi guys I have the same problem and don't think form outside container is good enough. Adding health checks in production requires another dependency to kill or restart the container. It's going to mess up our production env

tippexs commented 1 year ago

Sorry for my late response. I am still not sure if I understand you correctly. Can you try to describe a use case including some examples what do you need from Unit to make it work?

amne commented 11 months ago

I know this is 1+year-old and I'm not adding anything but I am curious how are you shutting down the container? What kind of sorcery allows you to control the container's lifecycle from inside the container itself?

lcrilly commented 11 months ago

I guess you could write an application that does kill 1 from within the container 🤷