bosh_deployer 0.1.4 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/config/aws_defaults.yml +8 -3
- data/config/vsphere_defaults.yml +4 -0
- data/lib/bosh/cli/commands/micro.rb +17 -13
- data/lib/deployer/config.rb +7 -20
- data/lib/deployer/helpers.rb +26 -0
- data/lib/deployer/instance_manager/aws.rb +234 -0
- data/lib/deployer/instance_manager/vsphere.rb +31 -0
- data/lib/deployer/instance_manager.rb +70 -32
- data/lib/deployer/version.rb +1 -1
- data/lib/deployer.rb +1 -0
- metadata +51 -18
data/config/aws_defaults.yml
CHANGED
@@ -10,6 +10,10 @@ network:
|
|
10
10
|
type: dynamic
|
11
11
|
cloud_properties: {}
|
12
12
|
|
13
|
+
env:
|
14
|
+
bosh:
|
15
|
+
password:
|
16
|
+
|
13
17
|
resources:
|
14
18
|
persistent_disk: 4096
|
15
19
|
cloud_properties:
|
@@ -24,15 +28,16 @@ cloud:
|
|
24
28
|
secret_access_key:
|
25
29
|
ec2_endpoint:
|
26
30
|
max_retries: 2
|
27
|
-
default_key_name:
|
31
|
+
default_key_name:
|
28
32
|
default_security_groups: []
|
33
|
+
ssh_user: vcap
|
29
34
|
registry:
|
30
|
-
endpoint: http://admin:admin@localhost:
|
35
|
+
endpoint: http://admin:admin@localhost:25888
|
31
36
|
user: admin
|
32
37
|
password: admin
|
33
38
|
stemcell:
|
34
39
|
kernel_id:
|
35
|
-
|
40
|
+
disk: 4096
|
36
41
|
agent:
|
37
42
|
ntp: []
|
38
43
|
blobstore:
|
data/config/vsphere_defaults.yml
CHANGED
@@ -5,6 +5,7 @@ require "deployer"
|
|
5
5
|
module Bosh::Cli::Command
|
6
6
|
class Micro < Base
|
7
7
|
include Bosh::Cli::DeploymentHelper
|
8
|
+
include Bosh::Deployer::Helpers
|
8
9
|
|
9
10
|
MICRO_DIRECTOR_PORT = 25555
|
10
11
|
DEFAULT_CONFIG_PATH = File.expand_path("~/.bosh_deployer_config")
|
@@ -85,6 +86,8 @@ module Bosh::Cli::Command
|
|
85
86
|
err "No stemcell provided"
|
86
87
|
end
|
87
88
|
|
89
|
+
err "No deployment set" unless deployment
|
90
|
+
|
88
91
|
rel_path = deployment[/#{Regexp.escape File.join(work_dir, '')}(.*)/, 1]
|
89
92
|
|
90
93
|
desc = "`#{rel_path.green}' to `#{target_name.green}'"
|
@@ -96,7 +99,7 @@ module Bosh::Cli::Command
|
|
96
99
|
|
97
100
|
confirmation = "Updating"
|
98
101
|
|
99
|
-
method = :
|
102
|
+
method = :update_deployment
|
100
103
|
else
|
101
104
|
if deployer.exists?
|
102
105
|
err "Instance exists. Did you mean to --update?"
|
@@ -104,12 +107,12 @@ module Bosh::Cli::Command
|
|
104
107
|
|
105
108
|
confirmation = "Deploying new"
|
106
109
|
|
107
|
-
method = :
|
110
|
+
method = :create_deployment
|
108
111
|
end
|
109
112
|
|
110
113
|
confirm_deployment("#{confirmation} micro BOSH instance #{desc}")
|
111
114
|
|
112
|
-
|
115
|
+
if is_tgz?(tarball_path)
|
113
116
|
stemcell = Bosh::Cli::Stemcell.new(tarball_path, cache)
|
114
117
|
|
115
118
|
say("\nVerifying stemcell...")
|
@@ -159,7 +162,7 @@ module Bosh::Cli::Command
|
|
159
162
|
|
160
163
|
start_time = Time.now
|
161
164
|
|
162
|
-
deployer.
|
165
|
+
deployer.delete_deployment
|
163
166
|
|
164
167
|
renderer.finish("done")
|
165
168
|
|
@@ -184,7 +187,7 @@ module Bosh::Cli::Command
|
|
184
187
|
if manifest["network"].blank?
|
185
188
|
err "network is not defined in deployment manifest"
|
186
189
|
end
|
187
|
-
ip = deployer.discover_bosh_ip || name
|
190
|
+
ip = deployer(manifest_filename).discover_bosh_ip || name
|
188
191
|
|
189
192
|
if target
|
190
193
|
old_director_ip = URI.parse(target).host
|
@@ -207,7 +210,7 @@ module Bosh::Cli::Command
|
|
207
210
|
end
|
208
211
|
|
209
212
|
def list
|
210
|
-
file = File.join(work_dir,
|
213
|
+
file = File.join(work_dir, DEPLOYMENTS_FILE)
|
211
214
|
if File.exists?(file)
|
212
215
|
deployments = load_yaml_file(file)["instances"]
|
213
216
|
else
|
@@ -250,12 +253,12 @@ module Bosh::Cli::Command
|
|
250
253
|
|
251
254
|
private
|
252
255
|
|
253
|
-
def deployer
|
256
|
+
def deployer(manifest_filename=nil)
|
254
257
|
check_if_deployments_dir
|
255
|
-
deployment_required
|
258
|
+
deployment_required unless manifest_filename
|
256
259
|
|
257
260
|
if @deployer.nil?
|
258
|
-
manifest_filename
|
261
|
+
manifest_filename ||= deployment
|
259
262
|
|
260
263
|
if !File.exists?(manifest_filename)
|
261
264
|
err("Cannot find deployment manifest in `#{manifest_filename}'")
|
@@ -265,12 +268,13 @@ module Bosh::Cli::Command
|
|
265
268
|
|
266
269
|
manifest["dir"] ||= work_dir
|
267
270
|
manifest["logging"] ||= {}
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
+
unless manifest["logging"]["file"]
|
272
|
+
log_file = File.join(File.dirname(manifest_filename),
|
273
|
+
"bosh_micro_deploy.log")
|
274
|
+
manifest["logging"]["file"] = log_file
|
271
275
|
end
|
272
276
|
|
273
|
-
@deployer = Bosh::Deployer::InstanceManager.
|
277
|
+
@deployer = Bosh::Deployer::InstanceManager.create(manifest)
|
274
278
|
|
275
279
|
$stderr.reopen("/dev/null") #silence ssl warnings
|
276
280
|
end
|
data/lib/deployer/config.rb
CHANGED
@@ -7,17 +7,15 @@ module Bosh::Deployer
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
-
|
10
|
+
include Helpers
|
11
|
+
|
12
|
+
attr_accessor :logger, :db, :uuid, :resources, :cloud_options,
|
13
|
+
:spec_properties, :bosh_ip, :env
|
11
14
|
|
12
15
|
def configure(config)
|
13
|
-
|
14
|
-
raise ConfigError, "No cloud properties defined"
|
15
|
-
end
|
16
|
-
if config["cloud"]["plugin"].nil?
|
17
|
-
raise ConfigError, "No cloud plugin defined"
|
18
|
-
end
|
16
|
+
plugin = cloud_plugin(config)
|
19
17
|
|
20
|
-
config = deep_merge(load_defaults(
|
18
|
+
config = deep_merge(load_defaults(plugin), config)
|
21
19
|
|
22
20
|
@base_dir = config["dir"]
|
23
21
|
FileUtils.mkdir_p(@base_dir)
|
@@ -26,6 +24,7 @@ module Bosh::Deployer
|
|
26
24
|
@net_conf = config["network"]
|
27
25
|
@bosh_ip = @net_conf["ip"]
|
28
26
|
@resources = config["resources"]
|
27
|
+
@env = config["env"]
|
29
28
|
|
30
29
|
@logger = Logger.new(config["logging"]["file"] || STDOUT)
|
31
30
|
@logger.level = Logger.const_get(config["logging"]["level"].upcase)
|
@@ -67,18 +66,6 @@ module Bosh::Deployer
|
|
67
66
|
@networks = nil
|
68
67
|
end
|
69
68
|
|
70
|
-
def disk_model
|
71
|
-
if @disk_model.nil?
|
72
|
-
case @cloud_options["plugin"]
|
73
|
-
when "vsphere"
|
74
|
-
require "cloud/vsphere"
|
75
|
-
@disk_model = VSphereCloud::Models::Disk
|
76
|
-
else
|
77
|
-
end
|
78
|
-
end
|
79
|
-
@disk_model
|
80
|
-
end
|
81
|
-
|
82
69
|
def cloud
|
83
70
|
if @cloud.nil?
|
84
71
|
@cloud = Bosh::Clouds::Provider.create(@cloud_options["plugin"],
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
+
|
3
|
+
module Bosh::Deployer
|
4
|
+
|
5
|
+
module Helpers
|
6
|
+
|
7
|
+
DEPLOYMENTS_FILE = "bosh-deployments.yml"
|
8
|
+
|
9
|
+
def is_tgz?(path)
|
10
|
+
File.extname(path) == ".tgz"
|
11
|
+
end
|
12
|
+
|
13
|
+
def cloud_plugin(config)
|
14
|
+
if config["cloud"].nil?
|
15
|
+
raise ConfigError, "No cloud properties defined"
|
16
|
+
end
|
17
|
+
if config["cloud"]["plugin"].nil?
|
18
|
+
raise ConfigError, "No cloud plugin defined"
|
19
|
+
end
|
20
|
+
|
21
|
+
config["cloud"]["plugin"]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,234 @@
|
|
1
|
+
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
+
|
3
|
+
require 'net/ssh'
|
4
|
+
|
5
|
+
module Bosh::Deployer
|
6
|
+
class InstanceManager
|
7
|
+
|
8
|
+
class Aws < InstanceManager
|
9
|
+
|
10
|
+
def update_spec(spec)
|
11
|
+
spec = super(spec)
|
12
|
+
properties = spec["properties"]
|
13
|
+
|
14
|
+
properties["aws"] =
|
15
|
+
Config.spec_properties["aws"] ||
|
16
|
+
Config.cloud_options["properties"]["aws"].dup
|
17
|
+
|
18
|
+
properties["aws"]["registry"] = Config.cloud_options["properties"]["registry"]
|
19
|
+
properties["aws"]["stemcell"] = Config.cloud_options["properties"]["stemcell"]
|
20
|
+
|
21
|
+
spec.delete("networks")
|
22
|
+
|
23
|
+
spec
|
24
|
+
end
|
25
|
+
|
26
|
+
def configure
|
27
|
+
properties = Config.cloud_options["properties"]
|
28
|
+
@ssh_user = properties["aws"]["ssh_user"]
|
29
|
+
@ssh_port = properties["aws"]["ssh_port"] || 22
|
30
|
+
@ssh_wait = properties["aws"]["ssh_wait"] || 60
|
31
|
+
|
32
|
+
key = properties["aws"]["ec2_private_key"]
|
33
|
+
unless key
|
34
|
+
raise ConfigError, "Missing properties.aws.ec2_private_key"
|
35
|
+
end
|
36
|
+
@ssh_key = File.expand_path(key)
|
37
|
+
unless File.exists?(@ssh_key)
|
38
|
+
raise ConfigError, "properties.aws.ec2_private_key '#{key}' does not exist"
|
39
|
+
end
|
40
|
+
|
41
|
+
uri = URI.parse(properties["registry"]["endpoint"])
|
42
|
+
user, password = uri.userinfo.split(":", 2)
|
43
|
+
@registry_port = uri.port
|
44
|
+
|
45
|
+
@registry_db = Tempfile.new("aws_registry_db")
|
46
|
+
@registry_db_url = "sqlite://#{@registry_db.path}"
|
47
|
+
|
48
|
+
registry_config = {
|
49
|
+
"logfile" => "./aws_registry.log",
|
50
|
+
"http" => {
|
51
|
+
"port" => uri.port,
|
52
|
+
"user" => user,
|
53
|
+
"password" => password
|
54
|
+
},
|
55
|
+
"db" => {
|
56
|
+
"database" => @registry_db_url
|
57
|
+
},
|
58
|
+
"aws" => properties["aws"]
|
59
|
+
}
|
60
|
+
|
61
|
+
@registry_config = Tempfile.new("aws_registry_yml")
|
62
|
+
@registry_config.write(YAML.dump(registry_config))
|
63
|
+
@registry_config.close
|
64
|
+
end
|
65
|
+
|
66
|
+
def start
|
67
|
+
configure()
|
68
|
+
|
69
|
+
Sequel.connect(@registry_db_url) do |db|
|
70
|
+
migrate(db)
|
71
|
+
instances = @deployments["aws_instances"]
|
72
|
+
db[:aws_instances].insert_multiple(instances) if instances
|
73
|
+
end
|
74
|
+
|
75
|
+
unless has_aws_registry?
|
76
|
+
raise "aws_registry command not found - " +
|
77
|
+
"run 'gem install bosh_aws_registry'"
|
78
|
+
end
|
79
|
+
|
80
|
+
cmd = "aws_registry -c #{@registry_config.path}"
|
81
|
+
|
82
|
+
@registry_pid = spawn(cmd)
|
83
|
+
|
84
|
+
5.times do
|
85
|
+
sleep 0.5
|
86
|
+
if Process.waitpid(@registry_pid, Process::WNOHANG)
|
87
|
+
raise Error, "`#{cmd}` failed, exit status=#{$?.exitstatus}"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
timeout_time = Time.now.to_f + (60 * 5)
|
92
|
+
http_client = HTTPClient.new()
|
93
|
+
begin
|
94
|
+
http_client.head("http://127.0.0.1:#{@registry_port}")
|
95
|
+
sleep 0.5
|
96
|
+
rescue URI::Error, SocketError, Errno::ECONNREFUSED => e
|
97
|
+
if timeout_time - Time.now.to_f > 0
|
98
|
+
retry
|
99
|
+
else
|
100
|
+
raise "Cannot access aws_registry: #{e.message}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
logger.info("aws_registry is ready on port #{@registry_port}")
|
104
|
+
ensure
|
105
|
+
@registry_config.unlink if @registry_config
|
106
|
+
end
|
107
|
+
|
108
|
+
def stop
|
109
|
+
if @registry_pid && process_exists?(@registry_pid)
|
110
|
+
Process.kill("INT", @registry_pid)
|
111
|
+
Process.waitpid(@registry_pid)
|
112
|
+
end
|
113
|
+
|
114
|
+
return unless @registry_db_url
|
115
|
+
|
116
|
+
Sequel.connect(@registry_db_url) do |db|
|
117
|
+
@deployments["aws_instances"] = db[:aws_instances].map {|row| row}
|
118
|
+
end
|
119
|
+
|
120
|
+
save_state
|
121
|
+
@registry_db.unlink if @registry_db
|
122
|
+
end
|
123
|
+
|
124
|
+
def wait_until_agent_ready
|
125
|
+
tunnel(@registry_port)
|
126
|
+
super
|
127
|
+
end
|
128
|
+
|
129
|
+
def discover_bosh_ip
|
130
|
+
if exists?
|
131
|
+
ip = cloud.ec2.instances[state.vm_cid].public_ip_address
|
132
|
+
if ip != Config.bosh_ip
|
133
|
+
Config.bosh_ip = ip
|
134
|
+
logger.info("discovered bosh ip=#{Config.bosh_ip}")
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
super
|
139
|
+
end
|
140
|
+
|
141
|
+
def service_ip
|
142
|
+
cloud.ec2.instances[state.vm_cid].private_ip_address
|
143
|
+
end
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
# TODO this code is simliar to has_stemcell_copy?
|
148
|
+
# move the two into bosh_common later
|
149
|
+
def has_aws_registry?(path=ENV['PATH'])
|
150
|
+
path.split(":").each do |dir|
|
151
|
+
return true if File.exist?(File.join(dir, "aws_registry"))
|
152
|
+
end
|
153
|
+
false
|
154
|
+
end
|
155
|
+
|
156
|
+
def migrate(db)
|
157
|
+
db.create_table :aws_instances do
|
158
|
+
primary_key :id
|
159
|
+
column :instance_id, :text, :unique => true, :null => false
|
160
|
+
column :settings, :text, :null => false
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def process_exists?(pid)
|
165
|
+
begin
|
166
|
+
Process.kill(0, pid)
|
167
|
+
rescue Errno::ESRCH
|
168
|
+
false
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def socket_readable?(ip, port)
|
173
|
+
socket = TCPSocket.new(ip, port)
|
174
|
+
if IO.select([socket], nil, nil, 5)
|
175
|
+
logger.debug("tcp socket #{ip}:#{port} is readable")
|
176
|
+
yield
|
177
|
+
true
|
178
|
+
else
|
179
|
+
false
|
180
|
+
end
|
181
|
+
rescue SocketError => e
|
182
|
+
logger.debug("tcp socket #{ip}:#{port} SocketError: #{e.inspect}")
|
183
|
+
sleep 1
|
184
|
+
false
|
185
|
+
rescue SystemCallError => e
|
186
|
+
logger.debug("tcp socket #{ip}:#{port} SystemCallError: #{e.inspect}")
|
187
|
+
sleep 1
|
188
|
+
false
|
189
|
+
ensure
|
190
|
+
socket.close if socket
|
191
|
+
end
|
192
|
+
|
193
|
+
def tunnel(port)
|
194
|
+
return if @session
|
195
|
+
|
196
|
+
ip = discover_bosh_ip
|
197
|
+
|
198
|
+
loop until socket_readable?(ip, @ssh_port) do
|
199
|
+
#sshd is up, sleep while host keys are generated
|
200
|
+
sleep @ssh_wait
|
201
|
+
end
|
202
|
+
|
203
|
+
lo = "127.0.0.1"
|
204
|
+
cmd = "ssh -R #{port}:#{lo}:#{port} #{@ssh_user}@#{ip}"
|
205
|
+
|
206
|
+
logger.info("Preparing for ssh tunnel: #{cmd}")
|
207
|
+
loop do
|
208
|
+
begin
|
209
|
+
@session = Net::SSH.start(ip, @ssh_user, :keys => [@ssh_key],
|
210
|
+
:paranoid => false)
|
211
|
+
logger.debug("ssh #{@ssh_user}@#{ip}: ESTABLISHED")
|
212
|
+
break
|
213
|
+
rescue => e
|
214
|
+
logger.debug("ssh start #{@ssh_user}@#{ip} failed: #{e.inspect}")
|
215
|
+
sleep 1
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
@session.forward.remote(port, lo, port)
|
220
|
+
logger.info("`#{cmd}` started: OK")
|
221
|
+
|
222
|
+
Thread.new do
|
223
|
+
begin
|
224
|
+
@session.loop { true }
|
225
|
+
rescue IOError => e
|
226
|
+
logger.debug("`#{cmd}` terminated: #{e.inspect}")
|
227
|
+
@session = nil
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
+
|
3
|
+
module Bosh::Deployer
|
4
|
+
class InstanceManager
|
5
|
+
|
6
|
+
class Vsphere < InstanceManager
|
7
|
+
|
8
|
+
def disk_model
|
9
|
+
if @disk_model.nil?
|
10
|
+
require "cloud/vsphere"
|
11
|
+
@disk_model = VSphereCloud::Models::Disk
|
12
|
+
end
|
13
|
+
@disk_model
|
14
|
+
end
|
15
|
+
|
16
|
+
def update_spec(spec)
|
17
|
+
spec = super(spec)
|
18
|
+
properties = spec["properties"]
|
19
|
+
|
20
|
+
properties["vcenter"] =
|
21
|
+
Config.spec_properties["vcenter"] ||
|
22
|
+
Config.cloud_options["properties"]["vcenters"].first.dup
|
23
|
+
|
24
|
+
properties["vcenter"]["address"] ||= properties["vcenter"]["host"]
|
25
|
+
|
26
|
+
spec
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Bosh::Deployer
|
4
4
|
class InstanceManager
|
5
5
|
|
6
|
-
|
6
|
+
include Helpers
|
7
7
|
|
8
8
|
attr_reader :state
|
9
9
|
attr_accessor :renderer
|
@@ -27,6 +27,23 @@ module Bosh::Deployer
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
class << self
|
31
|
+
|
32
|
+
include Helpers
|
33
|
+
|
34
|
+
def create(config)
|
35
|
+
plugin = cloud_plugin(config)
|
36
|
+
|
37
|
+
begin
|
38
|
+
require "deployer/instance_manager/#{plugin}"
|
39
|
+
rescue LoadError
|
40
|
+
raise Error, "Could not find Provider Plugin: #{plugin}"
|
41
|
+
end
|
42
|
+
Bosh::Deployer::InstanceManager.const_get(plugin.capitalize).new(config)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
30
47
|
def initialize(config)
|
31
48
|
Config.configure(config)
|
32
49
|
|
@@ -51,7 +68,7 @@ module Bosh::Deployer
|
|
51
68
|
end
|
52
69
|
|
53
70
|
def disk_model
|
54
|
-
|
71
|
+
nil
|
55
72
|
end
|
56
73
|
|
57
74
|
def instance_model
|
@@ -69,6 +86,37 @@ module Bosh::Deployer
|
|
69
86
|
result
|
70
87
|
end
|
71
88
|
|
89
|
+
def start
|
90
|
+
end
|
91
|
+
|
92
|
+
def stop
|
93
|
+
end
|
94
|
+
|
95
|
+
def with_lifecycle
|
96
|
+
start
|
97
|
+
yield
|
98
|
+
ensure
|
99
|
+
stop
|
100
|
+
end
|
101
|
+
|
102
|
+
def create_deployment(stemcell_tgz)
|
103
|
+
with_lifecycle do
|
104
|
+
create(stemcell_tgz)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def update_deployment(stemcell_tgz)
|
109
|
+
with_lifecycle do
|
110
|
+
update(stemcell_tgz)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def delete_deployment
|
115
|
+
with_lifecycle do
|
116
|
+
destroy
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
72
120
|
def create(stemcell_tgz)
|
73
121
|
if state.vm_cid
|
74
122
|
raise ConfigError, "VM #{state.vm_cid} already exists"
|
@@ -102,6 +150,12 @@ module Bosh::Deployer
|
|
102
150
|
update_persistent_disk
|
103
151
|
end
|
104
152
|
|
153
|
+
unless @apply_spec
|
154
|
+
step "Fetching apply spec" do
|
155
|
+
@apply_spec = agent.release_apply_spec
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
105
159
|
apply(@apply_spec)
|
106
160
|
|
107
161
|
step "Waiting for the director" do
|
@@ -129,14 +183,10 @@ module Bosh::Deployer
|
|
129
183
|
end
|
130
184
|
|
131
185
|
def create_stemcell(stemcell_tgz)
|
132
|
-
|
186
|
+
unless is_tgz?(stemcell_tgz)
|
133
187
|
step "Using existing stemcell" do
|
134
188
|
end
|
135
189
|
|
136
|
-
step "Loading apply spec" do
|
137
|
-
@apply_spec = load_apply_spec("#{stemcell_tgz}/apply_spec.yml")
|
138
|
-
end
|
139
|
-
|
140
190
|
return stemcell_tgz
|
141
191
|
end
|
142
192
|
|
@@ -145,7 +195,11 @@ module Bosh::Deployer
|
|
145
195
|
run_command("tar -zxf #{stemcell_tgz} -C #{stemcell}")
|
146
196
|
end
|
147
197
|
|
148
|
-
|
198
|
+
spec_file = "#{stemcell}/apply_spec.yml"
|
199
|
+
unless File.exist?(spec_file)
|
200
|
+
raise "this isn't a micro bosh stemcell - apply_spec.yml missing"
|
201
|
+
end
|
202
|
+
@apply_spec = load_apply_spec(spec_file)
|
149
203
|
properties = Config.cloud_options["properties"]["stemcell"]
|
150
204
|
|
151
205
|
step "Uploading stemcell" do
|
@@ -157,7 +211,8 @@ module Bosh::Deployer
|
|
157
211
|
def create_vm(stemcell_cid)
|
158
212
|
resources = Config.resources['cloud_properties']
|
159
213
|
networks = Config.networks
|
160
|
-
|
214
|
+
env = Config.env
|
215
|
+
cloud.create_vm(state.uuid, stemcell_cid, resources, networks, nil, env)
|
161
216
|
end
|
162
217
|
|
163
218
|
def mount_disk(disk_cid)
|
@@ -271,30 +326,13 @@ module Bosh::Deployer
|
|
271
326
|
|
272
327
|
%w{blobstore postgres director redis nats aws_registry}.each do |service|
|
273
328
|
next unless properties[service]
|
274
|
-
properties[service]["address"] =
|
329
|
+
properties[service]["address"] = service_ip
|
275
330
|
|
276
331
|
if override = Config.spec_properties[service]
|
277
332
|
properties[service].merge!(override)
|
278
333
|
end
|
279
334
|
end
|
280
335
|
|
281
|
-
case Config.cloud_options["plugin"]
|
282
|
-
when "vsphere"
|
283
|
-
properties["vcenter"] =
|
284
|
-
Config.spec_properties["vcenter"] ||
|
285
|
-
Config.cloud_options["properties"]["vcenters"].first.dup
|
286
|
-
|
287
|
-
properties["vcenter"]["address"] ||= properties["vcenter"]["host"]
|
288
|
-
when "aws"
|
289
|
-
properties["aws"] =
|
290
|
-
Config.spec_properties["aws"] ||
|
291
|
-
Config.cloud_options["properties"]["aws"].dup
|
292
|
-
|
293
|
-
properties["aws"]["registry"] = Config.cloud_options["properties"]["registry"]
|
294
|
-
properties["aws"]["stemcell"] = Config.cloud_options["properties"]["stemcell"]
|
295
|
-
else
|
296
|
-
end
|
297
|
-
|
298
336
|
spec
|
299
337
|
end
|
300
338
|
|
@@ -309,11 +347,11 @@ module Bosh::Deployer
|
|
309
347
|
end
|
310
348
|
|
311
349
|
def discover_bosh_ip
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
350
|
+
bosh_ip
|
351
|
+
end
|
352
|
+
|
353
|
+
def service_ip
|
354
|
+
bosh_ip
|
317
355
|
end
|
318
356
|
|
319
357
|
private
|
data/lib/deployer/version.rb
CHANGED
data/lib/deployer.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_deployer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bosh_common
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 0.4.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.4.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: bosh_cpi
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 0.4.2
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.4.2
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: bosh_vsphere_cpi
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,21 +53,31 @@ dependencies:
|
|
43
53
|
version: 0.4.8
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.4.8
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: bosh_aws_cpi
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
69
|
+
version: 0.5.0
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.5.0
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: agent_client
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ~>
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: 0.1.1
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.1.1
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: sqlite3
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ~>
|
@@ -76,7 +101,12 @@ dependencies:
|
|
76
101
|
version: 1.3.3
|
77
102
|
type: :runtime
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.3.3
|
80
110
|
description: Micro BOSH Deployer
|
81
111
|
email: support@vmware.com
|
82
112
|
executables: []
|
@@ -89,7 +119,10 @@ files:
|
|
89
119
|
- lib/deployer.rb
|
90
120
|
- lib/deployer/config.rb
|
91
121
|
- lib/deployer/errors.rb
|
122
|
+
- lib/deployer/helpers.rb
|
92
123
|
- lib/deployer/instance_manager.rb
|
124
|
+
- lib/deployer/instance_manager/aws.rb
|
125
|
+
- lib/deployer/instance_manager/vsphere.rb
|
93
126
|
- lib/deployer/models/instance.rb
|
94
127
|
- lib/deployer/version.rb
|
95
128
|
- README.rdoc
|
@@ -109,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
142
|
version: '0'
|
110
143
|
segments:
|
111
144
|
- 0
|
112
|
-
hash: -
|
145
|
+
hash: -4260462944740584037
|
113
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
147
|
none: false
|
115
148
|
requirements:
|
@@ -118,10 +151,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
151
|
version: '0'
|
119
152
|
segments:
|
120
153
|
- 0
|
121
|
-
hash: -
|
154
|
+
hash: -4260462944740584037
|
122
155
|
requirements: []
|
123
156
|
rubyforge_project:
|
124
|
-
rubygems_version: 1.8.
|
157
|
+
rubygems_version: 1.8.24
|
125
158
|
signing_key:
|
126
159
|
specification_version: 3
|
127
160
|
summary: Micro BOSH Deployer
|