Skip to content

Instantly share code, notes, and snippets.

@arya
Created October 31, 2009 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save arya/223195 to your computer and use it in GitHub Desktop.
Save arya/223195 to your computer and use it in GitHub Desktop.
env_vars = "RAILS_ENV=production PATH=/sb/thehierarchy/ruby/bin:/sb/thehierarchye/nginx/sbin:$PATH RUBY_HEAP_MIN_SLOTS=500000 RUBY_HEAP_SLOTS_INCREMENT=250000 RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 RUBY_GC_MALLOC_LIMIT=50000000"
RAILS_ROOT = "/var/www/apps/thehierarchy/current/"
Bluepill.application("thehierarchy") do |app|
app.process("scheduled_notifications") do |process|
process.group = "thehierarchy"
process.pid_file = File.join(RAILS_ROOT, "tmp", "pids", "scheduled_notifications")
process.daemonize = true
process.start_command = "/usr/bin/env #{env_vars} rake --rakefile=#{RAILS_ROOT}/Rakefile app_name:scheduled_notifications"
process.checks :mem_usage, :every => 10.seconds, :below => 150.megabytes, :times => [5,7]
process.checks :cpu_usage, :every => 10.seconds, :below => 10, :times => [9,10]
process.checks :flapping, :times => 5, :within => 1.minute, :retry_in => 10.minutes
end
app.process("background_worker") do |process|
process.group = "thehierarchy"
process.pid_file = File.join(RAILS_ROOT, "tmp", "pids", "background_worker")
process.daemonize = true
process.start_command = "/usr/bin/env #{env_vars} rake --rakefile=#{RAILS_ROOT}/Rakefile thehierarchy:background_worker"
process.checks :mem_usage, :every => 10.seconds, :below => 150.megabytes, :times => [5,7]
process.checks :cpu_usage, :every => 10.seconds, :below => 10, :times => [9,10]
process.checks :flapping, :times => 5, :within => 1.minute, :retry_in => 10.minutes
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment