In a little test project of min I manage rails deployment by using a combination
of capistrano, upstart and foreman. This
means as soon as I run
$ cap deploy
foreman is exporting the current Procfile to upstart scripts and copies those
to the correct locations for deployment on my ubuntu server, to restart the app
after the deployment capistrano now runs
$ service APPNAME restart
This works perfectly fine as long as all services restart nicely, but I ran into
a problem while setting up faye to allow push in the
app. Now since there is a connection between thin (my appserver) and faye, thin
will not shutdown gracefully as soon as upstart tells it to, which in turn means
faye will not shut down as well… ok so my app server will take a lot of time
to restart which is not that nice. To get rid of this problem I created a small
rake task to shut down the thin servers before the restart phase, this fixes the
“deadlock” (not really a deadlock I know but oh well). So here it is