Class: Hugo::Balancer
Constant Summary
collapse
- DEFAULT_ZONE =
'us-east-1c'
- DEFAULT_PORT =
'8080'
- DEFAULT_WEB =
'80'
- DEFAULT_TYPE =
'http'
- DEFAULT_SSL_PORT =
'8443'
- DEFAULT_SSL_WEB =
'443'
Instance Method Summary
collapse
#set_or_return, #validate
Constructor Details
Returns a new instance of Balancer.
Instance Method Details
#deploy ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/hugo/balancer.rb', line 23
def deploy
Hugo::Aws::Elb.find_or_create(:name => name,
:zones => zone,
:listeners => [{ :instance_port => port, :protocol =>"HTTP", :load_balancer_port => web},
{ :instance_port => ssl_port, :protocol =>"TCP", :load_balancer_port => ssl_web}]
)
end
|
#help ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/hugo/balancer.rb', line 31
def help
x = <<HELP
Hugo balancer
-----------------
optional attributes
-----------------
zone - zone
port - app server port
web - balancer port
ssl_port - ssl app server port
ssl_web - ssl balancer port
type - port type
defaults
-----------------
DEFAULT_ZONE = 'us-east-1c'
DEFAULT_PORT = '8080'
DEFAULT_WEB = '80'
DEFAULT_TYPE = 'http'
DEFAULT_SSL_PORT = '8443'
DEFAULT_SSL_WEB = '443'
HELP
puts x
x
end
|
#name(arg = nil) ⇒ Object
63
64
65
|
# File 'lib/hugo/balancer.rb', line 63
def name(arg=nil)
set_or_return(:name, arg, :kind_of => [String])
end
|
#port(arg = nil) ⇒ Object
71
72
73
|
# File 'lib/hugo/balancer.rb', line 71
def port(arg=nil)
set_or_return(:port, arg, :kind_of => [String])
end
|
#ssl_port(arg = nil) ⇒ Object
83
84
85
|
# File 'lib/hugo/balancer.rb', line 83
def ssl_port(arg=nil)
set_or_return(:ssl_port, arg, :kind_of => [String])
end
|
#ssl_web(arg = nil) ⇒ Object
87
88
89
|
# File 'lib/hugo/balancer.rb', line 87
def ssl_web(arg=nil)
set_or_return(:ssl_web, arg, :kind_of => [String])
end
|
#type(arg = nil) ⇒ Object
79
80
81
|
# File 'lib/hugo/balancer.rb', line 79
def type(arg=nil)
set_or_return(:type, arg, :kind_of => [String])
end
|
#web(arg = nil) ⇒ Object
75
76
77
|
# File 'lib/hugo/balancer.rb', line 75
def web(arg=nil)
set_or_return(:web, arg, :kind_of => [String])
end
|
#zone(arg = nil) ⇒ Object
67
68
69
|
# File 'lib/hugo/balancer.rb', line 67
def zone(arg=nil)
set_or_return(:zone, arg, :kind_of => [String])
end
|