From 75fa88e18a27d94dc218c331f2e5724636f2c6ba Mon Sep 17 00:00:00 2001 From: zeknox Date: Tue, 22 Mar 2016 15:18:10 -0500 Subject: [PATCH 1/4] added address attribute to the unicorn module to allow for binding of loopback or other address than 0.0.0.0 the default --- lib/poise_application_ruby/resources/unicorn.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/poise_application_ruby/resources/unicorn.rb b/lib/poise_application_ruby/resources/unicorn.rb index 1d22f7c..9d87132 100644 --- a/lib/poise_application_ruby/resources/unicorn.rb +++ b/lib/poise_application_ruby/resources/unicorn.rb @@ -51,6 +51,9 @@ class Resource < Chef::Resource # @!attribute port # Port to bind to. attribute(:port, kind_of: [String, Integer], default: 80) + # @!attribute address + # Address to bind to. + attribute(:address, kind_of: [String, Integer], default: 0.0.0.0) end # Provider for `application_unicorn`. @@ -79,7 +82,7 @@ def configru_path # Set service resource options. def service_options(resource) super - resource.ruby_command("unicorn --port #{new_resource.port} #{configru_path}") + resource.ruby_command("unicorn --listen #{new_resource.address}:#{new_resource.port} #{configru_path}") end end end From 6e594e206e54b75365b546dc7572594d6174e153 Mon Sep 17 00:00:00 2001 From: zeknox Date: Tue, 22 Mar 2016 15:19:22 -0500 Subject: [PATCH 2/4] added address as an attribute to the unicorn portion of the README file --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1dca523..8ae8fc7 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,7 @@ end * `path` – Base path for the application. *(name attribute)* * `port` – Port to listen on. *(default: 80)* +* `address` – Address to bind to. *(default: 0.0.0.0)* * `service_name` – Name of the service to create. *(default: auto-detect)* # `user` – User to run the service as. *(default: application owner)* From 29bf52f34d2d08de3c09eef1539cdc00c4c88b59 Mon Sep 17 00:00:00 2001 From: zeknox Date: Tue, 22 Mar 2016 15:41:36 -0500 Subject: [PATCH 3/4] modified unicorn start command to breakout host from port --- lib/poise_application_ruby/resources/unicorn.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/poise_application_ruby/resources/unicorn.rb b/lib/poise_application_ruby/resources/unicorn.rb index 9d87132..29fff6b 100644 --- a/lib/poise_application_ruby/resources/unicorn.rb +++ b/lib/poise_application_ruby/resources/unicorn.rb @@ -82,7 +82,7 @@ def configru_path # Set service resource options. def service_options(resource) super - resource.ruby_command("unicorn --listen #{new_resource.address}:#{new_resource.port} #{configru_path}") + resource.ruby_command("unicorn --host #{new_resource.address} --port #{new_resource.port} #{configru_path}") end end end From 3ae74cc902940973b194b422115390a84c55e6c8 Mon Sep 17 00:00:00 2001 From: zeknox Date: Tue, 22 Mar 2016 15:42:33 -0500 Subject: [PATCH 4/4] modified address attribute to a string type --- lib/poise_application_ruby/resources/unicorn.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/poise_application_ruby/resources/unicorn.rb b/lib/poise_application_ruby/resources/unicorn.rb index 29fff6b..e36ba1c 100644 --- a/lib/poise_application_ruby/resources/unicorn.rb +++ b/lib/poise_application_ruby/resources/unicorn.rb @@ -53,7 +53,7 @@ class Resource < Chef::Resource attribute(:port, kind_of: [String, Integer], default: 80) # @!attribute address # Address to bind to. - attribute(:address, kind_of: [String, Integer], default: 0.0.0.0) + attribute(:address, kind_of: String, default: 0.0.0.0) end # Provider for `application_unicorn`.