Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
Peter Bourgon b4b2c78530 circle.yml: RM becomes RMCONTAINER 9 lat temu
example Review feedback 9 lat temu
zombietest Review feedback 9 lat temu
.gitignore Working test 9 lat temu
LICENSE Initial commit 9 lat temu
README.md Review feedback 9 lat temu
circle.yml circle.yml: RM becomes RMCONTAINER 9 lat temu
main.go Review feedback 9 lat temu

README.md

runsvinit Circle CI

If you have a Docker container that's a collection of runit-supervised daemons, this process is suitable for use as the ENTRYPOINT. See the example.

Why not use runit(8) directly?

runit(8) is designed to be used as process 1. And, if you provide an /etc/service/ctrlaltdel script, it will be executed when runit receives the INT signal. So, we could use that hook to gracefully terminate our services. But Docker only sends TERM on docker stop.

Note that the container stop signal will become configurable in Docker 1.9. Once Docker 1.9 ships, this utility will be obsolete.

Why not just exec runsvdir(8) directly?

If runsvdir(8) receives a signal, it doesn't wait for its supervised processes to exit before returning.

Why not wrap runsvdir(8) in a simple shell script?

Process 1 has the additional responsibility of reaping orphaned child processes. To the best of my knowledge, there is no sane way to do this with a shell script. Otherwise, indeed, this would work great:

#!/bin/sh

sv_stop() {
	for s in $(ls -d /etc/service/*)
	do
		/sbin/sv stop $s
	done
}

trap "sv_stop; exit" SIGTERM
/sbin/runsvdir /etc/service &
wait

Why not use my_init from phusion/baseimage-docker?

my_init depends on Python 3, which might be a big dependency for such a small responsibility.

So this is just a stripped-down my_init in Go?

Basically, yes.