haproxy-tools 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CHANGES.rdoc +3 -0
- data/README.rdoc +2 -2
- data/haproxy-tools.gemspec +7 -5
- data/lib/haproxy/parser.rb +1 -1
- data/lib/haproxy/treetop/config.treetop +1 -2
- data/lib/haproxy/version.rb +1 -1
- data/spec/fixtures/simple.haproxy15.cfg +31 -0
- data/spec/haproxy/config_spec.rb +1 -1
- data/spec/haproxy/parser_spec.rb +20 -0
- metadata +44 -38
- checksums.yaml +0 -7
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3
|
data/.travis.yml
ADDED
data/CHANGES.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
{<img src="https://travis-ci.org/subakva/haproxy-tools.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/subakva/haproxy-tools]
|
1
2
|
= haproxy-tools
|
2
3
|
|
3
4
|
Tools for managing HAProxy with Ruby.
|
@@ -55,6 +56,5 @@ Tools for managing HAProxy with Ruby.
|
|
55
56
|
|
56
57
|
== Copyright
|
57
58
|
|
58
|
-
Copyright (c) 2011-
|
59
|
-
further details.
|
59
|
+
Copyright (c) 2011-2015 Jason Wadsworth. See LICENSE.txt for further details.
|
60
60
|
|
data/haproxy-tools.gemspec
CHANGED
@@ -18,12 +18,14 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ['lib']
|
20
20
|
|
21
|
+
gem.required_ruby_version = '1.9.3'
|
22
|
+
|
21
23
|
gem.add_dependency('net-scp')
|
22
|
-
gem.add_dependency(
|
23
|
-
gem.add_development_dependency(
|
24
|
-
gem.add_development_dependency(
|
25
|
-
gem.add_development_dependency(
|
24
|
+
gem.add_dependency('treetop')
|
25
|
+
gem.add_development_dependency('rake')
|
26
|
+
gem.add_development_dependency('rspec', '~> 2.14')
|
27
|
+
gem.add_development_dependency('yard')
|
26
28
|
gem.add_development_dependency('simplecov')
|
27
29
|
gem.add_development_dependency('cane')
|
28
|
-
gem.add_development_dependency('pry-debugger')
|
30
|
+
# gem.add_development_dependency('pry-debugger')
|
29
31
|
end
|
data/lib/haproxy/parser.rb
CHANGED
data/lib/haproxy/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
# This is a top-level comment. It should be allowed.
|
2
|
+
|
3
|
+
global
|
4
|
+
maxconn 4096 # Total Max Connections. This is dependent on ulimit
|
5
|
+
daemon
|
6
|
+
nbproc 4 # Number of processing cores. Dual Dual-core Opteron is 4 cores for example.
|
7
|
+
log 127.0.0.1 local0
|
8
|
+
log 127.0.0.1 local1 notice
|
9
|
+
user haproxy
|
10
|
+
group haproxy
|
11
|
+
|
12
|
+
defaults
|
13
|
+
mode http
|
14
|
+
option httpclose # Disable Keepalive
|
15
|
+
option httplog
|
16
|
+
option dontlognull
|
17
|
+
timeout connect 5000ms
|
18
|
+
timeout client 5000ms
|
19
|
+
timeout server 5000ms
|
20
|
+
errorfile 400 /etc/haproxy/errors/400.http
|
21
|
+
errorfile 504 /etc/haproxy/errors/504.http
|
22
|
+
|
23
|
+
listen http_proxy 55.55.55.55:80
|
24
|
+
balance roundrobin # Load Balancing algorithm
|
25
|
+
option httpchk
|
26
|
+
option forwardfor # This sets X-Forwarded-For
|
27
|
+
|
28
|
+
## Define your servers to balance
|
29
|
+
server web1 dnshost66:80 weight 1 maxconn 512 check
|
30
|
+
server web2 77.77.77.77:80 weight 1 maxconn 512 check
|
31
|
+
server web3 88.88.88.88:80
|
data/spec/haproxy/config_spec.rb
CHANGED
@@ -24,7 +24,7 @@ describe "HAProxy::Config" do
|
|
24
24
|
new_config = HAProxy::Parser.new.parse(new_config_text)
|
25
25
|
s = new_config.backend('www_main').servers['prd_www_1']
|
26
26
|
s.should_not be_nil
|
27
|
-
s.attributes['disabled'].should
|
27
|
+
s.attributes['disabled'].should be_truthy
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'can re-render a config file with a server added' do
|
data/spec/haproxy/parser_spec.rb
CHANGED
@@ -36,6 +36,26 @@ describe "HAProxy::Parser" do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
context 'basic 1.5 config file' do
|
40
|
+
before(:each) do
|
41
|
+
@parser = HAProxy::Parser.new
|
42
|
+
@config = @parser.parse_file('spec/fixtures/simple.haproxy15.cfg')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "parses structured configs" do
|
46
|
+
defaults = @config.defaults.first.config
|
47
|
+
|
48
|
+
defaults['timeout connect'].should == '5000ms'
|
49
|
+
defaults['timeout client'].should == '5000ms'
|
50
|
+
defaults['timeout server'].should == '5000ms'
|
51
|
+
|
52
|
+
defaults['errorfile 400'].should == '/etc/haproxy/errors/400.http'
|
53
|
+
defaults['errorfile 504'].should == '/etc/haproxy/errors/504.http'
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
39
59
|
context 'basic config file' do
|
40
60
|
before(:each) do
|
41
61
|
@parser = HAProxy::Parser.new
|
metadata
CHANGED
@@ -1,125 +1,126 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haproxy-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Jason Wadsworth
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: net-scp
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: treetop
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rake
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- - '>='
|
51
|
+
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- - '>='
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: rspec
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- -
|
67
|
+
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
69
|
+
version: '2.14'
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- -
|
75
|
+
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
77
|
+
version: '2.14'
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: yard
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- - '>='
|
83
|
+
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
75
85
|
version: '0'
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
|
-
- - '>='
|
91
|
+
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
82
93
|
version: '0'
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: simplecov
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
|
-
- - '>='
|
99
|
+
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '0'
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
|
-
- - '>='
|
107
|
+
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
96
109
|
version: '0'
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: cane
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
|
-
- - '>='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - '>='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: pry-debugger
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '>='
|
115
|
+
- - ! '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
121
122
|
requirements:
|
122
|
-
- - '>='
|
123
|
+
- - ! '>='
|
123
124
|
- !ruby/object:Gem::Version
|
124
125
|
version: '0'
|
125
126
|
description: Ruby tools for HAProxy, including config file management.
|
@@ -132,7 +133,9 @@ files:
|
|
132
133
|
- .document
|
133
134
|
- .gitignore
|
134
135
|
- .rspec
|
136
|
+
- .ruby-version
|
135
137
|
- .simplecov
|
138
|
+
- .travis.yml
|
136
139
|
- CHANGES.rdoc
|
137
140
|
- Gemfile
|
138
141
|
- LICENSE.txt
|
@@ -153,6 +156,7 @@ files:
|
|
153
156
|
- lib/haproxy_tools.rb
|
154
157
|
- spec/fixtures/multi-pool.haproxy.cfg
|
155
158
|
- spec/fixtures/simple.haproxy.cfg
|
159
|
+
- spec/fixtures/simple.haproxy15.cfg
|
156
160
|
- spec/haproxy/config_spec.rb
|
157
161
|
- spec/haproxy/parser_spec.rb
|
158
162
|
- spec/haproxy/treetop/config_parser_spec.rb
|
@@ -160,30 +164,32 @@ files:
|
|
160
164
|
homepage: https://github.com/subakva/haproxy-tools
|
161
165
|
licenses:
|
162
166
|
- MIT
|
163
|
-
metadata: {}
|
164
167
|
post_install_message:
|
165
168
|
rdoc_options: []
|
166
169
|
require_paths:
|
167
170
|
- lib
|
168
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
169
173
|
requirements:
|
170
|
-
- - '
|
174
|
+
- - '='
|
171
175
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
176
|
+
version: 1.9.3
|
173
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
174
179
|
requirements:
|
175
|
-
- - '>='
|
180
|
+
- - ! '>='
|
176
181
|
- !ruby/object:Gem::Version
|
177
182
|
version: '0'
|
178
183
|
requirements: []
|
179
184
|
rubyforge_project:
|
180
|
-
rubygems_version:
|
185
|
+
rubygems_version: 1.8.23.2
|
181
186
|
signing_key:
|
182
|
-
specification_version:
|
187
|
+
specification_version: 3
|
183
188
|
summary: HAProxy Tools for Ruby
|
184
189
|
test_files:
|
185
190
|
- spec/fixtures/multi-pool.haproxy.cfg
|
186
191
|
- spec/fixtures/simple.haproxy.cfg
|
192
|
+
- spec/fixtures/simple.haproxy15.cfg
|
187
193
|
- spec/haproxy/config_spec.rb
|
188
194
|
- spec/haproxy/parser_spec.rb
|
189
195
|
- spec/haproxy/treetop/config_parser_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 1c1d426c50dd8bf48f341ee93223736eeae6adc1
|
4
|
-
data.tar.gz: 0b43d53d067fc43ebb399311f71375c89f53c23d
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 4b9213898f321a7375900056456811f6a9b8c932efaa4fca982749f1150cdfbac534f043352639c16a8645a5ad2b3c159ed4aba2d122f7bf01e375147241bf40
|
7
|
-
data.tar.gz: 75a5c499a2e002386ba18a4a3cc61eeda6d8fef689b23d1b070bf3fcc1a4a4d787241ead17ad5fe89a40d10e26899d9d29c38e07a4454c4037c10f9e4a13d307
|