在 unicorn 上跑是正常的。rainbows 延用 unicorn 的配置,加上
worker_processes 4
Rainbows! do
use :FiberSpawn
worker_connections 20
end
rainbows.rb 的完整配置如下:
# -*- encoding: utf-8 -*-
module Rails
class <<self
def root
File.expand_path(__FILE__).split('/')[0..-3].join('/')
end
end
end
rails_env = ENV["RAILS_ENV"] || "production"
worker_processes 4 # assuming four CPU cores
Rainbows! do
use :FiberSpawn
worker_connections 8
end
preload_app true
working_directory Rails.root
pid "/tmp/rainbows.pid"
stderr_path "/tmp/log/rainbows.log"
stdout_path "/tmp/log/rainbows.log"
listen 3001, :tcp_nopush => false
listen "/tmp/rainbows.xrk_crm.sock", backlog: 1024
#worker_processes 8
timeout 30
if GC.respond_to?(:copy_on_write_friendly=)
GC.copy_on_write_friendly = true
end
before_exec do |server|
ENV["BUNDLE_GEMFILE"] = "#{Rails.root}/Gemfile"
end
before_fork do |server, worker|
old_pid = "#{Rails.root}/tmp/pids/rainbows.pid.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
puts "Send 'QUIT' signal to rainbows error!"
end
end
end
启动命令: bundle exec rainbows -c config/rainbows.rb -E staging -D
进程是启动了。但访问的时候出现“ActionView::Template::Error (stack level too deep): /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:104”
这是怎么回事呢