arya (owner)

Revisions

gist: 223195 Download_button fork
public
Public Clone URL: git://gist.github.com/223195.git
Embed All Files: show embed
production.pill #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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