From 9afe26294260704e95fe0d956f9c3bd1ae2549a7 Mon Sep 17 00:00:00 2001 From: macournoyer Date: Fri, 31 Jan 2014 16:09:35 -0500 Subject: [PATCH] Improve bluepill sample config. Add stop_command to use `thin stop`. Fix stdout & stderr being redirected to the wrong log file. Rename PID file name to use a dash (like the log file). --- config/discourse.pill.sample | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/config/discourse.pill.sample b/config/discourse.pill.sample index 18e70a52e6a..fdf9c24f7d3 100644 --- a/config/discourse.pill.sample +++ b/config/discourse.pill.sample @@ -58,22 +58,28 @@ Bluepill.application("discourse", :base_dir => ENV["HOME"] + '/.bluepill') do |a # Discourse is set to use Thin as its WebServer, here is its running scripts. num_webs.times do |i| app.process("thin-#{i}") do |process| - process.start_command = "bundle exec thin start -e production -t 0 --socket #{sockdir}/thin.#{i}.sock --pid #{rails_root}/tmp/pids/thin#{i}.pid --log #{rails_root}/log/thin-#{i}.log --daemonize" + process.start_command = "bundle exec thin start -e production -t 0 --socket #{sockdir}/thin.#{i}.sock --pid #{rails_root}/tmp/pids/thin-#{i}.pid --log #{rails_root}/log/thin-#{i}.log --daemonize" + + process.stop_command = "bundle exec thin stop --pid #{rails_root}/tmp/pids/thin-#{i}.pid" # Alternatively, you can start with a port number instead of a socket. If you do that, then you MUST update # the upstream section in the nginx config to match. # The nginx.sample.conf file assumes you're using sockets. - # process.start_command = "bundle exec thin start -e production -t 0 -p #{9040 + i} -P #{rails_root}/tmp/pids/thin#{i}.pid -d" + # process.start_command = "bundle exec thin start -e production -t 0 -p #{9040 + i} -P #{rails_root}/tmp/pids/thin-#{i}.pid -d" + + process.pid_file = "#{rails_root}/tmp/pids/thin-#{i}.pid" - process.pid_file = "#{rails_root}/tmp/pids/thin#{i}.pid" process.start_grace_time = 30.seconds - process.stop_grace_time = 10.seconds + process.stop_grace_time = 30.seconds process.restart_grace_time = 10.seconds + process.group = "thins" process.uid = user process.gid = group + process.daemonize = false - process.stdout = process.stderr = "#{rails_root}/log/thin#{i}.log" + process.stdout = process.stderr = "#{rails_root}/log/thin-#{i}.log" + # Thanks to: http://www.garrensmith.com/2012/09/24/Staying-up-with-Unicorn-Upstart-Bluepill.html # If the amount of memory is exceeded 3 times out of 5, restart process.checks :mem_usage, :every => 1.minutes, :below => 750.megabytes, :times => [3, 5]