class PoiseApplicationPython::Resources::Gunicorn::Provider
Public Instance Methods
action_enable()
click to toggle source
Calls superclass method
# File lib/poise_application_python/resources/gunicorn.rb, line 77 def action_enable notifying_block do install_gunicorn end super end
Private Instance Methods
gunicorn_command_options()
click to toggle source
# File lib/poise_application_python/resources/gunicorn.rb, line 94 def gunicorn_command_options # Based on http://docs.gunicorn.org/en/latest/settings.html [].tap do |cmd| # What options are common enough to deal with here? # %w{config backlog workers worker_class threads worker_connections timeout graceful_timeout keepalive}.each do |opt| %w{config}.each do |opt| val = new_resource.send(opt) if val && !(val.respond_to?(:empty?) && val.empty?) cmd_opt = opt.gsub(/_/, '-') cmd << "--#{cmd_opt} #{Shellwords.escape(val)}" end end # Can be given multiple times. Array(new_resource.bind).each do |bind| cmd << "--bind #{bind}" if bind end # --preload doesn't take an argument and the name doesn't match. if new_resource.preload_app cmd << '--preload' end end end
install_gunicorn()
click to toggle source
# File lib/poise_application_python/resources/gunicorn.rb, line 86 def install_gunicorn return unless new_resource.version python_package 'gunicorn' do python_from_parent new_resource version new_resource.version if new_resource.version.is_a?(String) end end
service_options(resource)
click to toggle source
(see PoiseApplication::ServiceMixin#service_options)
Calls superclass method
# File lib/poise_application_python/resources/gunicorn.rb, line 118 def service_options(resource) super raise PoiseApplicationPython::Error.new("Unable to determine app module for #{new_resource}") unless new_resource.app_module resource.command("#{new_resource.python} -m gunicorn.app.wsgiapp #{gunicorn_command_options.join(' ')} #{new_resource.app_module}") end