aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrhenium <rhenium@rhe.jp>2014-05-16 22:25:02 +0900
committerrhenium <rhenium@rhe.jp>2014-05-16 22:25:02 +0900
commit3d7a0b01f2687eca12731b3ce5bbb98ed8769c4c (patch)
tree26293b7ac19b24d4a2e55fee87ac8b9554254c84 /lib
parentee8b42e391516341aea4386a67b7544212e373cc (diff)
downloadaclog-3d7a0b01f2687eca12731b3ce5bbb98ed8769c4c.tar.gz
web: switch back to Unicorn
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/web.rake24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/tasks/web.rake b/lib/tasks/web.rake
index db5319e..78db4f2 100644
--- a/lib/tasks/web.rake
+++ b/lib/tasks/web.rake
@@ -1,5 +1,5 @@
namespace :web do
- @web_pid_file = Rails.root.join("tmp", "pids", "puma.pid").to_s
+ @web_pid_file = Rails.root.join("tmp", "pids", "unicorn.pid").to_s
def web_read_pid
Integer(File.read(@web_pid_file)) rescue nil
@@ -9,48 +9,48 @@ namespace :web do
Process.kill(0, pid) rescue false
end
- desc "Start web server (puma)"
+ desc "Start web server (Unicorn)"
task :start do
pid = web_read_pid
if pid && process_alive?(pid)
- STDERR.puts "Puma is already started (PID: #{pid})"
+ STDERR.puts "Unicorn is already started (PID: #{pid})"
next
end
- puts `puma -d -e #{Rails.env} -C #{Rails.root}/config/puma.rb --pidfile #{@web_pid_file}`
+ puts `unicorn -D -E #{Rails.env} -c #{Rails.root}/config/unicorn.rb`
end
- desc "Stop web server (puma)"
+ desc "Stop web server (Unicorn)"
task :stop do
pid = web_read_pid
unless process_alive?(pid)
- STDERR.puts "Puma is not running."
+ STDERR.puts "Unicorn is not running."
next
end
- Process.kill("TERM", pid)
+ Process.kill(:QUIT, pid)
while process_alive?(pid)
sleep 0.1
end
end
- desc "Retart web server (puma)"
+ desc "Retart web server (Unicorn)"
task :restart do
pid = web_read_pid
unless process_alive?(pid)
- STDERR.puts "Puma is not running."
+ STDERR.puts "Unicorn is not running."
Rake::Task["web:start"].invoke
end
Process.kill("USR2", pid)
end
- desc "Show status of web server (puma)"
+ desc "Show status of web server (Unicorn)"
task :status do
pid = web_read_pid
if pid && process_alive?(pid)
- STDOUT.puts "Puma is running."
+ STDOUT.puts "Unicorn is running."
else
- STDOUT.puts "Puma is not running."
+ STDOUT.puts "Unicorn is not running."
end
end
end