Class: Bosh::AwsCliPlugin::MicroBoshBootstrap

Inherits:
Bootstrap
  • Object
show all
Defined in:
lib/bosh_cli_plugin_aws/micro_bosh_bootstrap.rb

Constant Summary

Constants inherited from Bootstrap

Bootstrap::AWS_JENKINS_BUCKET

Instance Attribute Summary

Attributes inherited from Bootstrap

#options, #runner

Instance Method Summary collapse

Methods inherited from Bootstrap

#create_user, #initialize, #login

Constructor Details

This class inherits a constructor from Bosh::AwsCliPlugin::Bootstrap

Instance Method Details

#cleanup_previous_deploymentsObject


53
54
55
56
# File 'lib/bosh_cli_plugin_aws/micro_bosh_bootstrap.rb', line 53

def cleanup_previous_deployments
  rm_files = %w[bosh-deployments.yml micro bosh-registry.log]
  rm_files.each { |file| FileUtils.rm_rf File.join("deployments", file) }
end

#deployObject


14
15
16
17
18
19
20
21
# File 'lib/bosh_cli_plugin_aws/micro_bosh_bootstrap.rb', line 14

def deploy
  Dir.chdir("deployments") do
    micro = Bosh::Cli::Command::Micro.new(runner)
    micro.options = self.options
    micro.micro_deployment("micro")
    micro.perform(micro_ami)
  end
end

#generate_deployment_manifestObject


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bosh_cli_plugin_aws/micro_bosh_bootstrap.rb', line 37

def generate_deployment_manifest
  deployment_folder = File.join("deployments", manifest.deployment_name)

  FileUtils.mkdir_p deployment_folder
  if File.exists?(manifest.certificate.certificate_path)
    FileUtils.cp manifest.certificate.certificate_path, File.join(deployment_folder, manifest.certificate.certificate_path)
  end
  if File.exists?(manifest.certificate.key_path)
    FileUtils.cp manifest.certificate.key_path, File.join(deployment_folder, manifest.certificate.key_path)
  end

  Dir.chdir(deployment_folder) do
    write_yaml(manifest, manifest.file_name)
  end
end

#manifestObject


23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bosh_cli_plugin_aws/micro_bosh_bootstrap.rb', line 23

def manifest
  unless @manifest
    vpc_receipt_filename = File.expand_path("aws_vpc_receipt.yml")
    route53_receipt_filename = File.expand_path("aws_route53_receipt.yml")

    vpc_config = load_yaml_file(vpc_receipt_filename)
    route53_config = load_yaml_file(route53_receipt_filename)

    @manifest = Bosh::AwsCliPlugin::MicroboshManifest.new(vpc_config, route53_config, options)
  end

  @manifest
end

#micro_amiObject


58
59
60
61
# File 'lib/bosh_cli_plugin_aws/micro_bosh_bootstrap.rb', line 58

def micro_ami
  ENV["BOSH_OVERRIDE_MICRO_STEMCELL_AMI"] ||
      Net::HTTP.get("#{AWS_JENKINS_BUCKET}.s3.amazonaws.com", "/last_successful-bosh-stemcell-aws_ami_us-east-1").strip
end

#startObject


6
7
8
9
10
11
12
# File 'lib/bosh_cli_plugin_aws/micro_bosh_bootstrap.rb', line 6

def start
  cleanup_previous_deployments
  generate_deployment_manifest
  deploy

  ("admin", "admin")
end