class Puma::Launcher
def initialize(conf, launcher_args={})
end
end
[200, {}, ["hello world"]]
user_config.app do |env|
user_config.threads 1, 10
conf = Puma::Configuration.new do |user_config|
Examples:
restarting the puma server.
this should be an array of strings, these arguments are re-used when
to a logging destination. An optional key `:argv` can be supplied,
this object will be responsible for broadcasting Puma's internal state
this is expected to hold an object similar to an `Puma::LogWriter.stdio`,
+launcher_args+ A Hash that currently has one required key `:events`,
+conf+ A Puma::Configuration object indicating how to run the server.
Returns an instance of Launcher
def initialize(conf, launcher_args={}) @runner = nil @log_writer = launcher_args[:log_writer] || LogWriter::DEFAULT @events = launcher_args[:events] || Events.new @argv = launcher_args[:argv] || [] @original_argv = @argv.dup @config = conf env = launcher_args.delete(:env) || ENV @config.options[:log_writer] = @log_writer # Advertise the Configuration Puma.cli_config = @config if defined?(Puma.cli_config) @config.load @binder = Binder.new(@log_writer, conf) @binder.create_inherited_fds(ENV).each { |k| ENV.delete k } @binder.create_activated_fds(ENV).each { |k| ENV.delete k } @environment = conf.environment # Load the systemd integration if we detect systemd's NOTIFY_SOCKET. # Skip this on JRuby though, because it is incompatible with the systemd # integration due to https://github.com/jruby/jruby/issues/6504 if ENV["NOTIFY_SOCKET"] && !Puma.jruby? && !ENV["PUMA_SKIP_SYSTEMD"] @config.plugins.create('systemd') end if @config.options[:bind_to_activated_sockets] @config.options[:binds] = @binder.synthesize_binds_from_activated_fs( @config.options[:binds], @config.options[:bind_to_activated_sockets] == 'only' ) end @options = @config.options @config.clamp @log_writer.formatter = LogWriter::PidFormatter.new if clustered? @log_writer.formatter = options[:log_formatter] if @options[:log_formatter] @log_writer.custom_logger = options[:custom_logger] if @options[:custom_logger] generate_restart_data if clustered? && !Puma.forkable? unsupported "worker mode not supported on #{RUBY_ENGINE} on this platform" end Dir.chdir(@restart_dir) prune_bundler! @environment = @options[:environment] if @options[:environment] set_rack_environment if clustered? @options[:logger] = @log_writer @runner = Cluster.new(self) else @runner = Single.new(self) end Puma.stats_object = @runner @status = :run log_config if env['PUMA_LOG_CONFIG'] end