我在想是否可能在Heroku上实现零停机部署策略。我发现在当前的Heroku文档中,当推送一个应用程序时,需要大约1分钟才能重新加载应用程序,这使其无法使用。他们文档中的独角兽代码确实预加载了应用程序,所以我很困惑为什么会出现这种情况。我能在我的端上做些什么吗?
这是我的unicorn.rb初始化程序:
https://devcenter.heroku.com/articles/rails-unicorn
我有新的遗物插件以及弹性搜索的盆景。这是我的unicorn.rb初始化程序:
# config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end