bosh_ladle 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/bosh_ladle +6 -0
- data/lib/bosh_ladle.rb +0 -0
- data/lib/bosh_ladle/ami.rb +11 -0
- data/lib/bosh_ladle/bosh_lite.rb +40 -0
- data/lib/bosh_ladle/cli.rb +43 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9db7accb49f22112b79e02fe97d16793be59eb78
|
4
|
+
data.tar.gz: ea5a61e70ae718ec05e86fe4f7ecad453c63a593
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ddd995fa0535b05d86fc5ca9035bea89cb5f547c6e2c321eedeaa6f32e845e888be902a9686cb601bfdb146215e816d6f82f2a31ba0c33dc51afc7454a63db78
|
7
|
+
data.tar.gz: de3530c1d9deb477eae9609b05e40f01e480dd5d1a08a4416925d3bb3a5039c606d58e9c4e20ba368ad5362e26421c8b09756928cb4ef9282cf8e1cbfd6e436a
|
data/bin/bosh_ladle
ADDED
data/lib/bosh_ladle.rb
ADDED
File without changes
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'bosh_ladle/ami'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
module BOSHLadle
|
5
|
+
class BOSHLite
|
6
|
+
def self.spinup(ec2, subnet, name, security_group, key_pair_name, instance_type, logger=Logger.new(STDOUT))
|
7
|
+
instance = ec2.vpcs.first.instances.create(
|
8
|
+
subnet_id: subnet,
|
9
|
+
image_id: AMI.latest,
|
10
|
+
security_groups: security_group,
|
11
|
+
key_name: key_pair_name,
|
12
|
+
instance_type: instance_type
|
13
|
+
)
|
14
|
+
instance.tag('Name', value: name)
|
15
|
+
|
16
|
+
wait_for_instance_ready(instance, logger)
|
17
|
+
address = wait_for_ip(instance, logger)
|
18
|
+
|
19
|
+
logger.info("Instance IP: #{address}")
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def self.wait_for_instance_ready(instance, logger)
|
25
|
+
while instance.status == :pending
|
26
|
+
logger.info('Waiting for instance to be available...')
|
27
|
+
sleep 1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.wait_for_ip(instance, logger)
|
32
|
+
until address = instance.private_ip_address
|
33
|
+
logger.info('Waiting for IP address...')
|
34
|
+
sleep 1
|
35
|
+
end
|
36
|
+
|
37
|
+
address
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'trollop'
|
2
|
+
require 'aws-sdk'
|
3
|
+
|
4
|
+
require 'bosh_ladle/bosh_lite'
|
5
|
+
|
6
|
+
module BOSHLadle
|
7
|
+
class Cli
|
8
|
+
def initialize
|
9
|
+
@opts = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def run(args)
|
13
|
+
|
14
|
+
raise ArgumentError.new('Please set AWS_ACCESS_KEY_ID in the environment') if ENV['AWS_ACCESS_KEY_ID'].nil?
|
15
|
+
raise ArgumentError.new('Please set AWS_SECRET_ACCESS_KEY in the environment') if ENV['AWS_SECRET_ACCESS_KEY'].nil?
|
16
|
+
|
17
|
+
@opts = Trollop::options(args) do
|
18
|
+
banner <<-PROGINFO
|
19
|
+
This script is meant to spin up BOSH lite VMs inside the GoCD VPC on AWS.
|
20
|
+
It requires AWS credentials stored in the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables to use EC2.
|
21
|
+
Furthermore, it uses the most recently created BOSH-lite AMI available on the AWS marketplace to create the VM.
|
22
|
+
|
23
|
+
Options:
|
24
|
+
PROGINFO
|
25
|
+
opt :instance_type, "AWS instance type to use", :type => :string, :default => 'm3.xlarge'
|
26
|
+
opt :subnet_id, "The subnet ID to put the VM into (e.g. 'subnet-123abc45')", :type => :string, required: true
|
27
|
+
opt :security_group, "The security group to put the VM into", :type => :string, :default => 'bosh', :short => 'g'
|
28
|
+
opt :key_pair, "The key pair to use (must be available in AWS)", :type => :string, :default => 'gocd_bosh_lite'
|
29
|
+
opt :name, "A name passed to the BOSH lite image (e.g. <team-name>)", :type => :string, required: true
|
30
|
+
end
|
31
|
+
|
32
|
+
ec2 = AWS::EC2.new(
|
33
|
+
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
|
34
|
+
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
|
35
|
+
)
|
36
|
+
|
37
|
+
BOSHLite.spinup(ec2, opts.subnet_id, opts.name, opts.security_group, opts.key_pair, opts.instance_type)
|
38
|
+
0
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_reader :opts
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bosh_ladle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mmb
|
8
|
+
- quavmo
|
9
|
+
- gajwani
|
10
|
+
- chou
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: trollop
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: aws-sdk
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: webmock
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
description: |+
|
59
|
+
*noun*
|
60
|
+
|
61
|
+
1. a large long-handled spoon with a cup-shaped bowl, used for serving soup, stew, or sauce.
|
62
|
+
2. a small single-command CLI tool used for deploying [BOSH-lite](http://github.com/cloudfoundry/bosh-lite) to the first VPC in an AWS account.
|
63
|
+
|
64
|
+
email: support@cloudfoundry.com
|
65
|
+
executables:
|
66
|
+
- bosh_ladle
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- lib/bosh_ladle.rb
|
71
|
+
- lib/bosh_ladle/ami.rb
|
72
|
+
- lib/bosh_ladle/bosh_lite.rb
|
73
|
+
- lib/bosh_ladle/cli.rb
|
74
|
+
- bin/bosh_ladle
|
75
|
+
homepage: https://github.com/pivotal-cf-experimental/gocd_scripts
|
76
|
+
licenses:
|
77
|
+
- Apache 2.0
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.0.14
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: a CLI for deploying BOSH-lite to the first VPC in an AWS account.
|
99
|
+
test_files: []
|