Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'chef-vendor-haproxy'

  • Loading branch information...
commit 06a6bee807e7704d81c7a10e8ab3e2e298fb1d99 2 parents c72b644 + ff9b58c
@schisamo schisamo authored
View
8 cookbooks/haproxy/README.md
@@ -6,6 +6,14 @@ Installs haproxy and prepares the configuration location.
Changes
=======
+## v1.0.2:
+
+* fix regression introduced in v1.0.1
+
+## v1.0.1:
+
+* account for the case where load balancer is in the pool
+
## v1.0.0:
* Use `node.chef_environment` instead of `node['app_environment']`
View
4 cookbooks/haproxy/metadata.json
@@ -1,7 +1,7 @@
{
"name": "haproxy",
"description": "Installs and configures haproxy",
- "long_description": "Description\n===========\n\nInstalls haproxy and prepares the configuration location.\n\nChanges\n=======\n\n## v1.0.0:\n\n* Use `node.chef_environment` instead of `node['app_environment']`\n\nRequirements\n============\n\n## Platform\n\nTested on Ubuntu 8.10 and higher.\n\n## Cookbooks:\n\nAttributes\n==========\n\n* `node['haproxy']['member_port']` - the port that member systems will be listening on, default 80\n* `node['haproxy']['enable_admin']` - whether to enable the admin interface. default true. Listens on port 22002.\n* `node['haproxy']['app_server_role']` - used by the `app_lb` recipe to search for a specific role of member systems. Default `webserver`.\n\nUsage\n=====\n\nUse either the default recipe or the `app_lb` recipe.\n\nWhen using the default recipe, modify the haproxy.cfg.erb file with listener(s) for your sites/servers.\n\nThe app_lb recipe is designed to be used with the application cookbook, and provides search mechanism to find the appropriate application servers. Set this in a role that includes the haproxy::app_lb recipe. For example,\n\n name \"load_balancer\"\n description \"haproxy load balancer\"\n run_list(\"recipe[haproxy::app_lb]\")\n override_attributes(\n \"haproxy\" => {\n \"app_server_role\" => \"webserver\"\n }\n )\n\nThe search uses the node's `chef_environment`. For example, create `environments/production.rb`, then upload it to the server with knife\n\n % cat environments/production.rb\n name \"production\"\n description \"Nodes in the production environment.\"\n % knife environment from file production.rb\n\nLicense and Author\n==================\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009-2011, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
+ "long_description": "Description\n===========\n\nInstalls haproxy and prepares the configuration location.\n\nChanges\n=======\n\n## v1.0.2:\n\n* fix regression introduced in v1.0.1\n\n## v1.0.1:\n\n* account for the case where load balancer is in the pool\n\n## v1.0.0:\n\n* Use `node.chef_environment` instead of `node['app_environment']`\n\nRequirements\n============\n\n## Platform\n\nTested on Ubuntu 8.10 and higher.\n\n## Cookbooks:\n\nAttributes\n==========\n\n* `node['haproxy']['member_port']` - the port that member systems will be listening on, default 80\n* `node['haproxy']['enable_admin']` - whether to enable the admin interface. default true. Listens on port 22002.\n* `node['haproxy']['app_server_role']` - used by the `app_lb` recipe to search for a specific role of member systems. Default `webserver`.\n\nUsage\n=====\n\nUse either the default recipe or the `app_lb` recipe.\n\nWhen using the default recipe, modify the haproxy.cfg.erb file with listener(s) for your sites/servers.\n\nThe app_lb recipe is designed to be used with the application cookbook, and provides search mechanism to find the appropriate application servers. Set this in a role that includes the haproxy::app_lb recipe. For example,\n\n name \"load_balancer\"\n description \"haproxy load balancer\"\n run_list(\"recipe[haproxy::app_lb]\")\n override_attributes(\n \"haproxy\" => {\n \"app_server_role\" => \"webserver\"\n }\n )\n\nThe search uses the node's `chef_environment`. For example, create `environments/production.rb`, then upload it to the server with knife\n\n % cat environments/production.rb\n name \"production\"\n description \"Nodes in the production environment.\"\n % knife environment from file production.rb\n\nLicense and Author\n==================\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009-2011, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"maintainer": "Opscode, Inc.",
"maintainer_email": "cookbooks@opscode.com",
"license": "Apache 2.0",
@@ -29,5 +29,5 @@
"haproxy": "Installs and configures haproxy",
"haproxy::app_lb": "Installs and configures haproxy by searching for nodes of a particular role"
},
- "version": "1.0.1"
+ "version": "1.0.2"
}
View
2  cookbooks/haproxy/metadata.rb
@@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs and configures haproxy"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "1.0.1"
+version "1.0.2"
recipe "haproxy", "Installs and configures haproxy"
recipe "haproxy::app_lb", "Installs and configures haproxy by searching for nodes of a particular role"
View
9 cookbooks/haproxy/recipes/app_lb.rb
@@ -17,12 +17,11 @@
# limitations under the License.
#
-pool_members = []
-# if we are the load balancer and pool
+pool_members = search("node", "role:#{node['haproxy']['app_server_role']} AND chef_environment:#{node.chef_environment}") || []
+
+# load balancer is in the pool
if node.run_list.roles.include?(node['haproxy']['app_server_role'])
pool_members << node
-else
- pool_members << search("node", "role:#{node['haproxy']['app_server_role']} AND chef_environment:#{node.chef_environment}")
end
package "haproxy" do
@@ -46,6 +45,6 @@
owner "root"
group "root"
mode 0644
- variables :pool_members => pool_members
+ variables :pool_members => pool_members.uniq
notifies :restart, "service[haproxy]"
end
Please sign in to comment.
Something went wrong with that request. Please try again.