Permalink
Browse files

add ssl support to haproxy

  • Loading branch information...
1 parent 913512f commit ef3f5cc2600018fb93d195583c17e6ba42320021 @jsierles committed Sep 18, 2012
Showing with 12 additions and 11 deletions.
  1. +9 −9 haproxy/recipes/default.rb
  2. +3 −2 haproxy/templates/default/haproxy.cfg.erb
View
18 haproxy/recipes/default.rb
@@ -1,12 +1,12 @@
-remote_file "/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb" do
- source "#{node[:package_url]}/haproxy_1.4.15-2~lucid.1_amd64.deb"
- not_if { File.exists?("/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb") }
-end
-
-dpkg_package "haproxy" do
- source "/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb"
- only_if { File.exists?("/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb") }
-end
+# remote_file "/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb" do
+# source "#{node[:package_url]}/haproxy_1.4.15-2~lucid.1_amd64.deb"
+# not_if { File.exists?("/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb") }
+# end
+#
+# dpkg_package "haproxy" do
+# source "/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb"
+# only_if { File.exists?("/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb") }
+# end
include_recipe "nginx"
View
5 haproxy/templates/default/haproxy.cfg.erb
@@ -24,8 +24,9 @@ defaults
errorfile 502 /etc/haproxy/500.http
errorfile 503 /etc/haproxy/500.http
- frontend <%= @name %> <%= @config[:listen_address] || "0.0.0.0" %>:<%= @config[:listen_port] || @node[:haproxy][:listen_port] %>
+ frontend <%= @name %>
+ bind <%= @config[:listen_address] || "*" %>:<%= @config[:listen_port] || @node[:haproxy][:listen_port] -%><% if @config[:ssl] -%> ssl crt <%= @config[:ssl][:cert_path] %> prefer-server-ciphers<% end -%>
capture request header X-Forwarded-For len 16
capture request header Host len 100
capture request header X-Request-Id len 36
@@ -45,7 +46,7 @@ defaults
option httpchk HEAD <%= conf[:monitoring][:path] %> HTTP/1.1\r\nHost:\ <%= conf[:monitoring][:host] %>
<% end -%>
<% conf[:servers].each do |s_name, s_conf| %>
- server <%= s_name.gsub("-", "_") %> <%= s_conf[:ipaddress] %>:<%= s_conf[:port] || conf[:port] %> <% if conf[:monitoring] %>check inter 5000<% end -%> <% if s_conf[:backup] %>backup<% end -%>
+ server <%= s_name.gsub("-", "_") %> <%= s_conf[:ipaddress] %>:<%= s_conf[:port] || conf[:port] %> check inter 5000 <% if s_conf[:backup] %>backup<% end -%>
<% end -%>
<% end -%>

0 comments on commit ef3f5cc

Please sign in to comment.