bosh-bootstrap 0.10.2 → 0.11.0
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/.rspec +1 -0
- data/.travis.yml +0 -1
- data/ChangeLog.md +23 -4
- data/Gemfile +5 -2
- data/Guardfile +2 -0
- data/README.md +209 -197
- data/TODO.md +55 -0
- data/bosh-bootstrap.gemspec +5 -12
- data/lib/bosh/cli/commands/bootstrap.rb +42 -0
- data/lib/bosh-bootstrap/cli/commands/delete.rb +26 -0
- data/lib/bosh-bootstrap/cli/commands/deploy.rb +89 -0
- data/lib/bosh-bootstrap/cli/commands/ssh.rb +32 -0
- data/lib/bosh-bootstrap/cli/helpers/bundle.rb +12 -0
- data/lib/bosh-bootstrap/cli/helpers/interactions.rb +15 -0
- data/lib/bosh-bootstrap/cli/helpers/settings.rb +61 -0
- data/lib/bosh-bootstrap/cli/helpers.rb +11 -0
- data/lib/bosh-bootstrap/key_pair.rb +21 -0
- data/lib/bosh-bootstrap/microbosh.rb +74 -0
- data/lib/bosh-bootstrap/microbosh_providers/aws.rb +104 -0
- data/lib/bosh-bootstrap/microbosh_providers/base.rb +50 -0
- data/lib/bosh-bootstrap/microbosh_providers/openstack.rb +61 -0
- data/lib/bosh-bootstrap/microbosh_providers/vsphere.rb +78 -0
- data/lib/bosh-bootstrap/microbosh_providers.rb +11 -0
- data/lib/bosh-bootstrap/network.rb +33 -0
- data/lib/bosh-bootstrap/network_providers/aws.rb +28 -0
- data/lib/bosh-bootstrap/network_providers/dummy.rb +10 -0
- data/lib/bosh-bootstrap/network_providers/openstack.rb +28 -0
- data/lib/bosh-bootstrap/network_providers.rb +11 -0
- data/lib/bosh-bootstrap/version.rb +1 -1
- data/lib/bosh-bootstrap.rb +3 -4
- data/spec/assets/microbosh_yml/micro_bosh.aws_ec2.yml +37 -0
- data/spec/assets/microbosh_yml/micro_bosh.aws_vpc.yml +39 -0
- data/spec/assets/microbosh_yml/micro_bosh.openstack.yml +30 -0
- data/spec/assets/microbosh_yml/micro_bosh.vsphere.yml +34 -0
- data/spec/integration/aws/aws_ec2_basic_spec.rb +39 -0
- data/spec/integration/aws/aws_helpers.rb +8 -61
- data/spec/spec_helper.rb +8 -3
- data/spec/support/capture_stdout.rb +18 -0
- data/spec/unit/cli/bootstrap_spec.rb +41 -0
- data/spec/unit/commands/delete_spec.rb +20 -0
- data/spec/unit/commands/deploy_spec.rb +64 -0
- data/spec/unit/commands/ssh_spec.rb +19 -0
- data/spec/unit/key_pair_spec.rb +13 -0
- data/spec/unit/microbosh_providers/aws_spec.rb +68 -0
- data/spec/unit/microbosh_providers/openstack_spec.rb +27 -0
- data/spec/unit/microbosh_providers/vsphere_spec.rb +42 -0
- data/spec/unit/microbosh_spec.rb +27 -0
- data/spec/unit/network_providers/aws_spec.rb +29 -0
- data/spec/unit/network_providers/openstack_spec.rb +29 -0
- data/spec/unit/network_spec.rb +17 -0
- metadata +71 -235
- data/CleanupCi.md +0 -8
- data/bin/bosh-bootstrap +0 -8
- data/docs/README.md +0 -3
- data/docs/devstack-openstack-tutorial.md +0 -215
- data/lib/bosh/providers/README.md +0 -5
- data/lib/bosh/providers/aws.rb +0 -258
- data/lib/bosh/providers/base_provider.rb +0 -48
- data/lib/bosh/providers/openstack.rb +0 -79
- data/lib/bosh/providers.rb +0 -21
- data/lib/bosh-bootstrap/cli.rb +0 -1347
- data/lib/bosh-bootstrap/commander/README.md +0 -47
- data/lib/bosh-bootstrap/commander/command.rb +0 -25
- data/lib/bosh-bootstrap/commander/commands.rb +0 -80
- data/lib/bosh-bootstrap/commander/local_server.rb +0 -68
- data/lib/bosh-bootstrap/commander/remote_script_command.rb +0 -51
- data/lib/bosh-bootstrap/commander/remote_server.rb +0 -137
- data/lib/bosh-bootstrap/commander/upload_command.rb +0 -17
- data/lib/bosh-bootstrap/commander.rb +0 -9
- data/lib/bosh-bootstrap/helpers/fog_setup.rb +0 -50
- data/lib/bosh-bootstrap/helpers/settings.rb +0 -99
- data/lib/bosh-bootstrap/helpers/settings_setter.rb +0 -41
- data/lib/bosh-bootstrap/helpers.rb +0 -3
- data/lib/bosh-bootstrap/stages/stage_micro_bosh_delete/bosh_micro_delete +0 -19
- data/lib/bosh-bootstrap/stages/stage_micro_bosh_delete.rb +0 -90
- data/lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/bosh_micro_deploy +0 -79
- data/lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user +0 -23
- data/lib/bosh-bootstrap/stages/stage_micro_bosh_deploy.rb +0 -146
- data/lib/bosh-bootstrap/stages/stage_micro_bosh_download/download_micro_bosh_stemcell +0 -93
- data/lib/bosh-bootstrap/stages/stage_micro_bosh_download.rb +0 -139
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/configure_git +0 -25
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/create_vcap_user +0 -79
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/install_base_packages +0 -30
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/install_bosh +0 -11
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/install_bosh_plugins +0 -25
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/install_hub +0 -26
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/install_ruby +0 -30
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/install_useful_gems +0 -29
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm/validate_bosh_deployer +0 -18
- data/lib/bosh-bootstrap/stages/stage_prepare_inception_vm.rb +0 -69
- data/lib/bosh-bootstrap/stages/stage_salted_password/convert_salted_password +0 -11
- data/lib/bosh-bootstrap/stages/stage_salted_password.rb +0 -51
- data/lib/bosh-bootstrap/stages/stage_setup_new_bosh/setup_bosh_user +0 -29
- data/lib/bosh-bootstrap/stages/stage_setup_new_bosh.rb +0 -51
- data/lib/bosh-bootstrap/stages/stage_validate_inception_vm/validate_ubuntu +0 -6
- data/lib/bosh-bootstrap/stages/stage_validate_inception_vm.rb +0 -39
- data/lib/bosh-bootstrap/stages.rb +0 -10
- data/spec/assets/bosh/public_stemcells/aws_micro.out +0 -7
- data/spec/assets/micro_bosh_yml/micro_bosh.aws_ec2.yml +0 -35
- data/spec/assets/micro_bosh_yml/micro_bosh.aws_vpc.yml +0 -37
- data/spec/integration/aws/aws_basic_spec.rb +0 -39
- data/spec/integration/aws/aws_edge_prebuilt_ami_spec.rb +0 -46
- data/spec/integration/aws/aws_edge_prebuilt_spec.rb +0 -46
- data/spec/integration/aws/aws_edge_spec.rb +0 -45
- data/spec/unit/aws_spec.rb +0 -177
- data/spec/unit/bosh/providers/aws_spec.rb +0 -174
- data/spec/unit/cli_spec.rb +0 -134
- data/spec/unit/cli_ssh_spec.rb +0 -95
- data/spec/unit/cli_upgrade_inception_spec.rb +0 -29
- data/spec/unit/settings_setter_spec.rb +0 -29
- data/vendor/cache/POpen4-0.1.4.gem +0 -0
- data/vendor/cache/Platform-0.4.0.gem +0 -0
- data/vendor/cache/activesupport-3.2.8.gem +0 -0
- data/vendor/cache/awesome_print-1.1.0.gem +0 -0
- data/vendor/cache/aws-s3-0.6.3.gem +0 -0
- data/vendor/cache/blobstore_client-0.4.0.gem +0 -0
- data/vendor/cache/bosh_cli-1.0.3.gem +0 -0
- data/vendor/cache/bosh_common-0.5.4.gem +0 -0
- data/vendor/cache/builder-3.2.0.gem +0 -0
- data/vendor/cache/coderay-1.0.8.gem +0 -0
- data/vendor/cache/diff-lcs-1.1.3.gem +0 -0
- data/vendor/cache/escape-0.0.4.gem +0 -0
- data/vendor/cache/excon-0.20.1.gem +0 -0
- data/vendor/cache/fog-1.8.0.gem +0 -0
- data/vendor/cache/formatador-0.2.4.gem +0 -0
- data/vendor/cache/guard-1.6.2.gem +0 -0
- data/vendor/cache/guard-rspec-2.4.0.gem +0 -0
- data/vendor/cache/highline-1.6.18.gem +0 -0
- data/vendor/cache/httpclient-2.2.4.gem +0 -0
- data/vendor/cache/i18n-0.6.1.gem +0 -0
- data/vendor/cache/json_pure-1.6.8.gem +0 -0
- data/vendor/cache/listen-0.7.2.gem +0 -0
- data/vendor/cache/log4r-1.1.10.gem +0 -0
- data/vendor/cache/lumberjack-1.0.2.gem +0 -0
- data/vendor/cache/method_source-0.8.1.gem +0 -0
- data/vendor/cache/mime-types-1.22.gem +0 -0
- data/vendor/cache/multi_json-1.1.0.gem +0 -0
- data/vendor/cache/net-scp-1.0.4.gem +0 -0
- data/vendor/cache/net-ssh-2.2.2.gem +0 -0
- data/vendor/cache/net-ssh-gateway-1.1.0.gem +0 -0
- data/vendor/cache/netaddr-1.5.0.gem +0 -0
- data/vendor/cache/nokogiri-1.5.9.gem +0 -0
- data/vendor/cache/open4-1.3.0.gem +0 -0
- data/vendor/cache/progressbar-0.9.2.gem +0 -0
- data/vendor/cache/pry-0.9.11.4-java.gem +0 -0
- data/vendor/cache/pry-0.9.11.4.gem +0 -0
- data/vendor/cache/rake-10.0.3.gem +0 -0
- data/vendor/cache/rb-fsevent-0.9.3.gem +0 -0
- data/vendor/cache/redcard-1.0.0.gem +0 -0
- data/vendor/cache/rspec-2.12.0.gem +0 -0
- data/vendor/cache/rspec-core-2.12.2.gem +0 -0
- data/vendor/cache/rspec-expectations-2.12.1.gem +0 -0
- data/vendor/cache/rspec-mocks-2.12.2.gem +0 -0
- data/vendor/cache/ruby-atmos-pure-1.0.5.gem +0 -0
- data/vendor/cache/ruby-hmac-0.4.0.gem +0 -0
- data/vendor/cache/settingslogic-2.0.9.gem +0 -0
- data/vendor/cache/slop-3.4.3.gem +0 -0
- data/vendor/cache/spoon-0.0.1.gem +0 -0
- data/vendor/cache/terminal-table-1.4.5.gem +0 -0
- data/vendor/cache/thor-0.17.0.gem +0 -0
- data/vendor/cache/uuidtools-2.1.3.gem +0 -0
- data/vendor/cache/xml-simple-1.1.2.gem +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
if [[ $EUID -ne 0 ]]; then
|
|
4
|
-
echo "ERROR: This script must be run as root" 1>&2
|
|
5
|
-
exit 1
|
|
6
|
-
fi
|
|
7
|
-
|
|
8
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
|
9
|
-
|
|
10
|
-
apt-get install python-software-properties
|
|
11
|
-
if [ "$(lsb_release --release --short)" == '10.04' ]; then
|
|
12
|
-
add-apt-repository ppa:keithw/mosh
|
|
13
|
-
else
|
|
14
|
-
add-apt-repository -y ppa:keithw/mosh
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
apt-get update
|
|
18
|
-
apt-get install build-essential libsqlite3-dev curl rsync git-core \
|
|
19
|
-
tmux mosh \
|
|
20
|
-
libmysqlclient-dev libxml2-dev libxslt-dev libpq-dev libsqlite3-dev \
|
|
21
|
-
runit \
|
|
22
|
-
genisoimage \
|
|
23
|
-
debootstrap kpartx qemu-kvm \
|
|
24
|
-
vim -y
|
|
25
|
-
|
|
26
|
-
if [ "$(lsb_release --release --short)" == '10.04' ]; then
|
|
27
|
-
apt-get install mkpasswd -y
|
|
28
|
-
else
|
|
29
|
-
apt-get install whois -y
|
|
30
|
-
fi
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Install BOSH CLI
|
|
4
|
-
#
|
|
5
|
-
# Options:
|
|
6
|
-
# * $BOSH_RUBYGEM_SOURCE - URL for where bosh rubygems can be downloaded
|
|
7
|
-
|
|
8
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
|
9
|
-
|
|
10
|
-
cd /var/vcap/store/inception
|
|
11
|
-
bundle install
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Install bosh-cloudfoundry BOSH CLI plugin
|
|
4
|
-
#
|
|
5
|
-
# Options:
|
|
6
|
-
# * $UPGRADE - re-install or upgrade gems if already installed
|
|
7
|
-
|
|
8
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
|
9
|
-
|
|
10
|
-
if [[ $EUID -ne 0 ]]; then
|
|
11
|
-
echo "ERROR: This script must be run as root" 1>&2
|
|
12
|
-
exit 1
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# Install a gem if $UPGRADE exists or if gem not already installed
|
|
16
|
-
function install_gem() {
|
|
17
|
-
gem_name=$1
|
|
18
|
-
if [[ ("${UPGRADE}X" != "X") || "$(gem list $gem_name | grep $gem_name)X" == "X" ]]; then
|
|
19
|
-
gem install $gem_name --no-ri --no-rdoc
|
|
20
|
-
else
|
|
21
|
-
echo gem $gem_name already installed
|
|
22
|
-
fi
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
install_gem bosh-cloudfoundry
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
if [[ $EUID -ne 0 ]]; then
|
|
4
|
-
echo "ERROR: This script must be run as root" 1>&2
|
|
5
|
-
exit 1
|
|
6
|
-
fi
|
|
7
|
-
|
|
8
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
|
9
|
-
|
|
10
|
-
cd /var/vcap/store/repos
|
|
11
|
-
if [[ ! -d hub ]]; then
|
|
12
|
-
git clone git://github.com/defunkt/hub.git
|
|
13
|
-
cd hub
|
|
14
|
-
else
|
|
15
|
-
cd hub
|
|
16
|
-
git pull origin master
|
|
17
|
-
fi
|
|
18
|
-
rake install prefix=/usr/local
|
|
19
|
-
chown -R vcap:vcap /var/vcap/store/repos/hub
|
|
20
|
-
|
|
21
|
-
if [[ $(grep "hub alias -s" /home/vcap/.bashrc) == "" ]]; then
|
|
22
|
-
echo 'adding hub alias to .bashrc'
|
|
23
|
-
echo 'eval "$(hub alias -s)"' >> /home/vcap/.bashrc
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Install ruby 1.9.3
|
|
4
|
-
#
|
|
5
|
-
# Options:
|
|
6
|
-
# * $RUBY_VERSION - override ruby version to test/install
|
|
7
|
-
# * $UPGRADE - re-install or upgrade ruby if already installed
|
|
8
|
-
|
|
9
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
|
10
|
-
|
|
11
|
-
if [[ $EUID -ne 0 ]]; then
|
|
12
|
-
echo "ERROR: This script must be run as root" 1>&2
|
|
13
|
-
exit 1
|
|
14
|
-
fi
|
|
15
|
-
|
|
16
|
-
RUBY_VERSION=ruby-1.9.3
|
|
17
|
-
|
|
18
|
-
if [[ "$(which ruby)" == "" || "${UPGRADE}X" != "X" || ! ("$(ruby -v)" =~ "ruby 1.9.3") ]]; then
|
|
19
|
-
curl -L https://get.rvm.io | bash -s head --autolibs=3 --ruby=$RUBY_VERSION
|
|
20
|
-
source /etc/profile.d/rvm.sh
|
|
21
|
-
else
|
|
22
|
-
echo $RUBY_VERSION already installed
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
sudo usermod -a -G rvm vcap
|
|
26
|
-
|
|
27
|
-
if [[ $(grep 'rvm $RUBY_VERSION --default' ~vcap/.profile) == "" ]]; then
|
|
28
|
-
echo "setting rvm default for ~vcap user"
|
|
29
|
-
echo "rvm $RUBY_VERSION --default" >> ~vcap/.profile
|
|
30
|
-
fi
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Install bundler, fog, rake
|
|
4
|
-
#
|
|
5
|
-
# Options:
|
|
6
|
-
# * $UPGRADE - re-install or upgrade gems if already installed
|
|
7
|
-
|
|
8
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
|
9
|
-
|
|
10
|
-
if [[ $EUID -ne 0 ]]; then
|
|
11
|
-
echo "ERROR: This script must be run as root" 1>&2
|
|
12
|
-
exit 1
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# Install a gem if $UPGRADE exists or if gem not already installed
|
|
16
|
-
function install_gem() {
|
|
17
|
-
gem_name=$1
|
|
18
|
-
options=$2
|
|
19
|
-
if [[ ("${UPGRADE}X" != "X") || "$(gem list $gem_name | grep $gem_name)X" == "X" ]]; then
|
|
20
|
-
gem install $gem_name $options --no-ri --no-rdoc -f
|
|
21
|
-
else
|
|
22
|
-
echo gem $gem_name already installed
|
|
23
|
-
fi
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
install_gem bundler
|
|
27
|
-
install_gem rake
|
|
28
|
-
install_gem jazor
|
|
29
|
-
install_gem yaml_command
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Validate that BOSH deployer is ready
|
|
4
|
-
|
|
5
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
|
6
|
-
|
|
7
|
-
echo "Testing for 'bosh micro deploy' command..."
|
|
8
|
-
|
|
9
|
-
bosh_output=$(bosh --no-color help micro)
|
|
10
|
-
if [[ "$(echo $bosh_output | grep 'micro deploy')" == "" ]]; then
|
|
11
|
-
echo "Failed to install 'bosh micro deploy'. Please investigate issue and report root cause so we can fix it."
|
|
12
|
-
echo "Output of 'bosh --no-color help micro':"
|
|
13
|
-
echo $bosh_output
|
|
14
|
-
exit 1
|
|
15
|
-
else
|
|
16
|
-
echo "Successfully installed bosh deployer (bosh micro deploy)"
|
|
17
|
-
exit 0
|
|
18
|
-
fi
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
module Bosh::Bootstrap::Stages
|
|
2
|
-
class StagePrepareInceptionVm
|
|
3
|
-
attr_reader :settings
|
|
4
|
-
|
|
5
|
-
def initialize(settings)
|
|
6
|
-
@settings = settings
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def commands
|
|
10
|
-
@commands ||= Bosh::Bootstrap::Commander::Commands.new do |server|
|
|
11
|
-
# using inception VM username login, create a vcap user with same authorizations
|
|
12
|
-
server.create "vcap user", script("create_vcap_user",
|
|
13
|
-
"ORIGUSER" => settings.inception.username),
|
|
14
|
-
ssh_username: settings.inception.username, run_as_root: true
|
|
15
|
-
# install base Ubuntu packages used for bosh micro deployer
|
|
16
|
-
server.install "base packages", script("install_base_packages"), run_as_root: true
|
|
17
|
-
server.configure "git", script("configure_git",
|
|
18
|
-
"GIT_USER_NAME" => settings["git"]["name"],
|
|
19
|
-
"GIT_USER_EMAIL" => settings["git"]["email"])
|
|
20
|
-
server.install "ruby 1.9.3", script("install_ruby", "UPGRADE" => settings[:upgrade_deps]),
|
|
21
|
-
run_as_root: true
|
|
22
|
-
server.install "useful ruby gems", script("install_useful_gems", "UPGRADE" => settings[:upgrade_deps]),
|
|
23
|
-
run_as_root: true
|
|
24
|
-
server.install "hub", script("install_hub"),
|
|
25
|
-
run_as_root: true
|
|
26
|
-
server.upload_file "/var/vcap/store/inception/Gemfile", gemfile
|
|
27
|
-
server.install "bosh", script("install_bosh")
|
|
28
|
-
server.validate "bosh deployer", script("validate_bosh_deployer")
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
private
|
|
33
|
-
def stage_name
|
|
34
|
-
"stage_prepare_inception_vm"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Loads local script
|
|
38
|
-
# If +variables+, then injects KEY=VALUE environment
|
|
39
|
-
# variables into bash scripts.
|
|
40
|
-
def script(segment_name, variables={})
|
|
41
|
-
path = File.expand_path("../#{stage_name}/#{segment_name}", __FILE__)
|
|
42
|
-
if File.exist?(path)
|
|
43
|
-
script = File.read(path)
|
|
44
|
-
if variables.keys.size > 0
|
|
45
|
-
inline_variables = "#!/usr/bin/env bash\n\n"
|
|
46
|
-
env_variables = variables.reject { |var| var.is_a?(Symbol) }
|
|
47
|
-
env_variables.each { |name, value| inline_variables << "#{name}='#{value}'\n" }
|
|
48
|
-
script.gsub!("#!/usr/bin/env bash", inline_variables)
|
|
49
|
-
end
|
|
50
|
-
script
|
|
51
|
-
else
|
|
52
|
-
Thor::Base.shell.new.say_status "error", "Missing script lib/bosh-bootstrap/stages/#{stage_name}/#{segment_name}", :red
|
|
53
|
-
exit 1
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# returns a Gemfile to be used to install bosh & other gems
|
|
58
|
-
def gemfile
|
|
59
|
-
<<-RUBY.gsub(/ /, '')
|
|
60
|
-
source 'https://rubygems.org'
|
|
61
|
-
source 'https://s3.amazonaws.com/bosh-jenkins-gems/'
|
|
62
|
-
|
|
63
|
-
gem "bosh_cli", "~> 1.5.0.pre"
|
|
64
|
-
gem "bosh_cli_plugin_micro", "~> 1.5.0.pre"
|
|
65
|
-
gem "bosh-cloudfoundry"
|
|
66
|
-
RUBY
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
require "json" # for inline hashes within YAML
|
|
2
|
-
|
|
3
|
-
module Bosh::Bootstrap::Stages
|
|
4
|
-
class SaltedPassword
|
|
5
|
-
attr_reader :settings
|
|
6
|
-
|
|
7
|
-
def initialize(settings)
|
|
8
|
-
@settings = settings
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def commands
|
|
12
|
-
@commands ||= Bosh::Bootstrap::Commander::Commands.new do |server|
|
|
13
|
-
# use inception VM to generate a salted password (local machine may not have mkpasswd)
|
|
14
|
-
server.capture_value "salted password", script("convert_salted_password", "PASSWORD" => settings.bosh.password),
|
|
15
|
-
:settings => settings, :save_output_to_settings_key => "bosh.salted_password"
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def stage_name
|
|
20
|
-
"stage_salted_password"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# Loads local script
|
|
24
|
-
# If +variables+, then injects KEY=VALUE environment
|
|
25
|
-
# variables into bash scripts.
|
|
26
|
-
def script(segment_name, variables={})
|
|
27
|
-
path = File.expand_path("../#{stage_name}/#{segment_name}", __FILE__)
|
|
28
|
-
if File.exist?(path)
|
|
29
|
-
script = File.read(path)
|
|
30
|
-
if variables.keys.size > 0
|
|
31
|
-
env_variables = variables.reject { |var| var.is_a?(Symbol) }
|
|
32
|
-
|
|
33
|
-
# inject variables into script if its bash script
|
|
34
|
-
inline_variables = "#!/usr/bin/env bash\n\n"
|
|
35
|
-
env_variables.each { |name, value| inline_variables << "#{name}='#{value}'\n" }
|
|
36
|
-
script.gsub!("#!/usr/bin/env bash", inline_variables)
|
|
37
|
-
|
|
38
|
-
# inject variables into script if its ruby script
|
|
39
|
-
inline_variables = "#!/usr/bin/env ruby\n\n"
|
|
40
|
-
env_variables.each { |name, value| inline_variables << "ENV['#{name}'] = '#{value}'\n" }
|
|
41
|
-
script.gsub!("#!/usr/bin/env ruby", inline_variables)
|
|
42
|
-
end
|
|
43
|
-
script
|
|
44
|
-
else
|
|
45
|
-
Thor::Base.shell.new.say_status "error", "Missing script lib/bosh-bootstrap/stages/#{stage_name}/#{segment_name}", :red
|
|
46
|
-
exit 1
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Deploys a micro BOSH using "bosh micro deploy"
|
|
4
|
-
#
|
|
5
|
-
# Required:
|
|
6
|
-
# * $BOSH_NAME - name of bosh deployment
|
|
7
|
-
# (thus /var/vcap/store/microboshes/deployments/$BOSH_NAME/micro_bosh.yml exists)
|
|
8
|
-
# * $BOSH_HOST - public IP of the deployed BOSH
|
|
9
|
-
# * $BOSH_USERNAME - user login to be created
|
|
10
|
-
# * $BOSH_PASSWORD - password for user login
|
|
11
|
-
|
|
12
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
|
13
|
-
set -u # report the usage of uninitialized variables
|
|
14
|
-
|
|
15
|
-
cd /var/vcap/store/microboshes/deployments/
|
|
16
|
-
|
|
17
|
-
if [[ -f $BOSH_NAME/new_bosh_deployed ]]; then
|
|
18
|
-
echo "Initially targeting micro-bosh..."
|
|
19
|
-
bosh -u admin -p admin target $BOSH_HOST
|
|
20
|
-
|
|
21
|
-
echo "Creating initial user $BOSH_USERNAME..."
|
|
22
|
-
bosh login admin admin
|
|
23
|
-
bosh create user $BOSH_USERNAME $BOSH_PASSWORD
|
|
24
|
-
|
|
25
|
-
rm -f $BOSH_NAME/new_bosh_deployed
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
echo "Login as $BOSH_USERNAME..."
|
|
29
|
-
bosh login $BOSH_USERNAME $BOSH_PASSWORD
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
require "json" # for inline hashes within YAML
|
|
2
|
-
|
|
3
|
-
module Bosh::Bootstrap::Stages
|
|
4
|
-
class SetupNewBosh
|
|
5
|
-
attr_reader :settings
|
|
6
|
-
|
|
7
|
-
def initialize(settings)
|
|
8
|
-
@settings = settings
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def commands
|
|
12
|
-
@commands ||= Bosh::Bootstrap::Commander::Commands.new do |server|
|
|
13
|
-
server.setup "bosh user", script("setup_bosh_user",
|
|
14
|
-
"BOSH_NAME" => settings.bosh_name,
|
|
15
|
-
"BOSH_HOST" => settings.bosh.ip_address,
|
|
16
|
-
"BOSH_USERNAME" => settings.bosh_username,
|
|
17
|
-
"BOSH_PASSWORD" => settings.bosh_password)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
private
|
|
22
|
-
def stage_name
|
|
23
|
-
"stage_setup_new_bosh"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Loads local script
|
|
27
|
-
# If +variables+, then injects KEY=VALUE environment
|
|
28
|
-
# variables into bash scripts.
|
|
29
|
-
def script(segment_name, variables={})
|
|
30
|
-
path = File.expand_path("../#{stage_name}/#{segment_name}", __FILE__)
|
|
31
|
-
if File.exist?(path)
|
|
32
|
-
script = File.read(path)
|
|
33
|
-
if variables.keys.size > 0
|
|
34
|
-
# inject variables into script if its bash script
|
|
35
|
-
inline_variables = "#!/usr/bin/env bash\n\n"
|
|
36
|
-
variables.each { |name, value| inline_variables << "#{name}='#{value}'\n" }
|
|
37
|
-
script.gsub!("#!/usr/bin/env bash", inline_variables)
|
|
38
|
-
|
|
39
|
-
# inject variables into script if its ruby script
|
|
40
|
-
inline_variables = "#!/usr/bin/env ruby\n\n"
|
|
41
|
-
variables.each { |name, value| inline_variables << "ENV['#{name}'] = '#{value}'\n" }
|
|
42
|
-
script.gsub!("#!/usr/bin/env ruby", inline_variables)
|
|
43
|
-
end
|
|
44
|
-
script
|
|
45
|
-
else
|
|
46
|
-
Thor::Base.shell.new.say_status "error", "Missing script lib/bosh-bootstrap/stages/#{stage_name}/#{segment_name}", :red
|
|
47
|
-
exit 1
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
module Bosh::Bootstrap::Stages
|
|
2
|
-
class StageValidateInceptionVm
|
|
3
|
-
attr_reader :settings
|
|
4
|
-
|
|
5
|
-
def initialize(settings)
|
|
6
|
-
@settings = settings
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def commands
|
|
10
|
-
@commands ||= Bosh::Bootstrap::Commander::Commands.new do |server|
|
|
11
|
-
server.validate "ubuntu", script("validate_ubuntu"), ssh_username: settings.inception.username
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
private
|
|
16
|
-
def stage_name
|
|
17
|
-
"stage_validate_inception_vm"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Loads local script
|
|
21
|
-
# If +variables+, then injects KEY=VALUE environment
|
|
22
|
-
# variables into bash scripts.
|
|
23
|
-
def script(segment_name, variables={})
|
|
24
|
-
path = File.expand_path("../#{stage_name}/#{segment_name}", __FILE__)
|
|
25
|
-
if File.exist?(path)
|
|
26
|
-
script = File.read(path)
|
|
27
|
-
if variables.keys.size > 0
|
|
28
|
-
inline_variables = "#!/usr/bin/env bash\n\n"
|
|
29
|
-
variables.each { |name, value| inline_variables << "#{name}=#{value}\n" }
|
|
30
|
-
script.gsub!("#!/usr/bin/env bash", inline_variables)
|
|
31
|
-
end
|
|
32
|
-
script
|
|
33
|
-
else
|
|
34
|
-
Thor::Base.shell.new.say_status "error", "Missing script lib/bosh-bootstrap/stages/#{stage_name}/#{segment_name}", :red
|
|
35
|
-
exit 1
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
module Bosh::Bootstrap::Stages
|
|
2
|
-
end
|
|
3
|
-
|
|
4
|
-
require "bosh-bootstrap/stages/stage_validate_inception_vm"
|
|
5
|
-
require "bosh-bootstrap/stages/stage_prepare_inception_vm"
|
|
6
|
-
require "bosh-bootstrap/stages/stage_micro_bosh_download"
|
|
7
|
-
require "bosh-bootstrap/stages/stage_micro_bosh_deploy"
|
|
8
|
-
require "bosh-bootstrap/stages/stage_setup_new_bosh"
|
|
9
|
-
require "bosh-bootstrap/stages/stage_salted_password"
|
|
10
|
-
require "bosh-bootstrap/stages/stage_micro_bosh_delete"
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
+-----------------------------------+--------------------+
|
|
2
|
-
| Name | Tags |
|
|
3
|
-
+-----------------------------------+--------------------+
|
|
4
|
-
| micro-bosh-stemcell-aws-0.6.4.tgz | aws, micro, stable |
|
|
5
|
-
| micro-bosh-stemcell-aws-0.7.0.tgz | aws, micro, test |
|
|
6
|
-
| micro-bosh-stemcell-aws-0.8.1.tgz | aws, micro, test |
|
|
7
|
-
+-----------------------------------+--------------------+
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: test-bosh
|
|
3
|
-
env:
|
|
4
|
-
bosh:
|
|
5
|
-
password: pepper
|
|
6
|
-
logging:
|
|
7
|
-
level: DEBUG
|
|
8
|
-
network:
|
|
9
|
-
type: dynamic
|
|
10
|
-
vip: $MICROBOSH_IP$
|
|
11
|
-
resources:
|
|
12
|
-
persistent_disk: 16384
|
|
13
|
-
cloud_properties:
|
|
14
|
-
instance_type: m1.medium
|
|
15
|
-
cloud:
|
|
16
|
-
plugin: aws
|
|
17
|
-
properties:
|
|
18
|
-
aws:
|
|
19
|
-
access_key_id: YYY
|
|
20
|
-
secret_access_key: XXX
|
|
21
|
-
region: us-west-2
|
|
22
|
-
ec2_endpoint: ec2.us-west-2.amazonaws.com
|
|
23
|
-
default_security_groups:
|
|
24
|
-
- test-bosh
|
|
25
|
-
default_key_name: test-bosh
|
|
26
|
-
ec2_private_key: /home/vcap/.ssh/test-bosh.pem
|
|
27
|
-
apply_spec:
|
|
28
|
-
agent:
|
|
29
|
-
blobstore:
|
|
30
|
-
address: $MICROBOSH_IP$
|
|
31
|
-
nats:
|
|
32
|
-
address: $MICROBOSH_IP$
|
|
33
|
-
properties:
|
|
34
|
-
aws_registry:
|
|
35
|
-
address: $MICROBOSH_IP$
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: test-bosh
|
|
3
|
-
env:
|
|
4
|
-
bosh:
|
|
5
|
-
password: pepper
|
|
6
|
-
logging:
|
|
7
|
-
level: DEBUG
|
|
8
|
-
network:
|
|
9
|
-
type: dynamic
|
|
10
|
-
vip: $MICROBOSH_IP$
|
|
11
|
-
cloud_properties:
|
|
12
|
-
subnet: $SUBNET_ID$
|
|
13
|
-
resources:
|
|
14
|
-
persistent_disk: 16384
|
|
15
|
-
cloud_properties:
|
|
16
|
-
instance_type: m1.medium
|
|
17
|
-
cloud:
|
|
18
|
-
plugin: aws
|
|
19
|
-
properties:
|
|
20
|
-
aws:
|
|
21
|
-
access_key_id: YYY
|
|
22
|
-
secret_access_key: XXX
|
|
23
|
-
region: us-west-2
|
|
24
|
-
ec2_endpoint: ec2.us-west-2.amazonaws.com
|
|
25
|
-
default_security_groups:
|
|
26
|
-
- test-bosh
|
|
27
|
-
default_key_name: test-bosh
|
|
28
|
-
ec2_private_key: /home/vcap/.ssh/test-bosh.pem
|
|
29
|
-
apply_spec:
|
|
30
|
-
agent:
|
|
31
|
-
blobstore:
|
|
32
|
-
address: $MICROBOSH_IP$
|
|
33
|
-
nats:
|
|
34
|
-
address: $MICROBOSH_IP$
|
|
35
|
-
properties:
|
|
36
|
-
aws_registry:
|
|
37
|
-
address: $MICROBOSH_IP$
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
require File.expand_path("../../../spec_helper", __FILE__)
|
|
2
|
-
require File.expand_path("../aws_helpers", __FILE__)
|
|
3
|
-
|
|
4
|
-
require "active_support/core_ext/hash/keys"
|
|
5
|
-
|
|
6
|
-
describe "AWS deployment using gems and publish stemcells" do
|
|
7
|
-
include FileUtils
|
|
8
|
-
include Bosh::Bootstrap::Helpers::SettingsSetter
|
|
9
|
-
include AwsHelpers
|
|
10
|
-
|
|
11
|
-
attr_reader :bosh_name
|
|
12
|
-
|
|
13
|
-
before { prepare_aws("basic", aws_region) }
|
|
14
|
-
after { destroy_test_constructs(bosh_name) unless keep_after_test? }
|
|
15
|
-
|
|
16
|
-
def aws_region
|
|
17
|
-
ENV['AWS_REGION'] || "us-west-2"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "creates an EC2 inception/microbosh with the associated resources" do
|
|
21
|
-
create_manifest
|
|
22
|
-
|
|
23
|
-
manifest_file = home_file(".bosh_bootstrap", "manifest.yml")
|
|
24
|
-
File.should be_exists(manifest_file)
|
|
25
|
-
|
|
26
|
-
cmd.deploy
|
|
27
|
-
|
|
28
|
-
fog.addresses.should have(2).item
|
|
29
|
-
inception_ip_address = fog.addresses.first
|
|
30
|
-
inception_ip_address.domain.should == "standard"
|
|
31
|
-
|
|
32
|
-
inception_vms = servers_with_sg("#{bosh_name}-inception-vm")
|
|
33
|
-
inception_vms.size.should == 1
|
|
34
|
-
|
|
35
|
-
micrboshes = servers_with_sg(bosh_name)
|
|
36
|
-
micrboshes.size.should == 1
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
require File.expand_path("../../../spec_helper", __FILE__)
|
|
2
|
-
require File.expand_path("../aws_helpers", __FILE__)
|
|
3
|
-
|
|
4
|
-
require "active_support/core_ext/hash/keys"
|
|
5
|
-
|
|
6
|
-
describe "AWS deployment using very latest prebuilt gems and AMIs (us-east-1 only)" do
|
|
7
|
-
include FileUtils
|
|
8
|
-
include Bosh::Bootstrap::Helpers::SettingsSetter
|
|
9
|
-
include AwsHelpers
|
|
10
|
-
|
|
11
|
-
attr_reader :bosh_name
|
|
12
|
-
|
|
13
|
-
before { prepare_aws("edge-prebuilt", aws_region) }
|
|
14
|
-
# after { destroy_test_constructs(bosh_name) unless keep_after_test? }
|
|
15
|
-
|
|
16
|
-
# Jenkins AMIs are produced for us-east-1
|
|
17
|
-
def aws_region
|
|
18
|
-
"us-east-1"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it "creates an EC2 inception/microbosh with the associated resources" do
|
|
22
|
-
create_manifest("edge-prebuilt" => true)
|
|
23
|
-
|
|
24
|
-
manifest_file = home_file(".bosh_bootstrap", "manifest.yml")
|
|
25
|
-
File.should be_exists(manifest_file)
|
|
26
|
-
|
|
27
|
-
cmd.deploy
|
|
28
|
-
|
|
29
|
-
ip_adresses = fog.addresses
|
|
30
|
-
public_ips = ip_adresses.map(&:public_ip)
|
|
31
|
-
|
|
32
|
-
inception_vms = provider.servers_with_sg("#{bosh_name}-inception-vm")
|
|
33
|
-
inception_vms.size.should == 1
|
|
34
|
-
|
|
35
|
-
# TODO inception VM is not getting its IP address bound correctly
|
|
36
|
-
# https://github.com/StarkAndWayne/bosh-bootstrap/issues/174
|
|
37
|
-
# public_ips.include?(inception_vms.first.public_ip_address).should be_true
|
|
38
|
-
|
|
39
|
-
micrboshes = provider.servers_with_sg(bosh_name)
|
|
40
|
-
micrboshes.size.should == 1
|
|
41
|
-
public_ips.include?(micrboshes.first.public_ip_address).should be_true
|
|
42
|
-
|
|
43
|
-
# TODO - no files in /var/vcap/store/stemcells (since it used AMI)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
require File.expand_path("../../../spec_helper", __FILE__)
|
|
2
|
-
require File.expand_path("../aws_helpers", __FILE__)
|
|
3
|
-
|
|
4
|
-
require "active_support/core_ext/hash/keys"
|
|
5
|
-
|
|
6
|
-
describe "AWS deployment using very latest prebuilt gems and stemcells (outside of us-east-1)" do
|
|
7
|
-
include FileUtils
|
|
8
|
-
include Bosh::Bootstrap::Helpers::SettingsSetter
|
|
9
|
-
include AwsHelpers
|
|
10
|
-
|
|
11
|
-
attr_reader :bosh_name
|
|
12
|
-
|
|
13
|
-
before { prepare_aws("edge-prebuilt", aws_region) }
|
|
14
|
-
# after { destroy_test_constructs(bosh_name) unless keep_after_test? }
|
|
15
|
-
|
|
16
|
-
# Jenkins AMIs are produced for us-east-1; so pick a different region to test stemcell
|
|
17
|
-
def aws_region
|
|
18
|
-
ENV['AWS_REGION'] || "us-west-2"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it "creates an EC2 inception/microbosh with the associated resources" do
|
|
22
|
-
create_manifest("edge-prebuilt" => true)
|
|
23
|
-
|
|
24
|
-
manifest_file = home_file(".bosh_bootstrap", "manifest.yml")
|
|
25
|
-
File.should be_exists(manifest_file)
|
|
26
|
-
|
|
27
|
-
cmd.deploy
|
|
28
|
-
|
|
29
|
-
ip_adresses = fog.addresses
|
|
30
|
-
public_ips = ip_adresses.map(&:public_ip)
|
|
31
|
-
|
|
32
|
-
inception_vms = provider.servers_with_sg("#{bosh_name}-inception-vm")
|
|
33
|
-
inception_vms.size.should == 1
|
|
34
|
-
|
|
35
|
-
# TODO inception VM is not getting its IP address bound correctly
|
|
36
|
-
# https://github.com/StarkAndWayne/bosh-bootstrap/issues/174
|
|
37
|
-
# public_ips.include?(inception_vms.first.public_ip_address).should be_true
|
|
38
|
-
|
|
39
|
-
micrboshes = provider.servers_with_sg(bosh_name)
|
|
40
|
-
micrboshes.size.should == 1
|
|
41
|
-
public_ips.include?(micrboshes.first.public_ip_address).should be_true
|
|
42
|
-
|
|
43
|
-
# TODO - no files in /var/vcap/store/stemcells (since it used AMI)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
end
|