独角兽刷新Gem列表
Unicorn Refreshing Gem List
伙计们,我正在尝试重新启动我的 unicorn 服务,但它似乎卡在了这里
[2019-03-06T20:45:05.938802 #7614] INFO -- : Refreshing Gem list
/usr/local/rvm/gems/ruby-2.5.1@citius_artis/gems/unicorn-5.5.0/lib/unicorn.rb:49:in
`block in builder': wrong number of arguments (given 0, expected 2)
(ArgumentError)
未对 gemfile 进行任何更改
如果我 运行 rails s -e staging rails 正常启动
有什么想法吗?
我的unicorn.rb配置
APP_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__)))
# puts "APP ROOT ->>> #{APP_ROOT}"
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
# puts "RUBY HOME ->>> #{rvm_path}"
rvm_lib_path = File.join(rvm_path, 'lib')
# $LOAD_PATH.unshift rvm_lib_path
# require 'rvm'
# RVM.use_from_path! APP_ROOT
rescue LoadError
raise "RVM ruby lib is currently unavailable."
end
end
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'
if ENV['RAILS_ENV'] == 'production'
worker_processes 2
else
worker_processes 2
end
working_directory APP_ROOT
preload_app true
timeout 60
listen APP_ROOT + "/tmp/sockets/unicorn.sock", :backlog => 64
pid APP_ROOT + "/tmp/pids/unicorn.pid"
stderr_path APP_ROOT + "/log/unicorn.stderr.log"
stdout_path APP_ROOT + "/log/unicorn.stdout.log"
before_fork do |server, worker|
# puts "SERVER ->>> #{server}"
defined?(ActiveRecord::Base) && ActiveRecord::Base.connection.disconnect!
old_pid = APP_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
# puts "Old master alerady dead"
end
end
end
after_fork do |server, worker|
if defined?(ActiveRecord::Base)
config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env]
config['pool'] = ENV["DB_POOL"] || ENV['RAILS_MAX_THREADS'] || 5
ActiveRecord::Base.establish_connection(config)
end
end
我遇到了同样的问题,按照 John Smith 的建议这对我有用:
bundle exec gem list | grep unicorn # returns unicorn (5.5.0)
将 Gemfile 更改为 gem 'unicorn'、'5.4.1'
bundle install
bundle exec gem list | grep unicorn # returns unicorn (5.4.1)
然后我就可以无误地重启 unicorn
看起来 5.5.0 中引入了一个错误
https://bogomips.org/unicorn-public/20190307022859.mxz7m3mbspujo4c2@dcvr/
我测试了他的补丁版本并且有效:
在 Gemfile 中设置独角兽版本
gem "unicorn", "~> 5.5.0.1.g6836"
和运行bundle update unicorn
伙计们,我正在尝试重新启动我的 unicorn 服务,但它似乎卡在了这里
[2019-03-06T20:45:05.938802 #7614] INFO -- : Refreshing Gem list
/usr/local/rvm/gems/ruby-2.5.1@citius_artis/gems/unicorn-5.5.0/lib/unicorn.rb:49:in
`block in builder': wrong number of arguments (given 0, expected 2) (ArgumentError)
未对 gemfile 进行任何更改
如果我 运行 rails s -e staging rails 正常启动
有什么想法吗?
我的unicorn.rb配置
APP_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__)))
# puts "APP ROOT ->>> #{APP_ROOT}"
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
# puts "RUBY HOME ->>> #{rvm_path}"
rvm_lib_path = File.join(rvm_path, 'lib')
# $LOAD_PATH.unshift rvm_lib_path
# require 'rvm'
# RVM.use_from_path! APP_ROOT
rescue LoadError
raise "RVM ruby lib is currently unavailable."
end
end
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'
if ENV['RAILS_ENV'] == 'production'
worker_processes 2
else
worker_processes 2
end
working_directory APP_ROOT
preload_app true
timeout 60
listen APP_ROOT + "/tmp/sockets/unicorn.sock", :backlog => 64
pid APP_ROOT + "/tmp/pids/unicorn.pid"
stderr_path APP_ROOT + "/log/unicorn.stderr.log"
stdout_path APP_ROOT + "/log/unicorn.stdout.log"
before_fork do |server, worker|
# puts "SERVER ->>> #{server}"
defined?(ActiveRecord::Base) && ActiveRecord::Base.connection.disconnect!
old_pid = APP_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
# puts "Old master alerady dead"
end
end
end
after_fork do |server, worker|
if defined?(ActiveRecord::Base)
config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env]
config['pool'] = ENV["DB_POOL"] || ENV['RAILS_MAX_THREADS'] || 5
ActiveRecord::Base.establish_connection(config)
end
end
我遇到了同样的问题,按照 John Smith 的建议这对我有用:
bundle exec gem list | grep unicorn # returns unicorn (5.5.0)
将 Gemfile 更改为 gem 'unicorn'、'5.4.1'
bundle install
bundle exec gem list | grep unicorn # returns unicorn (5.4.1)
然后我就可以无误地重启 unicorn
看起来 5.5.0 中引入了一个错误 https://bogomips.org/unicorn-public/20190307022859.mxz7m3mbspujo4c2@dcvr/
我测试了他的补丁版本并且有效:
在 Gemfile 中设置独角兽版本
gem "unicorn", "~> 5.5.0.1.g6836"
和运行bundle update unicorn