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

Add a 'host' method to the application_rackup resource #86

Open
wants to merge 2 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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ The `application_rackup` resource creates a service for `rackup`.
application '/srv/myapp' do
rackup do
port 8000
host '0.0.0.0'
end
end
```
Expand All @@ -78,8 +79,9 @@ end

* `path` – Base path for the application. *(name attribute)*
* `port` – Port to listen on. *(default: 80)*
* `host` – Host address to listen on. *(default: '127.0.0.1')*
* `service_name` – Name of the service to create. *(default: auto-detect)*
# `user` – User to run the service as. *(default: application owner)*
* `user` – User to run the service as. *(default: application owner)*

### `application_rails`

Expand Down
3 changes: 2 additions & 1 deletion lib/poise_application_ruby/resources/rackup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Resource < Chef::Resource
# TCP port to listen on. Defaults to 80.
# @return [String, Integer]
attribute(:port, kind_of: [String, Integer], default: 80)
attribute(:host, kind_of: [String], default: '127.0.0.1')
end

class Provider < Chef::Provider
Expand All @@ -59,7 +60,7 @@ def configru_path
# @return [void]
def service_options(resource)
super
resource.ruby_command("rackup --port #{new_resource.port}")
resource.ruby_command("rackup --port #{new_resource.port} --host #{new_resource.host}")
resource.directory(::File.dirname(configru_path))
# Older versions of rackup ignore all signals.
resource.stop_signal('KILL')
Expand Down