独角兽挂着说清爽的宝石

Kri*_*rma 10 configuration staging setup-deployment unicorn ruby-on-rails-3

我从乘客那里迁移到独角兽之后,在舞台上遇到了一个奇怪的问题.

我为开发和登台环境配置了独角兽.它在开发中工作但不在分期中工作.在开发过程中,它会监听8080,就像在分段监听unix套接字一样.会有什么不同吗?特别是在生产中有点环境?

当我在分段中运行它时会发生这种情况

  1. 启动时几乎需要100%的CPU
  2. 有时它会安定下来,我可以使用它
  3. *但大部分时间它都会挂起**我不得不杀了它.

我已经记录了有关此问题的问题,请点击此处

这是我在unicorn.stderr.log中看到的

I, [2011-08-26T09:02:53.324286 #5026]  INFO -- : unlinking existing socket=/home/krishnaprasad/project_name/tmp/sockets/unicorn.sock
I, [2011-08-26T09:02:53.324502 #5026]  INFO -- : listening on addr=/home/krishnaprasad/project_name/tmp/sockets/unicorn.sock fd=3
I, [2011-08-26T09:02:53.324860 #5026]  INFO -- : Refreshing Gem list
Run Code Online (Sandbox Code Playgroud)

为什么要尝试刷新宝石?有没有办法在配置文件中避免它?

这就是我在config/unicorn_staging.rb中所拥有的

# unicorn_rails -c /config/unicorn_staging.rb -E staging -D

rails_env = 'staging'

working_directory "/home/krishnaprasad/Projects/project_name"
worker_processes 1
preload_app true
timeout 90

rails_root = "/home/krishnaprasad/Projects/project_name"
listen "#{rails_root}/tmp/sockets/unicorn.sock", :backlog => 2048

pid "#{rails_root}/tmp/pids/unicorn.pid"
stderr_path "#{rails_root}/log/unicorn.log"
stdout_path "#{rails_root}/log/unicorn.log"

GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)

before_fork do |server, worker|
  ActiveRecord::Base.connection.disconnect!
  old_pid = "#{Rails.root}/tmp/pids/unicorn.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
      # someone else did our job for us
    end
  end
end

after_fork do |server, worker|
  ActiveRecord::Base.establish_connection
end
Run Code Online (Sandbox Code Playgroud)

任何帮助高度赞赏.提前致谢

mml*_*lac 0

确保您的代码没有语法错误!

对我来说,修复语法错误(在我的一个控制器中)结束了循环并正确启动了 Unicorn。我在 Unicorn 中没有收到任何错误消息,您可能想尝试开始使用 WebRat 并查看是否弹出错误。