Capistrano & supervisord

The following checks if the supervisor ‘service’ config file exists, and if not, adds it and notifies supervisord that there’s a new service to load in.

After that, the supervisor service is restarted.

task :restart_supervisord, :roles => :web do
   run "if [ ! -f /etc/supervisor/conf.d/microservice-abc.conf ]; then #{sudo} ln -s #{latest_release}/supervisord.conf /etc/supervisor/conf.d/microservice-abc.conf && #{sudo} supervisorctl reread && #{sudo} supervisorctl update ; fi"
   run "#{sudo} supervisorctl restart microservice-abc:"

Leave a Reply