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

Added Ability to Bind Unicorn to Loopback Interface #82

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)*

Expand Down
5 changes: 4 additions & 1 deletion lib/poise_application_ruby/resources/unicorn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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, default: 0.0.0.0)
end

# Provider for `application_unicorn`.
Expand Down Expand Up @@ -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 --host #{new_resource.address} --port #{new_resource.port} #{configru_path}")
end
end
end
Expand Down