Skip to content

Commit

Permalink
Add recipe to run script/shoryuken
Browse files Browse the repository at this point in the history
Copied from the delayed_job recipe.

We want to run shoryuken as part of #35
  • Loading branch information
ktheory committed Jan 15, 2016
1 parent 2a09f85 commit 6ec0ce0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cookbooks/rubygems-app/recipes/logrotate.rb
Expand Up @@ -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
30 changes: 30 additions & 0 deletions 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
10 changes: 10 additions & 0 deletions 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

0 comments on commit 6ec0ce0

Please sign in to comment.