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.
14
15
16
17
18
19
20
21
|
# File 'lib/hugo/balancer.rb', line 14
def initialize
zone DEFAULT_ZONE
port DEFAULT_PORT
web DEFAULT_WEB
ssl_port DEFAULT_SSL_PORT
ssl_web DEFAULT_SSL_WEB
type DEFAULT_TYPE
end
|
Instance Method Details
#aws_access_key_id(arg = nil) ⇒ Object
Aws Access Key for EC2 Deployment
97
98
99
|
# File 'lib/hugo/balancer.rb', line 97
def aws_access_key_id(arg=nil)
set_or_return(:aws_access_key_id, arg, :kind_of => [String])
end
|
#aws_secret_access_key(arg = nil) ⇒ Object
Aws Access Secret Key for EC2 Deployment
102
103
104
|
# File 'lib/hugo/balancer.rb', line 102
def aws_secret_access_key(arg=nil)
set_or_return(:aws_secret_access_key, arg, :kind_of => [String])
end
|
#deploy ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/hugo/balancer.rb', line 23
def deploy
raise ArgumentError, "app.aws_access_key_id Required" unless aws_access_key_id
raise ArgumentError, "app.aws_secret_access_key Required" unless aws_secret_access_key
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}],
:aws_access_key_id => aws_access_key_id,
:aws_secret_access_key => aws_secret_access_key
)
end
|
#help ⇒ Object
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
62
63
64
65
66
|
# File 'lib/hugo/balancer.rb', line 36
def help
x = "\nHugo balancer \n-----------------\n\noptional attributes\n-----------------\nzone - zone\nport - app server port \nweb - balancer port\nssl_port - ssl app server port\nssl_web - ssl balancer port\ntype - port type\n\n\ndefaults\n-----------------\nDEFAULT_ZONE = 'us-east-1c'\nDEFAULT_PORT = '8080'\nDEFAULT_WEB = '80'\nDEFAULT_TYPE = 'http'\nDEFAULT_SSL_PORT = '8443'\nDEFAULT_SSL_WEB = '443'\n\n\n\n"
puts x
x
end
|
#name(arg = nil) ⇒ Object
68
69
70
|
# File 'lib/hugo/balancer.rb', line 68
def name(arg=nil)
set_or_return(:name, arg, :kind_of => [String])
end
|
#port(arg = nil) ⇒ Object
76
77
78
|
# File 'lib/hugo/balancer.rb', line 76
def port(arg=nil)
set_or_return(:port, arg, :kind_of => [String])
end
|
#ssl_port(arg = nil) ⇒ Object
88
89
90
|
# File 'lib/hugo/balancer.rb', line 88
def ssl_port(arg=nil)
set_or_return(:ssl_port, arg, :kind_of => [String])
end
|
#ssl_web(arg = nil) ⇒ Object
92
93
94
|
# File 'lib/hugo/balancer.rb', line 92
def ssl_web(arg=nil)
set_or_return(:ssl_web, arg, :kind_of => [String])
end
|
#type(arg = nil) ⇒ Object
84
85
86
|
# File 'lib/hugo/balancer.rb', line 84
def type(arg=nil)
set_or_return(:type, arg, :kind_of => [String])
end
|
#web(arg = nil) ⇒ Object
80
81
82
|
# File 'lib/hugo/balancer.rb', line 80
def web(arg=nil)
set_or_return(:web, arg, :kind_of => [String])
end
|
#zone(arg = nil) ⇒ Object
72
73
74
|
# File 'lib/hugo/balancer.rb', line 72
def zone(arg=nil)
set_or_return(:zone, arg, :kind_of => [String])
end
|