rig 0.6.3 → 0.6.4
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.md +10 -0
- data/conf/plugins/mongo.rb +3 -57
- data/lib/rig/model/environment.rb +27 -7
- data/lib/rig/template.rb +12 -4
- data/lib/rig/version.rb +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.6.3:
|
4
|
+
* minor bug fixes
|
5
|
+
* clean up 'server tags' command, need to look at the rest
|
6
|
+
* add support for setting balancer 'stickiness' policy
|
7
|
+
* smarter DNS removal for environments and servers
|
8
|
+
* fix bug with userdata in template dsl
|
9
|
+
* add dns to template dsl
|
10
|
+
* clean up code around waiting for environment servers to be ready (possibly still needs work)
|
11
|
+
* started changing dsl classes to use a more standardized approach
|
12
|
+
|
3
13
|
## v0.6.2:
|
4
14
|
* add csshx support, just generates and runs the csshx command line to connect to all instances of an environment
|
5
15
|
|
data/conf/plugins/mongo.rb
CHANGED
@@ -23,43 +23,20 @@ module Rig
|
|
23
23
|
parameter "[PASS]", "password of user to add to database"
|
24
24
|
|
25
25
|
def execute
|
26
|
-
|
27
|
-
db.create_database(name, user, pass) unless test?
|
26
|
+
Rig::Plugin::Mongo.create_database(name, user, pass) unless test?
|
28
27
|
end
|
29
28
|
end
|
30
29
|
subcommand "destroy", "destroy a database" do
|
31
30
|
parameter "NAME", "name of the database"
|
32
31
|
|
33
32
|
def execute
|
34
|
-
|
35
|
-
db.destroy_database(name) unless test?
|
33
|
+
Rig::Plugin::Mongo.destroy_database(name) unless test?
|
36
34
|
end
|
37
35
|
end
|
38
36
|
self.default_subcommand = "list"
|
39
37
|
end
|
40
38
|
|
41
39
|
class << self
|
42
|
-
#def initialize(opts)
|
43
|
-
# @options = {
|
44
|
-
# :host => "localhost",
|
45
|
-
# :port => 27017,
|
46
|
-
# :user => nil,
|
47
|
-
# :pass => nil,
|
48
|
-
# :admin_user => nil,
|
49
|
-
# :admin_pass => nil
|
50
|
-
# }.merge(opts)
|
51
|
-
# connect
|
52
|
-
#end
|
53
|
-
|
54
|
-
## accessors
|
55
|
-
#def user; @options[:user]; end
|
56
|
-
#def host; @options[:host]; end
|
57
|
-
#def port; @options[:port]; end
|
58
|
-
#def pass; @options[:pass]; end
|
59
|
-
#def password; @options[:pass]; end
|
60
|
-
#def admin_user; @options[:admin_user]; end
|
61
|
-
#def admin_pass; @options[:admin_pass]; end
|
62
|
-
#def admin_password; @options[:admin_pass]; end
|
63
40
|
|
64
41
|
def connect
|
65
42
|
@options ||= config_for self
|
@@ -101,35 +78,4 @@ module Rig
|
|
101
78
|
end
|
102
79
|
end
|
103
80
|
|
104
|
-
|
105
|
-
module Mongo
|
106
|
-
class Main < Clamp::Command
|
107
|
-
subcommand "list", "list all databases" do
|
108
|
-
def execute
|
109
|
-
list = Rig::Plugin::Mongo.all.sort
|
110
|
-
print_table(%w{Database Size}, list)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
subcommand "create", "create a database" do
|
114
|
-
parameter "NAME", "name of the database"
|
115
|
-
parameter "[USER]", "user to add to database"
|
116
|
-
parameter "[PASS]", "password of user to add to database"
|
117
|
-
|
118
|
-
def execute
|
119
|
-
db = Rig::Connection.database
|
120
|
-
db.create_database(name, user, pass) unless test?
|
121
|
-
end
|
122
|
-
end
|
123
|
-
subcommand "destroy", "destroy a database" do
|
124
|
-
parameter "NAME", "name of the database"
|
125
|
-
|
126
|
-
def execute
|
127
|
-
db = Rig::Connection.database
|
128
|
-
db.destroy_database(name) unless test?
|
129
|
-
end
|
130
|
-
end
|
131
|
-
self.default_subcommand = "list"
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
81
|
+
end
|
@@ -114,16 +114,25 @@ module Rig
|
|
114
114
|
Rig::Log.info ".. primary: #{name}.env.#@zone #{balancer.attributes[:dns_name]}"
|
115
115
|
Rig::Model::Dns.create("#{name}.env.#@zone", balancer.attributes[:dns_name], :ttl => 30)
|
116
116
|
end
|
117
|
+
|
118
|
+
if b.sticky
|
119
|
+
Rig::Log.info ".. setting stickiness policy"
|
120
|
+
policy_name = 'RigLBStickinessPolicy'
|
121
|
+
type = b.sticky_type
|
122
|
+
expires_or_cookie = b.sticky_arg
|
123
|
+
case type.to_sym
|
124
|
+
when :app, :application
|
125
|
+
Rig::Connection.balancer.create_app_cookie_stickiness_policy("#@name-#{b.name}", policy_name, expires_or_cookie)
|
126
|
+
when :lb, :load_balancer
|
127
|
+
Rig::Connection.balancer.create_lb_cookie_stickiness_policy("#@name-#{b.name}", policy_name, expires_or_cookie)
|
128
|
+
else
|
129
|
+
raise "unknown sticky type #{type}"
|
130
|
+
end
|
131
|
+
end
|
117
132
|
end
|
118
133
|
end
|
119
134
|
|
120
|
-
|
121
|
-
Rig::Log.info "waiting "
|
122
|
-
begin
|
123
|
-
sleep 1
|
124
|
-
reload
|
125
|
-
Rig::Log.info " . #{server_count} != #{@servers.count} : dns=#{@servers.select{|e| e.dns_name.nil? }.count == 0}"
|
126
|
-
end while server_count != @servers.count && @servers.select{|e| e.dns_name.nil? }.count == 0
|
135
|
+
wait_for_dns
|
127
136
|
|
128
137
|
Rig::Log.info "associating servers' DNS"
|
129
138
|
@dnsdelayed.each do |h|
|
@@ -188,8 +197,19 @@ module Rig
|
|
188
197
|
@protected
|
189
198
|
end
|
190
199
|
|
200
|
+
def servers_without_dns
|
201
|
+
@servers.select{|e| e.dns_name.nil? }.count
|
202
|
+
end
|
203
|
+
|
191
204
|
private
|
192
205
|
|
206
|
+
def wait_for_dns
|
207
|
+
while servers_without_dns > 0
|
208
|
+
sleep 2
|
209
|
+
reload
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
193
213
|
def load_config
|
194
214
|
@region = @options[:region] ||
|
195
215
|
Rig.account[:region] ||
|
data/lib/rig/template.rb
CHANGED
@@ -101,12 +101,15 @@ module Rig
|
|
101
101
|
def name
|
102
102
|
@attrs[:name]
|
103
103
|
end
|
104
|
+
|
104
105
|
def roles
|
105
106
|
@attrs[:roles]
|
106
107
|
end
|
108
|
+
|
107
109
|
def groups
|
108
110
|
@attrs[:groups]
|
109
111
|
end
|
112
|
+
|
110
113
|
def dnsnames
|
111
114
|
@attrs[:dnsnames]
|
112
115
|
end
|
@@ -154,12 +157,13 @@ module Rig
|
|
154
157
|
end
|
155
158
|
|
156
159
|
class Balancer
|
157
|
-
attr_reader :name, :sticky_type, :sticky_arg
|
160
|
+
attr_reader :name, :sticky, :primary, :sticky_type, :sticky_arg
|
158
161
|
|
159
162
|
def initialize(name)
|
160
163
|
@listeners = []
|
161
164
|
@name = name.to_sym
|
162
165
|
@primary = false
|
166
|
+
@sticky = false
|
163
167
|
end
|
164
168
|
|
165
169
|
def primary(enable = nil)
|
@@ -176,9 +180,13 @@ module Rig
|
|
176
180
|
@listeners.map { |e| e.spec }
|
177
181
|
end
|
178
182
|
|
179
|
-
def sticky(type, expires_or_cookie)
|
180
|
-
|
181
|
-
|
183
|
+
def sticky(type=nil, expires_or_cookie=nil)
|
184
|
+
if type && expires_or_cookie
|
185
|
+
@sticky = true
|
186
|
+
@sticky_type = type
|
187
|
+
@sticky_arg = expires_or_cookie
|
188
|
+
end
|
189
|
+
@sticky
|
182
190
|
end
|
183
191
|
end
|
184
192
|
|
data/lib/rig/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
|
-
rubygems_version: 1.8.
|
187
|
+
rubygems_version: 1.8.24
|
188
188
|
signing_key:
|
189
189
|
specification_version: 3
|
190
190
|
summary: Cloud provisioning tool built on ruby fog
|