crank - restart your processes, slowly
crank
[opts]
Crank's main goal is to handle restarts for servers who handle long-lived TCP socket connections. Traditional process managers tend to be rather brusque and kill the server. We want to be able to let the client an opportunity to reconnect somewhere else. We also want to load the new version and wait until it tells us it's ready and thus proove it's working before shutting down the old process.
Because crank
exits when all the child processes are gone, you should run it
under a system-level supervisor like upstart or systemd that handles restarts.
Processes run under crank needs to be adapted to benefit from all the features than crank provides. See the "PROCESS SIDE" section for more details.
Note that valid addr, conf and sock values are necessary for crank to run.
-bind
net-uri-conf
config-file-ctl
net-uricrankctl
command-line.-prefix
path/var/crank
.-name
process-name-conf
and -ctl
arguments to
a $prefix/$name.$type
default (unless those are also passed).net-uri format: an address can be of the following forms:
<path>
(no : character allowed)[host]:<port>
fd://<fd_num>
tcp[46]://[host]:<port>
unix[packet]://<path>
A process is responsible to start and stop gracefully.
If the process sees a LISTENFDS environment variable it is supposed to use fd:3 as the accepting socket instead of binding it's own. Note that we don't use the systemd LISTENPID because of go's fork/exec limitation.
If the process sees a NOTIFY_FD environment variable it is supposed to send a "READY=1" datagram on it once it's ready to accept new client connection.
If the process receives a SIGTERM signal it is supposed to stop accepting new connections and stop gracefully or not the existing ones. Crank will forcefully terminate the process after a configured period.
CRANK_BIND
, CRANK_CONF
, CRANK_CTL
, CRANK_NAME
The config file contains the serialization of config of the last successfully-started process. In that sense it should not belong in /etc.
Report bugs and ideas on the github project's issue tracker. https://github.com/pusher/crank/issues/
Martyn Loughran martyn@mloughran.com zimbatm zimbatm@zimbatm.com Paweł Ledwoń pawel@pusher.com