bosh-bootstrap 0.7.0 → 0.7.1
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 -1
- data/README.md +4 -3
- data/lib/bosh-bootstrap/cli.rb +21 -19
- data/lib/bosh-bootstrap/commander/remote_server.rb +9 -4
- data/lib/bosh-bootstrap/version.rb +1 -1
- data/spec/unit/aws_spec.rb +2 -0
- data/spec/unit/cli_spec.rb +12 -2
- data/spec/unit/cli_ssh_spec.rb +4 -3
- metadata +3 -3
data/ChangeLog.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
`bosh-bootstrap` is a command line tool that you can run on your laptop and automatically get a microbosh (and an inception VM) deployed on either AWS or OpenStack.
|
4
|
+
|
3
5
|
## v0.7
|
4
6
|
|
5
7
|
Notable:
|
6
8
|
|
7
9
|
* For existing users: please run "deploy --upgrade-deps" as new inception package (runit) added; and jazor/yaml_command CLIs installed
|
8
|
-
* Forces microbosh
|
10
|
+
* Forces use of microbosh stemcell 0.8.1 which work with public gems (latest public stemcell does not work with public gems)
|
9
11
|
|
10
12
|
Added:
|
11
13
|
|
@@ -26,6 +28,13 @@ Work in progress:
|
|
26
28
|
* AWS VPC support was begin by the core BOSH team; though work has stopped sadly.
|
27
29
|
* Growing number of specs mostly using Fog.mock! mode; tests being run on travis
|
28
30
|
|
31
|
+
### v0.7.1
|
32
|
+
|
33
|
+
* Make "deploy --private-key" option work [thx @dpw]
|
34
|
+
* Add hypervisor for OpenStack stemcells [thx @frodenas]
|
35
|
+
* Don't fail if `settings.fog_credentials.openstack_region` doesn't exist
|
36
|
+
* Fix README for changed location of bosh-release [thx @scottfrederick]
|
37
|
+
* No need to show --latest-stemcell in README tutorial
|
29
38
|
|
30
39
|
## v0.6
|
31
40
|
|
data/README.md
CHANGED
@@ -33,6 +33,7 @@ This bootstrapper tool is distributed as a RubyGem for Ruby 1.9+.
|
|
33
33
|
```
|
34
34
|
$ ruby -v
|
35
35
|
ruby 1.9.3p385 ...
|
36
|
+
$ gem install net-ssh -v 2.2.2
|
36
37
|
$ gem install bosh-bootstrap
|
37
38
|
```
|
38
39
|
|
@@ -43,7 +44,7 @@ $ gem install bosh-bootstrap
|
|
43
44
|
The first time you use `bosh-bootstrap` it will create everything necessary. The example output below includes user prompts.
|
44
45
|
|
45
46
|
```
|
46
|
-
$ bosh-bootstrap deploy
|
47
|
+
$ bosh-bootstrap deploy
|
47
48
|
|
48
49
|
Stage 1: Choose infrastructure
|
49
50
|
|
@@ -187,7 +188,7 @@ A running BOSH, whether it is running on a single server or a cluster of servers
|
|
187
188
|
* PostgreSQL
|
188
189
|
* Redis
|
189
190
|
|
190
|
-
When you deploy a BOSH using the BOSH Deployer (`bosh micro deploy`) or indirectly via the BOSH Bootstrapper, you are actually deploying a BOSH release that describes a BOSH called [bosh-release](https://github.com/cloudfoundry/bosh
|
191
|
+
When you deploy a BOSH using the BOSH Deployer (`bosh micro deploy`) or indirectly via the BOSH Bootstrapper, you are actually deploying a BOSH release that describes a BOSH called [bosh-release](https://github.com/cloudfoundry/bosh/tree/master/release). The processes listed above are called "jobs" and you can see the full list of jobs inside a BOSH within the [jobs/ directory](https://github.com/cloudfoundry/bosh/tree/master/release/jobs) of the `bosh` repository.
|
191
192
|
|
192
193
|
But you don't yet have a BOSH to deploy another BOSH.
|
193
194
|
|
@@ -208,7 +209,7 @@ $ bosh public stemcells --tag micro
|
|
208
209
|
$ bosh download public stemcell micro-bosh-stemcell-aws-0.6.4.tgz
|
209
210
|
```
|
210
211
|
|
211
|
-
The CloudFoundry BOSH team will release new public stemcells
|
212
|
+
The CloudFoundry BOSH team will release new public stemcells over time. The BOSH Deployer allows you to upgrade to newer stemcells as easily as it is to deploy a Micro BOSH initially.
|
212
213
|
|
213
214
|
```
|
214
215
|
$ bosh micro deploy micro-bosh-stemcell-aws-0.6.4.tgz
|
data/lib/bosh-bootstrap/cli.rb
CHANGED
@@ -361,15 +361,9 @@ module Bosh::Bootstrap
|
|
361
361
|
|
362
362
|
username = 'vcap'
|
363
363
|
host = settings.inception[:host]
|
364
|
-
|
364
|
+
_, private_key_path = local_ssh_key_paths
|
365
|
+
result = system Escape.shell_command(['ssh', "-i", "#{private_key_path}", "#{username}@#{host}", cmd].flatten.compact)
|
365
366
|
exit result
|
366
|
-
|
367
|
-
# TODO how to use the specific private_key_path as configured in settings
|
368
|
-
# _, private_key_path = local_ssh_key_paths
|
369
|
-
# exit system Escape.shell_command(['ssh', "-i #{private_key_path}", "#{username}@#{host}", cmd].compact)
|
370
|
-
#
|
371
|
-
# Currently this shows:
|
372
|
-
# Warning: Identity file /Users/drnic/.ssh/id_rsa not accessible: No such file or directory.
|
373
367
|
end
|
374
368
|
|
375
369
|
def ensure_inception_vm
|
@@ -453,6 +447,9 @@ module Bosh::Bootstrap
|
|
453
447
|
settings["git"] ||= {}
|
454
448
|
settings["git"]["name"] ||= `git config user.name`.strip
|
455
449
|
settings["git"]["email"] ||= `git config user.email`.strip
|
450
|
+
if settings["git"]["name"].empty? || settings["git"]["email"].empty?
|
451
|
+
error "Cannot find your git identity. Please set git user.name and user.email before proceeding"
|
452
|
+
end
|
456
453
|
|
457
454
|
settings["bosh_git_source"] = options[:"edge-deployer"] # use bosh git repo instead of rubygems
|
458
455
|
|
@@ -721,7 +718,7 @@ module Bosh::Bootstrap
|
|
721
718
|
end
|
722
719
|
|
723
720
|
def prompt_openstack_region
|
724
|
-
default_region = settings
|
721
|
+
default_region = settings["fog_credentials"] && settings["fog_credentials"]["openstack_region"]
|
725
722
|
region = hl.ask("OpenStack Region (optional): ") { |q| q.default = default_region }
|
726
723
|
settings[:region_code] = region.strip == "" ? nil : region
|
727
724
|
return false unless settings[:region_code]
|
@@ -1127,7 +1124,8 @@ module Bosh::Bootstrap
|
|
1127
1124
|
# for the target provider (aws, vsphere, openstack)
|
1128
1125
|
# The name includes the version number.
|
1129
1126
|
def micro_bosh_stemcell_name
|
1130
|
-
|
1127
|
+
hypersivor = openstack? ? "-kvm" : ""
|
1128
|
+
@micro_bosh_stemcell_name ||= "micro-bosh-stemcell-#{provider_name}#{hypersivor}-#{known_stable_micro_bosh_stemcell_version}.tgz"
|
1131
1129
|
end
|
1132
1130
|
|
1133
1131
|
def known_stable_micro_bosh_stemcell_version
|
@@ -1147,15 +1145,19 @@ module Bosh::Bootstrap
|
|
1147
1145
|
say "Locating micro-bosh stemcell, running '#{bosh_stemcells_cmd}'..."
|
1148
1146
|
#
|
1149
1147
|
# The +bosh_stemcells_cmd+ has an output that looks like:
|
1150
|
-
#
|
1151
|
-
# | Name
|
1152
|
-
#
|
1153
|
-
# | micro-bosh-stemcell-aws-0.6.4.tgz
|
1154
|
-
# | micro-bosh-stemcell-aws-0.7.0.tgz
|
1155
|
-
# | micro-bosh-stemcell-aws-0.8.1.tgz
|
1156
|
-
# | micro-bosh-stemcell-aws-1.5.0.pre1.tgz
|
1157
|
-
# | micro-bosh-stemcell-aws-1.5.0.pre2.tgz
|
1158
|
-
#
|
1148
|
+
# +--------------------------------------------------+-----------------------------+
|
1149
|
+
# | Name | Tags |
|
1150
|
+
# +--------------------------------------------------+-----------------------------+
|
1151
|
+
# | micro-bosh-stemcell-aws-0.6.4.tgz | aws, micro, stable |
|
1152
|
+
# | micro-bosh-stemcell-aws-0.7.0.tgz | aws, micro, test |
|
1153
|
+
# | micro-bosh-stemcell-aws-0.8.1.tgz | aws, micro, test |
|
1154
|
+
# | micro-bosh-stemcell-aws-1.5.0.pre1.tgz | aws, micro |
|
1155
|
+
# | micro-bosh-stemcell-aws-1.5.0.pre2.tgz | aws, micro |
|
1156
|
+
# | micro-bosh-stemcell-openstack-0.7.0.tgz | openstack, micro, test |
|
1157
|
+
# | micro-bosh-stemcell-openstack-kvm-0.8.1.tgz | openstack, kvm, micro, test |
|
1158
|
+
# | micro-bosh-stemcell-openstack-kvm-1.5.0.pre1.tgz | openstack, kvm, micro |
|
1159
|
+
# | micro-bosh-stemcell-openstack-kvm-1.5.0.pre2.tgz | openstack, kvm, micro |
|
1160
|
+
# +--------------------------------------------------+-----------------------------+
|
1159
1161
|
#
|
1160
1162
|
# So to get the latest version for the filter tags,
|
1161
1163
|
# get the Name field, reverse sort, and return the first item
|
@@ -77,7 +77,7 @@ class Bosh::Bootstrap::Commander::RemoteServer
|
|
77
77
|
file << contents
|
78
78
|
file.flush
|
79
79
|
logfile.puts "uploading #{remote_path} to Inception VM"
|
80
|
-
Net::SCP.upload!(host, upload_as_user, file.path, remote_path)
|
80
|
+
Net::SCP.upload!(host, upload_as_user, file.path, remote_path, ssh: { keys: keys_array })
|
81
81
|
end
|
82
82
|
true
|
83
83
|
rescue StandardError => e
|
@@ -102,8 +102,7 @@ class Bosh::Bootstrap::Commander::RemoteServer
|
|
102
102
|
"bash -lc 'sudo /usr/bin/env PATH=$PATH #{remote_path}'"
|
103
103
|
]
|
104
104
|
script_output = ""
|
105
|
-
|
106
|
-
results = Fog::SSH.new(host, username, keys: keys).run(commands) do |stdout, stderr|
|
105
|
+
results = Fog::SSH.new(host, username, keys: keys_array).run(commands) do |stdout, stderr|
|
107
106
|
[stdout, stderr].flatten.each do |data|
|
108
107
|
logfile << data
|
109
108
|
script_output << data
|
@@ -114,8 +113,14 @@ class Bosh::Bootstrap::Commander::RemoteServer
|
|
114
113
|
[script_output, result_success]
|
115
114
|
end
|
116
115
|
|
116
|
+
# Produce the :keys option for Net::SSH
|
117
|
+
def keys_array
|
118
|
+
# path to local private key being used
|
119
|
+
[private_key_path]
|
120
|
+
end
|
121
|
+
|
117
122
|
def run_remote_command(command, username)
|
118
|
-
Net::SSH.start(host, username) do |ssh|
|
123
|
+
Net::SSH.start(host, username, keys: keys_array) do |ssh|
|
119
124
|
ssh.exec!("bash -lc '#{command}'") do |channel, stream, data|
|
120
125
|
logfile << data
|
121
126
|
end
|
data/spec/unit/aws_spec.rb
CHANGED
@@ -28,6 +28,8 @@ describe "AWS deployment" do
|
|
28
28
|
setting "fog_credentials", @fog_credentials.stringify_keys
|
29
29
|
setting "bosh.salted_password", "pepper"
|
30
30
|
setting "bosh.persistent_disk", 16384
|
31
|
+
setting "git.name", "Dr Nic Williams"
|
32
|
+
setting "git.email", "drnicwilliams@gmail.com"
|
31
33
|
end
|
32
34
|
|
33
35
|
# used by +SettingsSetter+ to access the settings
|
data/spec/unit/cli_spec.rb
CHANGED
@@ -10,6 +10,8 @@ describe Bosh::Bootstrap do
|
|
10
10
|
ENV['MANIFEST'] = File.expand_path("../../../tmp/test-manifest.yml", __FILE__)
|
11
11
|
rm_rf(ENV['MANIFEST'])
|
12
12
|
@cmd = Bosh::Bootstrap::Cli.new
|
13
|
+
setting "git.name", "Dr Nic Williams"
|
14
|
+
setting "git.email", "drnicwilliams@gmail.com"
|
13
15
|
end
|
14
16
|
|
15
17
|
# stub out all stages except a specific one
|
@@ -56,8 +58,6 @@ describe Bosh::Bootstrap do
|
|
56
58
|
|
57
59
|
it "stage 4 - prepare inception VM" do
|
58
60
|
testing_stage(4)
|
59
|
-
setting "git.name", "Dr Nic Williams"
|
60
|
-
setting "git.email", "drnicwilliams@gmail.com"
|
61
61
|
setting "inception.username", "ubuntu"
|
62
62
|
setting "bosh.password", "UNSALTED"
|
63
63
|
@cmd.should_receive(:run_server).and_return(true)
|
@@ -109,9 +109,19 @@ describe Bosh::Bootstrap do
|
|
109
109
|
# get the Name field, reverse sort, and return the first item
|
110
110
|
it "should return the latest stable stemcell by default for AWS" do
|
111
111
|
@cmd.settings["bosh_provider"] = "aws"
|
112
|
+
@cmd.settings["fog_credentials"] = {}
|
113
|
+
@cmd.settings["fog_credentials"]["provider"] = "aws"
|
112
114
|
@cmd.should_receive(:known_stable_micro_bosh_stemcell_version).and_return("0.8.1")
|
113
115
|
@cmd.micro_bosh_stemcell_name.should == "micro-bosh-stemcell-aws-0.8.1.tgz"
|
114
116
|
end
|
117
|
+
|
118
|
+
it "should return the latest stable stemcell by default for OpenStack" do
|
119
|
+
@cmd.settings["bosh_provider"] = "openstack"
|
120
|
+
@cmd.settings["fog_credentials"] = {}
|
121
|
+
@cmd.settings["fog_credentials"]["provider"] = "OpenStack"
|
122
|
+
@cmd.should_receive(:known_stable_micro_bosh_stemcell_version).and_return("0.8.1")
|
123
|
+
@cmd.micro_bosh_stemcell_name.should == "micro-bosh-stemcell-openstack-kvm-0.8.1.tgz"
|
124
|
+
end
|
115
125
|
end
|
116
126
|
|
117
127
|
end
|
data/spec/unit/cli_ssh_spec.rb
CHANGED
@@ -19,19 +19,20 @@ describe Bosh::Bootstrap do
|
|
19
19
|
before do
|
20
20
|
@cmd.settings["inception"] = {}
|
21
21
|
@cmd.settings["inception"]["host"] = "5.5.5.5"
|
22
|
+
@private_key_path = File.join(ENV['HOME'], ".ssh", "id_rsa")
|
22
23
|
end
|
23
24
|
|
24
25
|
describe "normal" do
|
25
26
|
it "launches ssh session" do
|
26
27
|
@cmd.should_receive(:exit)
|
27
28
|
@cmd.should_receive(:system).
|
28
|
-
with("ssh vcap@5.5.5.5")
|
29
|
+
with("ssh -i #{@private_key_path} vcap@5.5.5.5")
|
29
30
|
@cmd.ssh
|
30
31
|
end
|
31
32
|
it "runs ssh command" do
|
32
33
|
@cmd.should_receive(:exit)
|
33
34
|
@cmd.should_receive(:system).
|
34
|
-
with("ssh vcap@5.5.5.5 'some command'")
|
35
|
+
with("ssh -i #{@private_key_path} vcap@5.5.5.5 'some command'")
|
35
36
|
@cmd.ssh("some command")
|
36
37
|
end
|
37
38
|
end
|
@@ -40,7 +41,7 @@ describe Bosh::Bootstrap do
|
|
40
41
|
it "launches ssh session" do
|
41
42
|
@cmd.should_receive(:exit)
|
42
43
|
@cmd.should_receive(:system).
|
43
|
-
with("ssh vcap@5.5.5.5 -t 'tmux attach || tmux new-session'")
|
44
|
+
with("ssh -i #{@private_key_path} vcap@5.5.5.5 -t 'tmux attach || tmux new-session'")
|
44
45
|
@cmd.tmux
|
45
46
|
end
|
46
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
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: 2013-
|
12
|
+
date: 2013-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -313,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
313
|
version: '0'
|
314
314
|
segments:
|
315
315
|
- 0
|
316
|
-
hash:
|
316
|
+
hash: 2218589769012560406
|
317
317
|
requirements: []
|
318
318
|
rubyforge_project:
|
319
319
|
rubygems_version: 1.8.25
|