Ruby on rails 用上帝监视独角兽;“神木独角兽”被卡住了

Ruby on rails 用上帝监视独角兽;“神木独角兽”被卡住了,ruby-on-rails,ruby,unicorn,god,Ruby On Rails,Ruby,Unicorn,God,我在CentOS 6.5上运行god来监视unicorn,unicorn正与nginx一起用于部署ruby on rails应用程序。我可以启动上帝和独角兽没有问题,但当我运行命令 god log unicorn 我收到通知,请稍候。。。但之后什么也没发生。我等了大约一个小时,什么事也没发生。有人知道这是什么原因吗?我试着在谷歌上搜索,结果一无所获。我的上帝配置文件直接取自。我说到了告诉你试试神木独角兽的那部分。这是基于链接中的unicorn.god文件。有点不同 rails_root = F

我在CentOS 6.5上运行god来监视unicorn,unicorn正与nginx一起用于部署ruby on rails应用程序。我可以启动上帝和独角兽没有问题,但当我运行命令

god log unicorn
我收到通知,请稍候。。。但之后什么也没发生。我等了大约一个小时,什么事也没发生。有人知道这是什么原因吗?我试着在谷歌上搜索,结果一无所获。我的上帝配置文件直接取自。我说到了告诉你试试神木独角兽的那部分。这是基于链接中的unicorn.god文件。有点不同

rails_root = File.dirname("/home/username/myApp")

God.watch do |w|
  pid_file = File.join(rails_root, "myApp/pids/unicorn.pid")

  w.name = "unicorn"
  w.interval = 60.seconds
  w.start = "unicorn -c #{rails_root}/myApp/config/unicorn.rb -D"
  w.stop = "kill -s QUIT $(cat #{pid_file})"
  w.restart = "kill -s HUP $(cat #{pid_file})"
  w.start_grace = 20.seconds
  w.restart_grace = 20.seconds
  w.pid_file = pid_file

  w.behavior(:clean_pid_file)

  # When to start?
  w.start_if do |start|
    start.condition(:process_running) do |c|
      # We want to check if deamon is running every ten seconds
      # and start it if itsn't running
      c.interval = 10.seconds
      c.running = false
    end
  end

  # When to restart a running deamon?
  w.restart_if do |restart|
    restart.condition(:memory_usage) do |c|
      # Pick five memory usage at different times
      # if three of them are above memory limit (100Mb)
      # then we restart the deamon
      c.above = 100.megabytes
      c.times = [3, 5]
    end

    restart.condition(:cpu_usage) do |c|
      # Restart deamon if cpu usage goes
      # above 90% at least five times
      c.above = 90.percent
      c.times = 5
    end
  end

  w.lifecycle do |on|
    # Handle edge cases where deamon
    # can't start for some reason
    on.condition(:flapping) do |c|
      c.to_state = [:start, :restart] # If God tries to start or restart
      c.times = 5                     # five times
      c.within = 5.minute             # within five minutes
      c.transition = :unmonitored     # we want to stop monitoring
      c.retry_in = 10.minutes         # for 10 minutes and monitor again
      c.retry_times = 5               # we'll loop over this five times
      c.retry_within = 2.hours        # and give up if flapping occured five times in two hours
    end
  end
end