diff --git a/cookbooks/rubygems-app/recipes/logrotate.rb b/cookbooks/rubygems-app/recipes/logrotate.rb index 34f7559..ef0083e 100644 --- a/cookbooks/rubygems-app/recipes/logrotate.rb +++ b/cookbooks/rubygems-app/recipes/logrotate.rb @@ -11,6 +11,7 @@ options %w(missingok nocreate compress delaycompress dateext notifempty sharedscripts) postrotate [ ' [ -f /etc/service/unicorn/supervise/pid ] && kill -USR1 `cat /etc/service/unicorn/supervise/pid`', - ' [ -f /etc/service/delayed_job/supervise/pid ] && kill -USR1 `cat /etc/service/delayed_job/supervise/pid`' + ' [ -f /etc/service/delayed_job/supervise/pid ] && kill -USR1 `cat /etc/service/delayed_job/supervise/pid`', + ' [ -f /etc/service/shoryuken/supervise/pid ] && kill -USR1 `cat /etc/service/shoryuken/supervise/pid`' ] end diff --git a/cookbooks/rubygems-app/recipes/shoryuken.rb b/cookbooks/rubygems-app/recipes/shoryuken.rb new file mode 100644 index 0000000..225f4ea --- /dev/null +++ b/cookbooks/rubygems-app/recipes/shoryuken.rb @@ -0,0 +1,30 @@ +# +# Cookbook Name:: rubygems-app +# Recipe:: shoryuken +# + +runit_service 'shoryuken' do + owner 'deploy' + group 'deploy' + default_logger true + env( + 'RAILS_ENV' => node.chef_environment + ) + options( + owner: 'deploy', + group: 'deploy', + bundle_command: '/usr/local/bin/bundle', + rails_env: node.chef_environment + ) + action ::File.exist?('/applications/rubygems/current') ? :enable : :disable +end + +sudo 'deploy-shoryuken' do + user 'deploy' + commands [ + '/etc/init.d/shoryuken *', + '/usr/sbin/service shoryuken *', + '/usr/bin/sv -w * shoryuken' + ] + nopasswd true +end diff --git a/cookbooks/rubygems-app/templates/default/sv-shoryuken-run.erb b/cookbooks/rubygems-app/templates/default/sv-shoryuken-run.erb new file mode 100644 index 0000000..470098a --- /dev/null +++ b/cookbooks/rubygems-app/templates/default/sv-shoryuken-run.erb @@ -0,0 +1,10 @@ +#!/bin/bash + +cd /applications/rubygems/current + +exec 2>&1 +exec <%= node['runit']['chpst_bin'] %> \ + -u <%= @options[:owner] %>:<%= @options[:group] %> \ + -e <%= node['runit']['sv_dir'] %>/shoryuken/env \ + <%= @options[:bundle_command] %> exec \ + script/shoryuken