le1t0-deprec 2.1.6.023 → 2.1.6.024

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  # deprec changelog
2
2
 
3
+ = 2.1.6.024 (Jul 15, 2010)
4
+
5
+ * made haproxy configurable
6
+
3
7
  = 2.1.6.023 (Jul 14, 2010)
4
8
 
5
9
  * added db seed and db redo tasks to rails recipe
@@ -11,6 +11,58 @@ Capistrano::Configuration.instance(:must_exist).load do
11
11
 
12
12
  }
13
13
 
14
+ # :haproxy_global_options should be a hash of options, in key => value pairs. Values can also be arrays of strings.
15
+ set :haproxy_global_options => {
16
+ "log" => "/var/log/haproxy.log daemon info",
17
+ "maxconn" => 4096,
18
+ "pidfile" => "/var/run/haproxy.pid",
19
+ "daemon" => true
20
+ }
21
+
22
+ # :haproxy_default_options should be a hash of options, in key => value pairs.
23
+ # :stats_auth => 'user:password' presence of this setting automatically enables stats
24
+ # :options => hash of options, in key => value pairs. Values can also be arrays of strings.
25
+ set :haproxy_default_options => {
26
+ :stats_auth => 'user:password',
27
+ :options => {
28
+ "option" => [
29
+ "forwardfor",
30
+ "httpclose",
31
+ "redispatch"
32
+ ],
33
+ "balance" => "roundrobin",
34
+ "mode" => "http",
35
+ "retries" => 3,
36
+ "maxconn" => 2000,
37
+ "contimeout" => 5000,
38
+ "clitimeout" => 50000,
39
+ "srvtimeout" => 50000
40
+ }
41
+ }
42
+
43
+ # :haproxy_instances should contain a hash with at least one key => value pair. The key should be a string
44
+ # with the virtual IP address. The value is again a hash with some settings, containing as key => value pairs:
45
+ # :name => 'name_of_webfarm'
46
+ # :stats_auth => 'user:password' presence of this setting automatically enables stats
47
+ # :servers => hash of servers, in key => value pairs:
48
+ # 'web1' => '127.0.0.1:80 weight 6 maxconn 12 check'
49
+ # :options => hash of options, in key => value pairs. Values can also be arrays of strings.
50
+ set :haproxy_instances, {
51
+ "*:81" => {
52
+ :name => "example_lb",
53
+ :stats_auth => 'user:password',
54
+ :servers => {
55
+ 'web1' => '127.0.0.1:80 weight 6 maxconn 12 check',
56
+ 'web2' => '127.0.0.1:80 weight 10 maxconn 12 check'
57
+ },
58
+ :options => {
59
+ "option" => [
60
+ "httpchk HEAD /check.txt HTTP/1.0"
61
+ ]
62
+ }
63
+ }
64
+ }
65
+
14
66
  desc "Install haproxy"
15
67
  task :install, :roles => :haproxy do
16
68
  install_deps
@@ -5,27 +5,31 @@
5
5
  # haproxy -f /etc/haproxy.cfg -sf `cat /var/run/haproxy.pid`
6
6
  #
7
7
  global
8
- log /var/log/haproxy.log daemon info
9
- maxconn 4096
10
- pidfile /var/run/haproxy.pid
11
- daemon
8
+ <% haproxy_global_options.each do |key, values| [values].flatten.each do |value| %>
9
+ <%= key %> <%= value %>
10
+ <% end end %>
12
11
 
13
12
  defaults
14
- option forwardfor
13
+ <% unless haproxy_default_options[:stats_auth].nil? || haproxy_default_options[:stats_auth].empty? %>
15
14
  stats enable
16
- stats auth myuser:mypass
17
- balance roundrobin
18
- option httpclose
19
- mode http
20
- retries 3
21
- option redispatch
22
- maxconn 2000
23
- contimeout 5000
24
- clitimeout 50000
25
- srvtimeout 50000
26
-
27
- listen example_lb *:81
28
- option httpchk HEAD /check.txt HTTP/1.0
29
- server web1 127.0.0.1:80 weight 6 maxconn 12 check # cookie A
30
- server web2 127.0.0.1:80 weight 10 maxconn 12 check # cookie B
15
+ stats <%= haproxy_default_options[:stats_auth] %>
16
+ <% end %>
17
+ <% (haproxy_default_options[:options] || {}).each do |key, values| [values].flatten.each do |value| %>
18
+ <%= key %> <%= value %>
19
+ <% end end %>
31
20
 
21
+ <% haproxy_instances.each_with_index do |instance_ipport, i| %>
22
+ <% ipport = instance_ipport.first %>
23
+ <% instance = instance_ipport.last %>
24
+ listen <%= instance[:name] || "no_name_defined_#{i+1}" %> <%= ipport %>
25
+ <% (instance[:options] || {}).each do |key, values| [values].flatten.each do |value| %>
26
+ <%= key %> <%= value %>
27
+ <% end end %>
28
+ <% unless instance[:stats_auth].nil? || instance[:stats_auth].empty? %>
29
+ stats enable
30
+ stats <%= instance[:stats_auth] %>
31
+ <% end %>
32
+ <% (instance[:servers] || {}).each do |key, value| %>
33
+ <%= key %> <%= value %>
34
+ <% end %>
35
+ <% end %>
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 2
7
7
  - 1
8
8
  - 6
9
- - 23
10
- version: 2.1.6.023
9
+ - 24
10
+ version: 2.1.6.024
11
11
  platform: ruby
12
12
  authors:
13
13
  - Le1t0
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-14 00:00:00 +02:00
18
+ date: 2010-07-15 00:00:00 +02:00
19
19
  default_executable: depify
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency