Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.

Commit 3d0c3ff

Browse files
author
Seth Vargo
committed
Merge pull request #35 from bryanstearns/COOK-3367-more-unicorn-parameters
COOK-3367 Pass through more unicorn parameters
2 parents 438dced + cb5ce1f commit 3d0c3ff

3 files changed

Lines changed: 33 additions & 1 deletion

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,20 @@ The `unicorn` sub-resource LWRP configures Unicorn to run the application.
8888
- bundler: if true, Unicorn will be run with `bundle exec`; if false it will be installed and run from the default gem path. Defaults to inheriting this setting from the rails LWRP
8989
- preload_app: passed to the `unicorn_config` LWRP
9090
- worker_processes: passed to the `unicorn_config` LWRP
91+
- before_exec: passed to the `unicorn_config` LWRP
9192
- before_fork: passed to the `unicorn_config` LWRP
93+
- after_fork: passed to the `unicorn_config` LWRP
9294
- port: passed to the `unicorn_config` LWRP
95+
- listen: passed to the `unicorn_config` LWRP; overrides port
9396
- worker_timeout: passed to the `unicorn_config` LWRP
97+
- forked_user: passed to the `unicorn_config` LWRP
98+
- forked_group: passed to the `unicorn_config` LWRP
99+
- pid: passed to the `unicorn_config` LWRP
100+
- stderr_path: passed to the `unicorn_config` LWRP
101+
- stdout_path: passed to the `unicorn_config` LWRP
102+
- unicorn_command_line: passed to the `unicorn_config` LWRP
103+
- copy_on_write: passed to the `unicorn_config` LWRP
104+
- enable_stats: passed to the `unicorn_config` LWRP
94105

95106
memcached
96107
---------

providers/unicorn.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,22 @@
5656
new_resource = @new_resource
5757

5858
unicorn_config "/etc/unicorn/#{new_resource.name}.rb" do
59-
listen({ new_resource.port => new_resource.options })
59+
listen(new_resource.listen || { new_resource.port => new_resource.options })
6060
working_directory ::File.join(new_resource.path, 'current')
6161
worker_timeout new_resource.worker_timeout
6262
preload_app new_resource.preload_app
6363
worker_processes new_resource.worker_processes
6464
before_fork new_resource.before_fork
65+
after_fork new_resource.after_fork
66+
forked_user new_resource.forked_user
67+
forked_group new_resource.forked_group
68+
before_exec new_resource.before_exec
69+
pid new_resource.pid
70+
stderr_path new_resource.stderr_path
71+
stdout_path new_resource.stdout_path
72+
unicorn_command_line new_resource.unicorn_command_line
73+
copy_on_write new_resource.copy_on_write
74+
enable_stats new_resource.enable_stats
6575
end
6676

6777
runit_service new_resource.name do

resources/unicorn.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,21 @@
2323
attribute :preload_app, :kind_of => [TrueClass, FalseClass], :default => false
2424
attribute :worker_processes, :kind_of => Integer, :default => [node['cpu']['total'].to_i * 4, 8].min
2525
attribute :before_fork, :kind_of => String, :default => 'sleep 1'
26+
attribute :after_fork, :kind_of => [String, NilClass], :default => nil
2627
attribute :port, :kind_of => String, :default => "8080"
2728
attribute :worker_timeout, :kind_of => Integer, :default => 60
2829
attribute :bundler, :kind_of => [TrueClass, FalseClass, NilClass], :default => nil
2930
attribute :bundle_command, :kind_of => [String, NilClass], :default => nil
31+
attribute :listen, :kind_of => [Hash, NilClass], :default => nil
32+
attribute :forked_user, :kind_of => [String, NilClass], :default => nil
33+
attribute :forked_group, :kind_of => [String, NilClass], :default => nil
34+
attribute :before_exec, :kind_of => [String, NilClass], :default => nil
35+
attribute :pid, :kind_of => [String, NilClass], :default => nil
36+
attribute :stderr_path, :kind_of => [String, NilClass], :default => nil
37+
attribute :stdout_path, :kind_of => [String, NilClass], :default => nil
38+
attribute :unicorn_command_line, :kind_of => [String, NilClass], :default => nil
39+
attribute :copy_on_write, :kind_of => [TrueClass, FalseClass], :default => false
40+
attribute :enable_stats, :kind_of => [TrueClass, FalseClass], :default => false
3041

3142
def options(*args, &block)
3243
@options ||= Mash[:tcp_nodelay => true, :backlog => 100]

0 commit comments

Comments
 (0)