- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
由于 unicorn_rails 提示不同的 gem 版本,我们转而在 bluepill 文件中运行 bundle exec unicorn_rails... 。此更改解决了该特定问题,并且事情开始和停止,但是当我们尝试 sudo bluepill status 时,我们现在得到
unicorn (像素:XXXXXX):不受监控
看起来 bluepill 现在没有监控 unicorn 进程。如果我停止子进程,它将重新启动子进程,但不会重新启动父进程。
我四处搜寻,但找不到太多关于这个问题的信息,希望有人能对此有所了解。 bluepill 配置文件是
app_dir = "/opt/local/share/httpd/apps/xyz"
Bluepill.application('xyz', :log_file => "#{app_dir}/current/log/bluepill.log") do |app|
app.process('unicorn') do |process|
process.pid_file = "#{app_dir}/shared/pids/unicorn.pid"
process.working_dir = "#{app_dir}/current"
process.stdout = process.stderr = "#{app_dir}/shared/log/unicorn.err.log"
process.start_command = "bundle exec unicorn_rails -D -c #{app_dir}/current/config/environments/production/unicorn.rb -E production"
process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}"
process.start_grace_time = 8.seconds
process.stop_grace_time = 5.seconds
process.restart_grace_time = 13.seconds
process.monitor_children do |child_process|
child_process.stop_command = "kill -QUIT {{PID}}"
child_process.checks :mem_usage, :every => 10.seconds, :below => 200.megabytes, :times => [3,5]
child_process.checks :cpu_usage, :every => 10.seconds, :below => 50, :times => [3,5]
end
end
end
最佳答案
当您运行 bundle exec
时,它会设置一个环境并 fork unicorn_rails
进程。 Bluepill 最终监视原始 bundle exec
进程而不是 unicorn,这就是您看到不受监视的原因。
我直接在bluepill中设置我的 bundler 环境,然后直接执行unicorn_rails
:
Bluepill.application('xyz') do |app|
app.environment = `env -i BUNDLE_GEMFILE=#{app_dir}/Gemfile bundle exec env`.lines.inject({}) do |env_hash,l|
kv = l.chomp.split('=',2)
env_hash[kv[0] = kv[1]
env_hash
end
app.process('unicorn') do |process|
process.start_command = "unicorn_rails -D -c #{app_dir}/current/config/environments/production/unicorn.rb -E production"
end
end
(注意:为了清楚起见,我省略了上述配置文件的一部分。您的配置文件看起来不错,只需尝试添加上面的 app.environment
内容并删除 bundle exec
来自您的启动命令。)
这通过使用反引号捕获 bundler 环境变量、将返回的字符串解析为散列并将其分配给 app.environment
来设置 bluepill 中的环境。
关于bundler - 使用 bluepill 监控 bundle 执行 unicorn_rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6221888/
我有 bluepill 设置来监控我的 delayed_job 进程。 使用 Ubuntu 12.04。 我正在使用 Ubuntu 的 upstart 启动和监控 bluepill 服务本身。我的 U
假设这是我的 worker : class FooWorker @queue = :foo def self.perform User.all.each do |u| ..
我正在尝试创建一个自定义守护进程以每 60 秒运行一次并使用 bluepill 启动/停止和监控它。 谁能告诉我如何更轻松地做到这一点,或者你能告诉我我做错了什么吗? 目前 bluepill 正在启动
我有一个蓝色药丸,我想使用 TinyGo 对其进行编程但是 Blue Pill 没有(明显的)硬件编程方式。所以,我买了一个 STLINK-V3MINI希望用JTAG/SWD来编程。我不确定如何将两者
由于 unicorn_rails 提示不同的 gem 版本,我们转而在 bluepill 文件中运行 bundle exec unicorn_rails... 。此更改解决了该特定问题,并且事情开始和
我一直使用 bluepill成功地守护简单的 Ruby 脚本。然而这一次,我有一个脚本,它也在加载 Rails 环境,因此我可以访问 Rails 应用程序及其各自模型的数据库连接。我使用的 bluep
我是一名优秀的程序员,十分优秀!