Skip to content

Commit

Permalink
add ssl support to haproxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jsierles committed Sep 18, 2012
1 parent 913512f commit ef3f5cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
18 changes: 9 additions & 9 deletions haproxy/recipes/default.rb
@@ -1,12 +1,12 @@
remote_file "/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb" do # 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" # 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") } # not_if { File.exists?("/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb") }
end # end

#
dpkg_package "haproxy" do # dpkg_package "haproxy" do
source "/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb" # 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") } # only_if { File.exists?("/tmp/haproxy_1.4.15-2~lucid.1_amd64.deb") }
end # end


include_recipe "nginx" include_recipe "nginx"


Expand Down
5 changes: 3 additions & 2 deletions haproxy/templates/default/haproxy.cfg.erb
Expand Up @@ -24,8 +24,9 @@ defaults
errorfile 502 /etc/haproxy/500.http errorfile 502 /etc/haproxy/500.http
errorfile 503 /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 X-Forwarded-For len 16
capture request header Host len 100 capture request header Host len 100
capture request header X-Request-Id len 36 capture request header X-Request-Id len 36
Expand All @@ -45,7 +46,7 @@ defaults
option httpchk HEAD <%= conf[:monitoring][:path] %> HTTP/1.1\r\nHost:\ <%= conf[:monitoring][:host] %> option httpchk HEAD <%= conf[:monitoring][:path] %> HTTP/1.1\r\nHost:\ <%= conf[:monitoring][:host] %>
<% end -%> <% end -%>
<% conf[:servers].each do |s_name, s_conf| %> <% 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 -%>
<% end -%> <% end -%>


Expand Down

0 comments on commit ef3f5cc

Please sign in to comment.