5

我正在尝试使用 Capistrano 部署带有 puma 的 Rails 应用程序。在部署结束时,它会尝试运行

bundle exec pumactl -S /home/deployer/production/shared/sockets/puma.state restart

失败/

undefined method `has_key?' for false:FalseClass. 

我只是为puma.state. 我的问题是这个文件到底是什么,里面应该有什么?

4

1 回答 1

9

Puma 有一个状态文件,记录了进程的 PID。如果您是第一次部署,您应该删除 .state 文件,然后执行

cap deploy:cold

或者,您可以使用类似的东西手动启动 puma

cap puma:start

这将启动该过程并创建一个有效的状态文件。这是我在 capistrano 中的 puma start 命令:

namespace :puma do

  desc "Start the application"
  task :start, :roles => :app, :except => { :no_release => true } do
    run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec puma -t 8:32 -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{rails_env}.log 2>&1 &", :pty => false
  end
  after "deploy:start", "puma:start"
end
于 2012-10-24T14:10:04.647 回答