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

Chef-Solo support #9

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ which will be expanded to:
}
}

Chef Solo Support
-----------------

This cookbook relies on roles to find backend application servers. This may not be desireable in a simplified chef solo deployment. You must manually specify backend application servers by providing a list of nodes.

For example, reverse proxying to applications on the current node:

nginx_load_balancer do
hosts [node]
end

License and Author
==================

Expand Down
8 changes: 7 additions & 1 deletion providers/nginx_load_balancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@
owner "root"
group "root"
mode "644"

hosts = if(Chef::Config[:solo])
new_resource.hosts
else
new_resource.find_matching_role(new_resource.application_server_role, false)
end
variables(:resource => new_resource,
:hosts => new_resource.find_matching_role(new_resource.application_server_role, false),
:hosts => hosts,
:application_socket => Array(new_resource.application_socket)
)
notifies :reload, resources(:service => 'nginx')
Expand Down
1 change: 1 addition & 0 deletions resources/nginx_load_balancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
attribute :ssl, :kind_of => [ TrueClass, FalseClass ], :default => false
attribute :ssl_certificate, :kind_of => String, :default => "#{node['fqdn']}.crt"
attribute :ssl_certificate_key, :kind_of => String, :default => "#{node['fqdn']}.key"
attribute :hosts, :default => []