Class: Bosh::Bootstrap::Microbosh

Inherits:
Object
  • Object
show all
Includes:
Cli::Helpers::Bundle, FileUtils
Defined in:
lib/bosh-bootstrap/microbosh.rb

Overview

Configures and deploys (or re-deploys) a micro bosh. A “micro bosh” is a single VM containing all necessary parts of bosh and is deployed from the terminal; rather than from another bosh.

Usage:

microbosh = Bosh::Bootstrap::Microbosh.new(project_path)
settings = ReadWriteSettings.new({
  "provider" => {"name" => "aws", "credentials" => {...}},
  "address" => {"ip" => "1.2.3.4"},
  "bosh" => {
    "name" => "test-bosh",
    "stemcell" => "ami-123456",
    "salted_password" => "452435hjg2345hjg2435ghk3452"
  }
})
microbosh.deploy("aws", settings)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Cli::Helpers::Bundle

#bundle, #run

Constructor Details

#initialize(base_path, provider) ⇒ Microbosh

Returns a new instance of Microbosh.



30
31
32
33
# File 'lib/bosh-bootstrap/microbosh.rb', line 30

def initialize(base_path, provider)
  @base_path = base_path
  @provider = provider
end

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path.



24
25
26
# File 'lib/bosh-bootstrap/microbosh.rb', line 24

def base_path
  @base_path
end

#bosh_nameObject (readonly)

Returns the value of attribute bosh_name.



26
27
28
# File 'lib/bosh-bootstrap/microbosh.rb', line 26

def bosh_name
  @bosh_name
end

#deployments_dirObject (readonly)

Returns the value of attribute deployments_dir.



27
28
29
# File 'lib/bosh-bootstrap/microbosh.rb', line 27

def deployments_dir
  @deployments_dir
end

#manifest_ymlObject (readonly)

Returns the value of attribute manifest_yml.



28
29
30
# File 'lib/bosh-bootstrap/microbosh.rb', line 28

def manifest_yml
  @manifest_yml
end

#providerObject (readonly)

Returns the value of attribute provider.



25
26
27
# File 'lib/bosh-bootstrap/microbosh.rb', line 25

def provider
  @provider
end

Instance Method Details

#deploy(settings) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/bosh-bootstrap/microbosh.rb', line 35

def deploy(settings)
  @bosh_name = settings.bosh.name
  @deployments_dir = File.join(base_path, "deployments")
  @manifest_yml = File.join(deployments_dir, bosh_name, "micro_bosh.yml")
  mkdir_p(File.dirname(manifest_yml))
  chdir(base_path) do
    create_microbosh_yml(settings)
    deploy_or_update(settings.bosh.name, settings.bosh.stemcell_path)
  end
end