Skip to content

Instantly share code, notes, and snippets.

@allaire
Last active March 22, 2016 15:39
Show Gist options
  • Save allaire/5137526 to your computer and use it in GitHub Desktop.
Save allaire/5137526 to your computer and use it in GitHub Desktop.
Web app bluepill configuration file
ENV['RAILS_ENV'] = 'production'
web_path = '/home/deployer/apps/web/current'
Bluepill.application('web', :log_file => "#{web_path}/log/bluepill.log") do |app|
app.process('unicorn') do |process|
process.pid_file = "#{web_path}/tmp/pids/unicorn.pid"
process.working_dir = web_path
process.start_command = "/usr/local/bin/bundle exec unicorn -D -c #{web_path}/config/unicorn.rb -E #{ENV['RAILS_ENV']}"
process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}"
process.uid = 'deployer'
process.gid = 'admin'
process.start_grace_time = 30.seconds
process.stop_grace_time = 30.seconds
process.restart_grace_time = 30.seconds
process.monitor_children do |child_process|
child_process.stop_command = "kill -QUIT {{PID}}"
child_process.checks :mem_usage, :every => 30.seconds, :below => 200.megabytes, :times => [3,4], :fires => :stop
child_process.checks :cpu_usage, :every => 30.seconds, :below => 40, :times => [3,4], :fires => :stop
end
end
app.process('sidekiq') do |process|
process.pid_file = "#{web_path}/tmp/pids/sidekiq.pid"
process.working_dir = web_path
process.uid = 'deployer'
process.gid = 'admin'
process.start_command = "/usr/local/bin/bundle exec sidekiq -d -e #{ENV['RAILS_ENV']} -i 0 -P #{web_path}/tmp/pids/sidekiq.pid -L #{web_path}/log/sidekiq.log"
process.start_grace_time = 30.seconds
process.stop_grace_time = 30.seconds
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment