I am looking at using gunicorn to serve uwsgi unix sock to nginx.
I need nginx service to "require" gunicorn service be running.
Or Generally: I need Service A to run Service B. --> B "requires" A
Does this exist in runit?
Not really, despite being popular, runit is the weakest init we offer in terms of features.
It does not have builtin dependency handling, which I find annoying.
You could add sv start gunicorn || exit 1 as the second line (i.e. after #!/bin/sh and before exec nginx) of nginx's run file, so starting nginx also starts gunicorn. That's the closest thing runit has to dependency handling.
Adding a conf script for nginx-runit would be nice for this use case.
If you don't want your nginx service to fail and restart until gunicorn is ready (I don't know how fast it starts) you should also provide a good check file so that the
sv start[\tt] also actually waits for the service to be ready.
Actually we could craft some dependency and configuration management facility in kind of a standard way for all the services, will try to do something.
You're spoiling our users...