Skip to content

Commit 1f9e8ab

Browse files
author
jtimberman
committed
COOK-805, more consistent attribute names for haproxy configuration
1 parent 1ccffcc commit 1f9e8ab

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ Tested on Ubuntu 8.10 and higher.
3434
Attributes
3535
==========
3636

37+
* `node['haproxy']['incoming_port']` - sets the port on which haproxy listens
3738
* `node['haproxy']['member_port']` - the port that member systems will be listening on, default 80
3839
* `node['haproxy']['enable_admin']` - whether to enable the admin interface. default true. Listens on port 22002.
3940
* `node['haproxy']['app_server_role']` - used by the `app_lb` recipe to search for a specific role of member systems. Default `webserver`.
4041
* `node['haproxy']['balance_algorithm']` - sets the load balancing algorithm; defaults to roundrobin.
41-
* `node['haproxy']['incoming_port']` - sets the port on which haproxy listens
42-
* `node['haproxy']['max_connections_per_server']` - the maxconn value to be set for each app server
43-
* `node['haproxy']['add_x_forwarded_for']` - if true, creates an X-Forwarded-For header containing the original client's IP address. This option disables KeepAlive.
44-
* `node['haproxy']['ssl_enabled']` - whether or not to create listeners for ssl, default false
42+
* `node['haproxy']['member_max_connections']` - the maxconn value to be set for each app server
43+
* `node['haproxy']['x_forwarded_for']` - if true, creates an X-Forwarded-For header containing the original client's IP address. This option disables KeepAlive.
44+
* `node['haproxy']['enable_ssl']` - whether or not to create listeners for ssl, default false
4545
* `node['haproxy']['ssl_member_port']` - the port that member systems will be listening on for ssl, default 8443
4646
* `node['haproxy']['ssl_incoming_port']` - sets the port on which haproxy listens for ssl, default 443
4747

attributes/default.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
# limitations under the License.
1818
#
1919

20+
default['haproxy']['incoming_port'] = "80"
2021
default['haproxy']['member_port'] = "8080"
2122
default['haproxy']['enable_admin'] = true
2223
default['haproxy']['app_server_role'] = "webserver"
2324
default['haproxy']['balance_algorithm'] = "roundrobin"
24-
default['haproxy']['incoming_port'] = "80"
25-
default['haproxy']['max_connections_per_server'] = "100"
26-
default['haproxy']['add_x_forwarded_for'] = false
27-
default['haproxy']['ssl_enabled'] = false
25+
default['haproxy']['member_max_connections'] = "100"
26+
default['haproxy']['x_forwarded_for'] = false
27+
default['haproxy']['enable_ssl'] = false
2828
default['haproxy']['ssl_incoming_port'] = "443"
2929
default['haproxy']['ssl_member_port'] = "8443"

templates/default/haproxy-app_lb.cfg.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ defaults
1919
contimeout 5000
2020
clitimeout 50000
2121
srvtimeout 50000
22-
<% if node["haproxy"]["apply_x_forwarded_for"] -%>
22+
<% if node["haproxy"]["x_forwarded_for"] -%>
2323
option httpclose
2424
option forwardfor
2525
<% end -%>
@@ -28,15 +28,15 @@ defaults
2828
listen application 0.0.0.0:<%= node["haproxy"]["incoming_port"] %>
2929
balance <%= node["haproxy"]["balance_algorithm"] %>
3030
<% @pool_members.each do |member| -%>
31-
server <%= member[:hostname] %> <%= member[:ipaddress] %>:<%= node["haproxy"]["member_port"] %> weight 1 maxconn <%= node["haproxy"]["max_connections_per_server"] %> check
31+
server <%= member[:hostname] %> <%= member[:ipaddress] %>:<%= node["haproxy"]["member_port"] %> weight 1 maxconn <%= node["haproxy"]["member_max_connections"] %> check
3232
<% end -%>
3333

34-
<% if node["haproxy"]["ssl_enabled"] -%>
34+
<% if node["haproxy"]["enable_ssl"] -%>
3535
listen ssl_application 0.0.0.0:<%= node["haproxy"]["ssl_incoming_port"] %>
3636
balance <%= node["haproxy"]["balance_algorithm"] %>
3737
mode tcp
3838
<% @pool_members.each do |member| -%>
39-
server <%= member[:hostname] %> <%= member[:ipaddress] %>:<%= node["haproxy"]["ssl_member_port"] %> weight 1 maxconn <%= node["haproxy"]["max_connections_per_server"] %> check
39+
server <%= member[:hostname] %> <%= member[:ipaddress] %>:<%= node["haproxy"]["ssl_member_port"] %> weight 1 maxconn <%= node["haproxy"]["member_max_connections"] %> check
4040
<% end -%>
4141
<% end -%>
4242

templates/default/haproxy.cfg.erb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ defaults
2121
srvtimeout 50000
2222

2323
# Set up application listeners here.
24-
listen application 0.0.0.0:8400
25-
balance roundrobin
26-
server localhost 127.0.0.1:4000 weight 1 maxconn 5 check
27-
server localhost 127.0.0.1:4001 weight 1 maxconn 5 check
24+
listen application 0.0.0.0:<%= node["haproxy"]["incoming_port"] %>
25+
balance <%= node["haproxy"]["balance_algorithm"] %>
26+
server localhost 127.0.0.1:4000 weight 1 maxconn <%= node["haproxy"]["member_max_connections"] %> check
27+
server localhost 127.0.0.1:4001 weight 1 maxconn <%= node["haproxy"]["member_max_connections"] %> check
28+
29+
<% if node["haproxy"]["enable_admin"] -%>
30+
listen admin 0.0.0.0:22002
31+
mode http
32+
stats uri /
33+
<% end -%>

0 commit comments

Comments
 (0)