When deploying with Capistrano and use it to start the puma server you just include require 'puma/capistrano'
and it does the magic when using cap deploy
etc.
But how do i configure the puma server? I mean, let's say I want to change how many workers, cluster mode etc.
Solution: Found this in 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
So I guess I can just put a config file in that directory and it will work.
/config/puma/production.rb
Solution: Found this in 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
Just add the options in this file, if it's production, otherwise change the file name to appropriate environment.
/config/puma/production.rb