forked from rubber/rubber
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use upstart for resque web and worker pool
- Loading branch information
Matt Conway
committed
Jan 27, 2012
1 parent
c2b5c23
commit 5836d63
Showing
7 changed files
with
99 additions
and
84 deletions.
There are no files selected for viewing
12 changes: 4 additions & 8 deletions
12
templates/monit/config/rubber/role/resque_web/monit-resque_web.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
<% | ||
@path = '/etc/monit/monit.d/monit-resque_web.conf' | ||
|
||
pidfile = "#{Rubber.root}/tmp/pids/resque_web.pid" | ||
start_program = "HOME=/root resque-web --pid-file #{pidfile} --port #{rubber_env.resque_web_port} --no-launch #{Rubber.root}/config/initializers/resque.rb" | ||
stop_program = "HOME=/root resque-web --pid-file #{pidfile} --kill" | ||
%> | ||
|
||
check process resque_web with pidfile <%= pidfile %> | ||
group resque_web | ||
start program = "/bin/bash -l -c '<%= start_program %>'" | ||
stop program = "/bin/bash -l -c '<%= stop_program %>'" | ||
check process resque_web with pidfile <%= rubber_env.resque_web_pid_file %> | ||
group resque-<%= Rubber.env %> | ||
start program = "/usr/bin/env service resque-web start" | ||
stop program = "/usr/bin/env service resque-web stop" | ||
|
||
if totalmem > 350.0 MB for 15 cycles then restart |
8 changes: 8 additions & 0 deletions
8
templates/monit/config/rubber/role/resque_worker/monit-resque_pool.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<% | ||
@path = '/etc/monit/monit.d/monit-resque_pool.conf' | ||
%> | ||
|
||
check process resque_pool with pidfile <%= rubber_env.resque_pool_pid_file %> | ||
group resque-<%= Rubber.env %> | ||
start program = "/usr/bin/env service resque-pool start" | ||
stop program = "/usr/bin/env service resque-pool stop" |
13 changes: 0 additions & 13 deletions
13
templates/monit/config/rubber/role/resque_worker/monit-resque_worker.conf
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
templates/resque/config/rubber/role/resque_web/resque-web-upstart.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<% | ||
@path = "/etc/init/resque-web.conf" | ||
@backup = false | ||
%> | ||
description "resque web server" | ||
|
||
start on started redis | ||
stop on runlevel [016] | ||
|
||
script | ||
exec sudo -u <%= rubber_env.app_user %> /bin/bash -l -c 'cd <%= Rubber.root %> && exec bundle exec resque-web --foreground --port <%= rubber_env.resque_web_port %> --no-launch --app-dir tmp/resque_web config/initializers/resque.rb > log/resque-web.log 2>&1 < /dev/null' | ||
end script | ||
|
||
post-start script | ||
status resque-web | head -n1 | awk '{print $NF}' > <%= rubber_env.resque_web_pid_file %> | ||
end script | ||
|
||
post-stop script | ||
rm -f <%= rubber_env.resque_web_pid_file %> | ||
end script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters