【问题标题】:Capistrano & Puma, configurationCapistrano & Puma,配置
【发布时间】:2014-01-16 21:06:06
【问题描述】:

使用 Capistrano 部署并使用它来启动 puma 服务器时,您只需包含 require 'puma/capistrano',它在使用 cap deploy 等时会发挥作用。

但是我该如何配置 puma 服务器呢?我的意思是,假设我想更改工人数量、集群模式等。

解决方案:在 puma/capistrano.rb 中找到了这个

def config_file
    @_config_file ||= begin
      file = fetch(:puma_config_file, nil)
      file = "./config/puma/#{puma_env}.rb" if !file && File.exists?("./config/puma/#{puma_env}.rb")
      file
    end
  end

所以我想我可以在那个目录中放一个配置文件就可以了。

/config/puma/production.rb

【问题讨论】:

  • 请添加答案,因为您已经找到了解决方案

标签: ruby-on-rails nginx capistrano puma


【解决方案1】:

解决方案:在 puma/capistrano.rb 中找到这个

def config_file
    @_config_file ||= begin
      file = fetch(:puma_config_file, nil)
      file = "./config/puma/#{puma_env}.rb" if !file && File.exists?("./config/puma/#{puma_env}.rb")
      file
    end
  end

如果是生产,只需在此文件中添加选项,否则将文件名更改为适当的环境。

/config/puma/production.rb

【讨论】:

    猜你喜欢
    • 2016-07-19
    • 2020-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-07
    • 2016-06-20
    • 2021-07-20
    • 2023-03-03
    相关资源
    最近更新 更多