使用 Capistrano 更改客运港口

Change Passenger Port using Capistrano

我尝试使用 capistrano-rails gem 在生产中部署我的应用程序。不幸的是,乘客的标准端口是 3000,我无法使用。

我需要如何更改我的 deploy.rb 文件,以便我可以在部署后使用不同的端口启动 passenger?

感谢您的支持!

以下不会改变任何内容:

set :passenger_restart_with_touch, true
set :passenger_port, 10666

set :passenger_roles, :app
set :passenger_restart_runner, :sequence
set :passenger_restart_wait, 5
set :passenger_restart_limit, 2
set :passenger_restart_with_sudo, false
set :passenger_environment_variables, {}
set :passenger_restart_command, 'passenger-config restart-app'
set :passenger_restart_options, -> { "#{deploy_to} --ignore-app-not-running" }

namespace :deploy do

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      # Here we can do anything such as:
      # within release_path do
      #   execute :rake, 'cache:clear'
      # end
    end
  end

end

根据 Passenger documentation,可以在 Rails 根目录中创建 Passengerfile.json,端口值为:

{
  "port": 10666,
}