bosh-cloudfoundry 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -2
- data/ChangeLog.md +12 -0
- data/README.md +2 -0
- data/Rakefile +3 -1
- data/docs/BOSH-cf-initial-create.png +0 -0
- data/docs/BOSH-cf-scaled.png +0 -0
- data/docs/concept.md +141 -0
- data/lib/bosh-cloudfoundry/bosh_release_manager.rb +6 -0
- data/lib/bosh-cloudfoundry/config/dea_config.rb +1 -1
- data/lib/bosh-cloudfoundry/config/postgresql_service_config.rb +1 -1
- data/lib/bosh-cloudfoundry/config/redis_service_config.rb +1 -1
- data/lib/bosh-cloudfoundry/config/system_config.rb +1 -0
- data/lib/bosh-cloudfoundry/config_options.rb +12 -2
- data/lib/bosh-cloudfoundry/system_deployment_manifest_renderer.rb +3 -0
- data/lib/bosh-cloudfoundry/version.rb +1 -1
- data/lib/bosh/cli/commands/cf.rb +34 -19
- data/spec/assets/deployments/aws-core-1-m1.small-free-redis.yml +5 -2
- data/spec/assets/deployments/aws-core-1-m1.xlarge-free-postgresql-2-m1.small-free-postgresql.yml +6 -3
- data/spec/assets/deployments/aws-core-2-m1.xlarge-dea.yml +5 -2
- data/spec/assets/deployments/aws-core-only.yml +4 -1
- data/spec/assets/deployments/aws-core-with-nfs.yml +1 -1
- data/spec/unit/bosh_release_manager_spec.rb +11 -7
- data/spec/unit/cf_command_spec.rb +62 -61
- data/spec/unit/config_options_spec.rb +0 -4
- data/spec/unit/system_deployment_manifest_renderer_spec.rb +1 -1
- metadata +8 -5
data/.travis.yml
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## v0.6
|
4
|
+
|
5
|
+
There is now a write up of [the concepts](https://github.com/StarkAndWayne/bosh-cloudfoundry/blob/master/docs/concept.md) and constructs being deployed from Anders Sveen!
|
6
|
+
|
7
|
+
Tests are running on Travis CI. We have green builds!
|
8
|
+
|
9
|
+
Automatically uploading base stemcell 0.7.0; rather than the very new 1.5.0-pre2 which only work with the also very new microbosh 1.5.0-pre2.
|
10
|
+
|
11
|
+
Faster when using a final release because it no longer pulls down all the submodules; and some better code for handling the switch between a development and final release; but...
|
12
|
+
|
13
|
+
Still need to create development releases from cf-release's master branch. Hopefully all the required patches will be in cf-release's 130 release coming soon!
|
14
|
+
|
3
15
|
## v0.5
|
4
16
|
|
5
17
|
Gerrit is dead. Long live gerrit. This release is for everyone who is getting started or wants to upgrade. Gerrit is dead.
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@ You want Cloud Foundry? You can now create, scale, upgrade and patch one or more
|
|
4
4
|
|
5
5
|
Currently supports AWS and OpenStack only. vSphere and vCloud support will require someone to tell me that they really want it.
|
6
6
|
|
7
|
+
[![Build Status](https://travis-ci.org/StarkAndWayne/bosh-cloudfoundry.png?branch=master)](https://travis-ci.org/StarkAndWayne/bosh-cloudfoundry) [![Code Climate](https://codeclimate.com/github/StarkAndWayne/bosh-cloudfoundry.png)](https://codeclimate.com/github/StarkAndWayne/bosh-cloudfoundry)
|
8
|
+
|
7
9
|
## Zero to Cloud Foundry in a few hours
|
8
10
|
|
9
11
|
If you have an AWS or OpenStack account then you can deploy a running Cloud Foundry VM by following this very simple tutorial. It first uses the very powerful [bosh-bootstrap](https://github.com/StarkAndWayne/bosh-bootstrap) tool to deploy a BOSH, and then using this project (a plugin for the BOSH CLI) it will do everything necessary to deploy Cloud Foundry via your shiny new, empty BOSH.
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ if defined?(RSpec)
|
|
18
18
|
desc "Run Unit Tests"
|
19
19
|
unit_rspec_task = RSpec::Core::RakeTask.new(:unit) do |t|
|
20
20
|
t.pattern = "spec/unit/**/*_spec.rb"
|
21
|
-
t.rspec_opts = %w(--format progress --color
|
21
|
+
t.rspec_opts = %w(--format progress --color)
|
22
22
|
end
|
23
23
|
|
24
24
|
desc "Run Integration Tests"
|
@@ -31,3 +31,5 @@ if defined?(RSpec)
|
|
31
31
|
desc "Install dependencies and run tests"
|
32
32
|
task :spec => %w(spec:unit spec:functional)
|
33
33
|
end
|
34
|
+
|
35
|
+
task :default => :spec
|
Binary file
|
Binary file
|
data/docs/concept.md
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
If you're new to BOSH, Cloud Foundry and PaaS in general you might find this as confusing as I did. So I'll try to explain some of the concepts.
|
2
|
+
|
3
|
+
# The parts
|
4
|
+
There are several parts in action here. Let me take you for a quick tour.
|
5
|
+
|
6
|
+
## Cloud Foundry
|
7
|
+
|
8
|
+
[Cloud Foundry](http://cloudfoundry.org) is a Open Source PaaS solution. It is available as a public cloud at [http://cloudfoundry.com](http://cloudfoundry.com) operated by VMWare, but it is also a solution you can bring in-house and install on your own servers, or even operate on Amazon like [AppFog](http://appfog.com) does.
|
9
|
+
|
10
|
+
* __Cloud Controller__ is the main component in Cloud Foundry and the server you point your vmc command to. It can be split up into separate VMs, but this bootstrap keeps it all on one instance.
|
11
|
+
* __DEA__ is the compute instance. In the initial setup the Cloud Controller is also a DEA. But you can basically view it as VMs that will handle and serve your applications.
|
12
|
+
* __Service__ is the concept Cloud Foundry uses to describe added functionality to your application like Postgres or MongoDB.
|
13
|
+
|
14
|
+
|
15
|
+
## BOSH
|
16
|
+
|
17
|
+
[BOSH](https://github.com/cloudfoundry/bosh) is a cloud oriented tool chain for releasing, deployment and lifecycle management of applications. It abstracts away the underlying IaaS solution (AWS, OpenStack, VMWare) and performs requests for new virtual machines etc. It also handles the distribution of "Jobs" to the virtual machines in the BOSH setup. In some ways you can say that it eliminates the need for Puppet/Chef, but it uses some different concepts. It also covers more, like the provisioning of virtual machines.
|
18
|
+
|
19
|
+
* __Job__ is BOSH's concept of grouping functionality together. In the normal instance you can think of a Job as a composition of installed software and configuration that a virtual machine will have. So two virtual machines with the same Job attached will be identical.
|
20
|
+
* __Template__ is BOSH's concept for defining a software setup. CloudController is one such template, and dea is another one.
|
21
|
+
* __Stemcell__ is BOSH's concept for a virtual machine image. For Amazon it equals and AMI. It is a template that is booted and becoms an instance of an virtual machine.
|
22
|
+
* __Resource Pool__ is basically a collection of virtual machines, that you can reference/assign jobs to. The have the same stemcell and configuration (eg. AWS size).
|
23
|
+
* __Compilation instance__ is instances that BOSH uses when deploying a new part. At first it is used to compile everything that is needed for VCAP and DEA. If you add a template like Postgres you'll see that it compiles the components used for that. I think this is something that resembles rpm or deb packages, and that they get compiled on your Stemcells to ensure compatibility when running on your cloud.
|
24
|
+
|
25
|
+
## Inception VM
|
26
|
+
Inception VM is a Virtual Machine used for bootstrapping BOSH.
|
27
|
+
|
28
|
+
# Building a runnable Cloud Foundry
|
29
|
+
This Bootstrap takes you throug the steps needed to have Cloud Foundry running and serving requests. It launches BOSH which then is used to deploy Cloud Foundry. BOSH is the only officially supported way of deploying Cloud Foundry, even though Chef scripts is maintained by the community.
|
30
|
+
|
31
|
+
The way it operates is illustrated in the figure below:
|
32
|
+
|
33
|
+
![BOSH-CF initial deploy](BOSH-cf-initial-create.png)
|
34
|
+
|
35
|
+
1. The bosh-bootstrap gem on "My Computer" creates an Inception virtual machine from an Ubuntu image.
|
36
|
+
2. The Inception VM creates the BOSH controller
|
37
|
+
3. The BOSH controller creates virtual machines for Cloud Foundry
|
38
|
+
4. The BOSH controller deploys Jobs to the separate instances
|
39
|
+
|
40
|
+
In the initial configuration the Cloud Controller acts as both a controller and a compute instance where your applications run.
|
41
|
+
|
42
|
+
# Scaling
|
43
|
+
Now if the above description was crystal clear, you'll know where the scaling happens. ;) It happens to the far right. The figure below shows how everything looks when I've added a couple of compute instances.
|
44
|
+
|
45
|
+
![BOSH-CF scaled deploy](BOSH-cf-scaled.png)
|
46
|
+
|
47
|
+
In the case above we have three resource pools. They are called core, DEA and postgres. This is that standard way that the BOSH cf plugin does it. The following has been done here:
|
48
|
+
|
49
|
+
* ```bosh cf change deas 3``` creates a pool with 3 virtual machines and assigns the DEA job to them. It also removes the DEA template from the core job.
|
50
|
+
* ```bosh cf add service postgresql 2``` creates a pool with 2 virtual machines and assigns the postgresql job to them.
|
51
|
+
* The dotted boxes above are compile instances that BOSH will create temporarily to compile the necessary components. See the BOSH description above.
|
52
|
+
|
53
|
+
With BOSH it is possible to allocate the postgres templates on the already existing DEA instances and thus save costs on Amazon. It all comes down to what kind of scale you need, and also separation from load issues.
|
54
|
+
|
55
|
+
It is the responsibility of the separate application to handle clustering and communication between the instances.
|
56
|
+
|
57
|
+
## Implementation
|
58
|
+
|
59
|
+
```bosh cf change deas 1``` will add a resource pool and set up jobs. This is from the cf plugin to BOSH.
|
60
|
+
|
61
|
+
It adds a resource pool:
|
62
|
+
|
63
|
+
```
|
64
|
+
- name: dea
|
65
|
+
network: default
|
66
|
+
size: 2
|
67
|
+
stemcell:
|
68
|
+
name: bosh-stemcell
|
69
|
+
version: 0.7.0
|
70
|
+
cloud_properties:
|
71
|
+
region: eu-west-1
|
72
|
+
availability_zone: eu-west-1b
|
73
|
+
instance_type: m1.large
|
74
|
+
```
|
75
|
+
|
76
|
+
Size 2 specifies to launch two virtual machines for this pool.
|
77
|
+
|
78
|
+
It then sets up a job:
|
79
|
+
|
80
|
+
```
|
81
|
+
- name: dea
|
82
|
+
template:
|
83
|
+
- dea
|
84
|
+
instances: 2
|
85
|
+
resource_pool: dea
|
86
|
+
networks:
|
87
|
+
- name: default
|
88
|
+
default:
|
89
|
+
- dns
|
90
|
+
- gateway
|
91
|
+
```
|
92
|
+
|
93
|
+
The instances setting tells it to use two instances in the dea resource pool. For our case this matches the size of the pool exactly.
|
94
|
+
|
95
|
+
After the changes has been done a ```bosh deploy``` will perform the needed changes to your BOSH setup.
|
96
|
+
|
97
|
+
### Using your Cloud Controller as a compute instance
|
98
|
+
|
99
|
+
If you take a look at the job named "core" before you do the adding of DEAs you will see that it has a template named dea. If you leave that in the list your Cloud Controller will also be a compute instance serving deployed applications.
|
100
|
+
|
101
|
+
# Tips
|
102
|
+
|
103
|
+
* Provision an Elastic IP from Amazon as early as possible and assign a DNS entry with wildcard. Example: *.cf.mydomain.com . It will take some time for the DNS to propagate (actually your old *.mydomain.com record to time out if you have one).
|
104
|
+
* If you're deploying to a different region than us-east-1 check out [this bug.](https://github.com/StarkAndWayne/bosh-cloudfoundry/issues/100) Make the changes to the configuration just before you do ```bosh deploy```.
|
105
|
+
* If you want to scale out by adding more instances you need to tweak the FW rules. Check [this bug.](https://github.com/StarkAndWayne/bosh-cloudfoundry/issues/112)
|
106
|
+
* You might need to reduce the number of compile instances to avoid Amazon API errors. Check [this bug.](https://github.com/StarkAndWayne/bosh-cloudfoundry/issues/111)
|
107
|
+
* If you're having problems with ```vmc push``` check out [this bug.](https://github.com/StarkAndWayne/bosh-cloudfoundry/issues/49)
|
108
|
+
* Once you're up and running [test your setup with a simple Sinatra application](http://docs.cloudfoundry.com/tools/vmc/installing-vmc.html#creating-a-simple-sinatra-application).
|
109
|
+
|
110
|
+
# Some resources
|
111
|
+
|
112
|
+
Use these for some pointers for in depth understanding. The rest of this document tries to explain the basic concepts without getting into the really deep details.
|
113
|
+
|
114
|
+
## Documentation
|
115
|
+
|
116
|
+
* [Cloud Foundry documentation](http://cloudfoundry.github.com/)
|
117
|
+
* [Cloud Foundry public cloud (commercial version) docs](http://docs.cloudfoundry.com/getting-started.html)
|
118
|
+
* [Cloud Foundry community wiki](https://github.com/mrdavidlaing/cf-docs-contrib/wiki)
|
119
|
+
|
120
|
+
## Community
|
121
|
+
|
122
|
+
* [BOSH users Mailinglist](https://groups.google.com/a/cloudfoundry.org/forum/#!forum/bosh-users)
|
123
|
+
* [Cloud Foundry Mailinglist](https://groups.google.com/a/cloudfoundry.org/forum/#!forum/vcap-dev)
|
124
|
+
|
125
|
+
## Source code
|
126
|
+
|
127
|
+
* [Cloud Foundry release](https://github.com/cloudfoundry/cf-release)
|
128
|
+
* [Cloud Foundry jobs (within the release repo)](https://github.com/cloudfoundry/cf-release/tree/master/jobs)
|
129
|
+
* [Cloud Foundry VCAP (core component)](https://github.com/cloudfoundry/vcap)
|
130
|
+
|
131
|
+
# TODO/Questions
|
132
|
+
|
133
|
+
* Is the BOSH controller a MicroBosh? Another name?
|
134
|
+
* What is a microbosh?
|
135
|
+
* Is the BOSH controller a part of BOSH, or something that just controls it?
|
136
|
+
* Does the core Cloud Foundry instances scale out?
|
137
|
+
* How do you enable HA for the core?
|
138
|
+
* You run BOSH commands on the Inception VM, not BOSH Controller. Is it meant to be run on your computer? Is network the reason it isn't?
|
139
|
+
* Add some nice to know commands
|
140
|
+
* How can we lock this to a certain "release"?
|
141
|
+
* Can we describe how the source is fetched and what happens to it?
|
@@ -117,6 +117,10 @@ module Bosh::CloudFoundry::BoshReleaseManager
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# when creating a dev release, need to pull down submodules
|
123
|
+
def prepare_cf_release_for_dev_release
|
120
124
|
chdir(cf_release_branch_dir) do
|
121
125
|
say "Rewriting all git:// & git@ to https:// ..."
|
122
126
|
# Snippet written by Mike Reeves <swampfoxmr@gmail.com> on bosh-users mailing list
|
@@ -139,12 +143,14 @@ module Bosh::CloudFoundry::BoshReleaseManager
|
|
139
143
|
def switch_to_development_release
|
140
144
|
system_config.release_name = default_dev_release_name(cf_release_branch)
|
141
145
|
system_config.release_version = "latest"
|
146
|
+
system_config.release_type = "dev"
|
142
147
|
system_config.save
|
143
148
|
end
|
144
149
|
|
145
150
|
def switch_to_final_release
|
146
151
|
system_config.release_name = default_release_name
|
147
152
|
system_config.release_version = "latest"
|
153
|
+
system_config.release_type = "final"
|
148
154
|
system_config.save
|
149
155
|
end
|
150
156
|
end
|
@@ -30,6 +30,7 @@ class Bosh::CloudFoundry::Config::SystemConfig < Bosh::Cli::Config
|
|
30
30
|
:cf_release_branch, # e.g. staging
|
31
31
|
:cf_release_branch_dir, # e.g. /var/vcap/store/releases/cf-release/staging
|
32
32
|
:release_name, # e.g. 'appcloud'
|
33
|
+
:release_type, # either 'final' or 'dev'
|
33
34
|
:release_version, # e.g. 'latest'
|
34
35
|
:gerrit_changes, # e.g. ['84/13084/4', '37/13137/4']
|
35
36
|
:stemcell_name, # e.g. 'bosh-stemcell'
|
@@ -28,7 +28,7 @@ module Bosh::CloudFoundry::ConfigOptions
|
|
28
28
|
def common_config
|
29
29
|
@common_config ||= begin
|
30
30
|
config_file = options[:common_config] || DEFAULT_CONFIG_PATH
|
31
|
-
common_config = Bosh::CloudFoundry::Config::
|
31
|
+
common_config = Bosh::CloudFoundry::Config::CommonConfig.new(config_file)
|
32
32
|
common_config.bosh_git_repo ||= DEFAULT_BOSH_GIT_REPO
|
33
33
|
common_config.save
|
34
34
|
common_config
|
@@ -245,6 +245,16 @@ module Bosh::CloudFoundry::ConfigOptions
|
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
248
|
+
# using/uploading a dev release; not a final release
|
249
|
+
def dev_release_type?
|
250
|
+
system_config.release_type == "dev"
|
251
|
+
end
|
252
|
+
|
253
|
+
# using/uploading a final release; not a dev release
|
254
|
+
def final_release_type?
|
255
|
+
!dev_release_type?
|
256
|
+
end
|
257
|
+
|
248
258
|
def system_initialized?
|
249
259
|
system_config.system_initialized
|
250
260
|
end
|
@@ -384,7 +394,7 @@ module Bosh::CloudFoundry::ConfigOptions
|
|
384
394
|
@bosh_stemcell_versions ||= begin
|
385
395
|
# [{"name"=>"bosh-stemcell", "version"=>"0.6.7", "cid"=>"ami-9730bffe"}]
|
386
396
|
stemcells = director.list_stemcells
|
387
|
-
stemcells.select
|
397
|
+
stemcells = stemcells.select {|s| s["name"] == stemcell_name}
|
388
398
|
stemcells.map { |rel| rel["version"] }.sort { |v1, v2|
|
389
399
|
version_cmp(v1, v2)
|
390
400
|
}
|
@@ -274,6 +274,9 @@ class Bosh::CloudFoundry::SystemDeploymentManifestRenderer
|
|
274
274
|
"port"=>8100,
|
275
275
|
"catalina_opts"=>"-Xmx128m -Xms30m -XX:MaxPermSize=128m",
|
276
276
|
"no_ssl"=>true,
|
277
|
+
"client"=>{
|
278
|
+
"autoapprove"=>[]
|
279
|
+
},
|
277
280
|
"scim"=>{}},
|
278
281
|
"uaadb"=>
|
279
282
|
{"address"=>core_ip,
|
data/lib/bosh/cli/commands/cf.rb
CHANGED
@@ -38,10 +38,6 @@ module Bosh::Cli::Command
|
|
38
38
|
option "--admin-emails email1,email2", Array, "Admin email accounts in created CloudFoundry"
|
39
39
|
option "--skip-validations", "Skip all validations"
|
40
40
|
def prepare_system(name=nil)
|
41
|
-
# FUTURE remove this when cf-release has a final release with
|
42
|
-
# all patches in https://github.com/StarkAndWayne/bosh-cloudfoundry/issues/42
|
43
|
-
options[:dev] = true
|
44
|
-
|
45
41
|
setup_system_dir(name)
|
46
42
|
confirm_or_prompt_all_defaults
|
47
43
|
confirm_or_prompt_for_system_requirements
|
@@ -115,7 +111,8 @@ module Bosh::Cli::Command
|
|
115
111
|
usage "cf upload stemcell"
|
116
112
|
desc "download/create stemcell & upload to BOSH"
|
117
113
|
# option "--stable", "Use latest stemcell; possibly not tagged stable"
|
118
|
-
option "--latest", "Use latest stemcell; possibly not tagged stable
|
114
|
+
option "--latest", "Use latest stemcell; possibly not tagged stable"
|
115
|
+
option "--version VERSION", "Use base stemcell with specific version [default: 0.7.0]"
|
119
116
|
option "--custom", "Create custom stemcell from BOSH git source"
|
120
117
|
def upload_stemcell
|
121
118
|
stemcell_type = "stable" if options[:stable]
|
@@ -126,20 +123,27 @@ module Bosh::Cli::Command
|
|
126
123
|
|
127
124
|
usage "cf upload release"
|
128
125
|
desc "fetch & upload latest public cloudfoundry release to BOSH"
|
129
|
-
option "--branch branch", String, "Create development release from branch of cf-release
|
130
|
-
option "--final", "Upload latest final release from very latest cf-release commits"
|
126
|
+
option "--branch branch", String, "Create development release from branch of cf-release"
|
127
|
+
option "--final", "Upload latest final release from very latest cf-release commits [default]"
|
131
128
|
def upload_release
|
132
|
-
if options.delete(:
|
129
|
+
if new_branch = options.delete(:branch)
|
130
|
+
switch_to_development_release
|
131
|
+
elsif options.delete(:final)
|
132
|
+
switch_to_final_release
|
133
|
+
end
|
134
|
+
# TODO - default to final release when appcloud-130.yml is released
|
135
|
+
# switch_to_final_release unless system_config.release_type
|
136
|
+
switch_to_development_release unless system_config.release_type
|
137
|
+
|
138
|
+
if dev_release_type?
|
139
|
+
new_branch ||= "master"
|
140
|
+
set_cf_release_branch(new_branch)
|
133
141
|
clone_or_update_cf_release
|
134
|
-
|
142
|
+
prepare_cf_release_for_dev_release
|
143
|
+
create_and_upload_dev_release
|
135
144
|
else
|
136
|
-
# FUTURE once all patches from https://github.com/StarkAndWayne/bosh-cloudfoundry/issues/42
|
137
|
-
# are merged into cf-release, then no more gerrit merging required
|
138
|
-
if new_branch = options.delete(:branch)
|
139
|
-
set_cf_release_branch(new_branch)
|
140
|
-
end
|
141
145
|
clone_or_update_cf_release
|
142
|
-
|
146
|
+
upload_final_release
|
143
147
|
end
|
144
148
|
end
|
145
149
|
|
@@ -277,7 +281,16 @@ module Bosh::Cli::Command
|
|
277
281
|
# already uploaded to BOSH, else
|
278
282
|
# proceeds to upload the release
|
279
283
|
def confirm_or_upload_release
|
280
|
-
|
284
|
+
# if flags overriding the current final/dev
|
285
|
+
if options.delete(:edge) || options.delete(:custom) || options.delete(:dev)
|
286
|
+
switch_to_development_release
|
287
|
+
elsif options.delete(:final)
|
288
|
+
switch_to_final_release
|
289
|
+
end
|
290
|
+
# TODO - default to final release when appcloud-130.yml is released
|
291
|
+
# switch_to_final_release unless system_config.release_type
|
292
|
+
switch_to_development_release unless system_config.release_type
|
293
|
+
|
281
294
|
say "Using BOSH release name #{release_name_version} (#{effective_release_version})".green
|
282
295
|
unless bosh_release_names.include?(release_name)
|
283
296
|
say "BOSH does not contain release #{release_name.green}, uploading...".yellow
|
@@ -341,7 +354,7 @@ module Bosh::Cli::Command
|
|
341
354
|
end
|
342
355
|
end
|
343
356
|
|
344
|
-
# Largest version number BOSH stemcell ("bosh-stemcell")
|
357
|
+
# Largest version number BOSH stemcell ("bosh-stemcell") uploaded to BOSH
|
345
358
|
# @return [String] version number, e.g. "0.6.7"
|
346
359
|
def latest_bosh_stemcell_version
|
347
360
|
@latest_bosh_stemcell_version ||= begin
|
@@ -427,12 +440,14 @@ module Bosh::Cli::Command
|
|
427
440
|
# | bosh-stemcell-0.5.2.tgz | vsphere |
|
428
441
|
# | bosh-stemcell-aws-0.6.4.tgz | aws, stable |
|
429
442
|
# | bosh-stemcell-aws-0.6.7.tgz | aws |
|
443
|
+
#
|
444
|
+
# Ignores any stemcells with "pre" in their name
|
430
445
|
def bosh_stemcell_name(stemcell_type)
|
431
446
|
tags = [bosh_provider]
|
432
447
|
tags << "stable" if stemcell_type == "stable" unless openstack?
|
433
448
|
bosh_stemcells_cmd = "bosh public stemcells --tags #{tags.join(',')}"
|
434
449
|
say "Locating bosh stemcell, running '#{bosh_stemcells_cmd}'..."
|
435
|
-
`#{bosh_stemcells_cmd} | grep ' bosh-stemcell-' | awk '{ print $2 }' | sort -r | head -n 1`.strip
|
450
|
+
`#{bosh_stemcells_cmd} | grep ' bosh-stemcell-' | grep -v pre | awk '{ print $2 }' | sort -r | head -n 1`.strip
|
436
451
|
end
|
437
452
|
|
438
453
|
def download_stemcell(stemcell_name)
|
@@ -535,7 +550,7 @@ module Bosh::Cli::Command
|
|
535
550
|
common_password
|
536
551
|
security_group
|
537
552
|
|
538
|
-
set_cf_release_branch("
|
553
|
+
set_cf_release_branch("master")
|
539
554
|
end
|
540
555
|
|
541
556
|
# Renders the +SystemConfig+ model (+system_config+) into the system's
|
@@ -33,7 +33,7 @@ resource_pools:
|
|
33
33
|
size: 1
|
34
34
|
stemcell:
|
35
35
|
name: bosh-stemcell
|
36
|
-
version: 0.
|
36
|
+
version: 0.7.0
|
37
37
|
cloud_properties:
|
38
38
|
instance_type: m1.small
|
39
39
|
persistent_disk: 16192
|
@@ -42,7 +42,7 @@ resource_pools:
|
|
42
42
|
size: 1
|
43
43
|
stemcell:
|
44
44
|
name: bosh-stemcell
|
45
|
-
version: 0.
|
45
|
+
version: 0.7.0
|
46
46
|
cloud_properties:
|
47
47
|
instance_type: m1.small
|
48
48
|
persistent_disk: 16192
|
@@ -178,6 +178,9 @@ properties:
|
|
178
178
|
port: 8100
|
179
179
|
catalina_opts: -Xmx128m -Xms30m -XX:MaxPermSize=128m
|
180
180
|
no_ssl: true
|
181
|
+
client:
|
182
|
+
autoapprove: []
|
183
|
+
|
181
184
|
scim: {}
|
182
185
|
|
183
186
|
uaadb:
|
data/spec/assets/deployments/aws-core-1-m1.xlarge-free-postgresql-2-m1.small-free-postgresql.yml
CHANGED
@@ -33,7 +33,7 @@ resource_pools:
|
|
33
33
|
size: 1
|
34
34
|
stemcell:
|
35
35
|
name: bosh-stemcell
|
36
|
-
version: 0.
|
36
|
+
version: 0.7.0
|
37
37
|
cloud_properties:
|
38
38
|
instance_type: m1.small
|
39
39
|
persistent_disk: 16192
|
@@ -42,7 +42,7 @@ resource_pools:
|
|
42
42
|
size: 1
|
43
43
|
stemcell:
|
44
44
|
name: bosh-stemcell
|
45
|
-
version: 0.
|
45
|
+
version: 0.7.0
|
46
46
|
cloud_properties:
|
47
47
|
instance_type: m1.xlarge
|
48
48
|
persistent_disk: 16192
|
@@ -51,7 +51,7 @@ resource_pools:
|
|
51
51
|
size: 2
|
52
52
|
stemcell:
|
53
53
|
name: bosh-stemcell
|
54
|
-
version: 0.
|
54
|
+
version: 0.7.0
|
55
55
|
cloud_properties:
|
56
56
|
instance_type: m1.small
|
57
57
|
persistent_disk: 16192
|
@@ -198,6 +198,9 @@ properties:
|
|
198
198
|
port: 8100
|
199
199
|
catalina_opts: -Xmx128m -Xms30m -XX:MaxPermSize=128m
|
200
200
|
no_ssl: true
|
201
|
+
client:
|
202
|
+
autoapprove: []
|
203
|
+
|
201
204
|
scim: {}
|
202
205
|
|
203
206
|
uaadb:
|
@@ -33,7 +33,7 @@ resource_pools:
|
|
33
33
|
size: 1
|
34
34
|
stemcell:
|
35
35
|
name: bosh-stemcell
|
36
|
-
version: 0.
|
36
|
+
version: 0.7.0
|
37
37
|
cloud_properties:
|
38
38
|
instance_type: m1.small
|
39
39
|
persistent_disk: 16192
|
@@ -42,7 +42,7 @@ resource_pools:
|
|
42
42
|
size: 2
|
43
43
|
stemcell:
|
44
44
|
name: bosh-stemcell
|
45
|
-
version: 0.
|
45
|
+
version: 0.7.0
|
46
46
|
cloud_properties:
|
47
47
|
instance_type: m1.xlarge
|
48
48
|
jobs:
|
@@ -174,6 +174,9 @@ properties:
|
|
174
174
|
port: 8100
|
175
175
|
catalina_opts: -Xmx128m -Xms30m -XX:MaxPermSize=128m
|
176
176
|
no_ssl: true
|
177
|
+
client:
|
178
|
+
autoapprove: []
|
179
|
+
|
177
180
|
scim: {}
|
178
181
|
|
179
182
|
uaadb:
|
@@ -33,7 +33,7 @@ resource_pools:
|
|
33
33
|
size: 1
|
34
34
|
stemcell:
|
35
35
|
name: bosh-stemcell
|
36
|
-
version: 0.
|
36
|
+
version: 0.7.0
|
37
37
|
cloud_properties:
|
38
38
|
instance_type: m1.small
|
39
39
|
persistent_disk: 16192
|
@@ -157,6 +157,9 @@ properties:
|
|
157
157
|
port: 8100
|
158
158
|
catalina_opts: -Xmx128m -Xms30m -XX:MaxPermSize=128m
|
159
159
|
no_ssl: true
|
160
|
+
client:
|
161
|
+
autoapprove: []
|
162
|
+
|
160
163
|
scim: {}
|
161
164
|
|
162
165
|
uaadb:
|
@@ -23,9 +23,6 @@ describe Bosh::CloudFoundry::BoshReleaseManager do
|
|
23
23
|
self.cf_release_branch_dir = File.join(cf_release_dir, "master")
|
24
24
|
mkdir_p(cf_release_branch_dir)
|
25
25
|
should_receive(:sh).with("git pull origin master")
|
26
|
-
should_receive(:sh).with("sed -i 's#git@github.com:#https://github.com/#g' .gitmodules")
|
27
|
-
should_receive(:sh).with("sed -i 's#git://github.com#https://github.com#g' .gitmodules")
|
28
|
-
should_receive(:sh).with("git submodule update --init --recursive")
|
29
26
|
clone_or_update_cf_release
|
30
27
|
end
|
31
28
|
|
@@ -34,25 +31,32 @@ describe Bosh::CloudFoundry::BoshReleaseManager do
|
|
34
31
|
self.cf_release_branch_dir = File.join(cf_release_dir, "staging")
|
35
32
|
mkdir_p(cf_release_branch_dir)
|
36
33
|
should_receive(:sh).with("git pull origin staging")
|
34
|
+
clone_or_update_cf_release
|
35
|
+
end
|
36
|
+
|
37
|
+
it "prepare_cf_release_for_dev_release" do
|
38
|
+
self.cf_release_branch = "master"
|
39
|
+
self.cf_release_branch_dir = File.join(cf_release_dir, "master")
|
40
|
+
mkdir_p(cf_release_branch_dir)
|
37
41
|
should_receive(:sh).with("sed -i 's#git@github.com:#https://github.com/#g' .gitmodules")
|
38
42
|
should_receive(:sh).with("sed -i 's#git://github.com#https://github.com#g' .gitmodules")
|
39
43
|
should_receive(:sh).with("git submodule update --init --recursive")
|
40
|
-
|
44
|
+
prepare_cf_release_for_dev_release
|
41
45
|
end
|
42
46
|
|
43
47
|
describe "switch release types" do
|
44
48
|
it "from final to dev" do
|
45
|
-
self.cf_release_branch = "
|
49
|
+
self.cf_release_branch = "master"
|
46
50
|
@system_config.release_name = "appcloud"
|
47
51
|
@system_config.release_version = "latest"
|
48
52
|
@system_config.save
|
49
53
|
switch_to_development_release
|
50
|
-
@system_config.release_name.should == "appcloud-
|
54
|
+
@system_config.release_name.should == "appcloud-master"
|
51
55
|
@system_config.release_version.should == "latest"
|
52
56
|
end
|
53
57
|
|
54
58
|
it "from dev to final" do
|
55
|
-
@system_config.release_name = "appcloud-
|
59
|
+
@system_config.release_name = "appcloud-master"
|
56
60
|
@system_config.release_version = "latest"
|
57
61
|
@system_config.save
|
58
62
|
switch_to_final_release
|
@@ -43,11 +43,11 @@ describe Bosh::Cli::Command::Base do
|
|
43
43
|
@cmd.stub!(:bosh_target_uuid).and_return("DIRECTOR_UUID")
|
44
44
|
@cmd.stub!(:bosh_cpi).and_return("aws")
|
45
45
|
@cmd.should_receive(:`).
|
46
|
-
with("bosh public stemcells --tags aws | grep ' bosh-stemcell-' | awk '{ print $2 }' | sort -r | head -n 1").
|
46
|
+
with("bosh public stemcells --tags aws | grep ' bosh-stemcell-' | grep -v pre | awk '{ print $2 }' | sort -r | head -n 1").
|
47
47
|
and_return("bosh-stemcell-aws-0.6.7.tgz")
|
48
48
|
# FIXME default to stable stemcells when 0.8.1 is marked stable
|
49
49
|
# @cmd.should_receive(:`).
|
50
|
-
# with("bosh public stemcells --tags aws,stable | grep ' bosh-stemcell-' | awk '{ print $2 }' | sort -r | head -n 1").
|
50
|
+
# with("bosh public stemcells --tags aws,stable | grep ' bosh-stemcell-' | grep -v pre | awk '{ print $2 }' | sort -r | head -n 1").
|
51
51
|
# and_return("bosh-stemcell-aws-0.6.7.tgz")
|
52
52
|
@cmd.should_receive(:sh).
|
53
53
|
with("bosh -n --color download public stemcell bosh-stemcell-aws-0.6.7.tgz")
|
@@ -80,58 +80,51 @@ describe Bosh::Cli::Command::Base do
|
|
80
80
|
@cmd.upload_stemcell
|
81
81
|
end
|
82
82
|
|
83
|
-
it "updates/creates/uploads final cf-release"
|
84
|
-
|
85
|
-
# cf_release_dir = File.join(@releases_dir, "cf-release")
|
86
|
-
# FileUtils.mkdir_p(cf_release_dir)
|
87
|
-
# @cmd.system_config.cf_release_dir = cf_release_dir
|
88
|
-
# @cmd.system_config.cf_release_branch = "staging"
|
89
|
-
# @cmd.system_config.cf_release_branch_dir = File.join(cf_release_dir, "staging")
|
90
|
-
#
|
91
|
-
# @cmd.should_receive(:sh).with("git pull origin master")
|
92
|
-
# script = <<-BASH.gsub(/^ /, '')
|
93
|
-
# grep -rI "github.com" * .gitmodules | awk 'BEGIN {FS=":"} { print($1) }' | uniq while read file
|
94
|
-
# do
|
95
|
-
# echo "changing - $file"
|
96
|
-
# sed -i 's#git://github.com#https://github.com#g' $file
|
97
|
-
# sed -i 's#git@github.com:#https://github.com:#g' $file
|
98
|
-
# done
|
99
|
-
# BASH
|
100
|
-
# @cmd.should_receive(:sh).with("sed -i 's#git@github.com:#https://github.com/#g' .gitmodules")
|
101
|
-
# @cmd.should_receive(:sh).with("sed -i 's#git://github.com#https://github.com#g' .gitmodules")
|
102
|
-
# @cmd.should_receive(:sh).with("git submodule update --init --recursive")
|
103
|
-
# @cmd.should_receive(:`).with("tail -n 1 releases/index.yml | awk '{print $2}'").
|
104
|
-
# and_return("126")
|
105
|
-
# @cmd.should_receive(:sh).with("bosh -n --color upload release releases/appcloud-126.yml")
|
106
|
-
# @cmd.add_option(:final, true)
|
107
|
-
# @cmd.upload_release
|
108
|
-
# end
|
83
|
+
it "updates/creates/uploads final cf-release" do
|
84
|
+
generate_new_system
|
109
85
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
86
|
+
cf_release_dir = File.join(@releases_dir, "cf-release")
|
87
|
+
@cmd.system_config.cf_release_dir = cf_release_dir
|
88
|
+
@cmd.system_config.cf_release_branch = "master"
|
89
|
+
@cmd.system_config.cf_release_branch_dir = File.join(cf_release_dir, "master")
|
90
|
+
FileUtils.mkdir_p(@cmd.system_config.cf_release_branch_dir)
|
91
|
+
|
92
|
+
@cmd.should_receive(:sh).with("git pull origin master")
|
93
|
+
@cmd.should_receive(:`).with("tail -n 1 releases/index.yml | awk '{print $2}'").and_return("128")
|
94
|
+
@cmd.should_receive(:sh).with("bosh -n --color upload release releases/appcloud-128.yml")
|
95
|
+
|
96
|
+
@cmd.add_option(:final, true)
|
97
|
+
@cmd.upload_release
|
98
|
+
end
|
99
|
+
|
100
|
+
it "updates/creates/uploads development/edge cf-release (requires system setup)" do
|
101
|
+
generate_new_system
|
102
|
+
|
103
|
+
cf_release_dir = File.join(@releases_dir, "cf-release")
|
104
|
+
@cmd.system_config.cf_release_dir = cf_release_dir
|
105
|
+
@cmd.system_config.cf_release_branch = "master"
|
106
|
+
@cmd.system_config.cf_release_branch_dir = File.join(cf_release_dir, "master")
|
107
|
+
FileUtils.mkdir_p(@cmd.system_config.cf_release_branch_dir)
|
108
|
+
|
109
|
+
@cmd.should_receive(:sh).with("git pull origin master")
|
110
|
+
script = <<-BASH.gsub(/^ /, '')
|
111
|
+
grep -rI "github.com" * .gitmodules | awk 'BEGIN {FS=":"} { print($1) }' | uniq while read file
|
112
|
+
do
|
113
|
+
echo "changing - $file"
|
114
|
+
sed -i 's#git://github.com#https://github.com#g' $file
|
115
|
+
sed -i 's#git@github.com:#https://github.com:#g' $file
|
116
|
+
done
|
117
|
+
BASH
|
118
|
+
@cmd.should_receive(:sh).with("sed -i 's#git@github.com:#https://github.com/#g' .gitmodules")
|
119
|
+
@cmd.should_receive(:sh).with("sed -i 's#git://github.com#https://github.com#g' .gitmodules")
|
120
|
+
@cmd.should_receive(:sh).with("git submodule update --init --recursive")
|
121
|
+
@cmd.should_receive(:write_dev_config_file).with("appcloud-master")
|
122
|
+
@cmd.should_receive(:sh).with("bosh -n --color create release --with-tarball --force")
|
123
|
+
@cmd.should_receive(:sh).with("bosh -n --color upload release")
|
124
|
+
|
125
|
+
@cmd.add_option(:branch, "master")
|
126
|
+
@cmd.upload_release
|
127
|
+
end
|
135
128
|
|
136
129
|
def generate_new_system(cmd = nil)
|
137
130
|
needs_initial_release_uploaded = true
|
@@ -154,16 +147,22 @@ describe Bosh::Cli::Command::Base do
|
|
154
147
|
|
155
148
|
if needs_initial_release_uploaded
|
156
149
|
cmd.should_receive(:bosh_releases).exactly(1).times.and_return([])
|
150
|
+
|
151
|
+
# TODO revert to these when appcloud-130 is released; and we go to final release
|
152
|
+
# cmd.should_receive(:clone_or_update_cf_release)
|
153
|
+
# cmd.should_receive(:upload_final_release)
|
154
|
+
cmd.should_receive(:set_cf_release_branch).with("master").exactly(2).times
|
157
155
|
cmd.should_receive(:clone_or_update_cf_release)
|
156
|
+
cmd.should_receive(:prepare_cf_release_for_dev_release)
|
158
157
|
cmd.should_receive(:create_and_upload_dev_release)
|
159
158
|
else
|
160
159
|
cmd.should_receive(:bosh_releases).exactly(1).times.and_return([
|
161
|
-
{"name"=>"appcloud", "versions"=>["124", "126"], "in_use"=>[]},
|
162
|
-
{"name"=>"appcloud-
|
160
|
+
{"name"=>"appcloud", "versions"=>["124", "126", "129"], "in_use"=>[]},
|
161
|
+
{"name"=>"appcloud-master", "versions"=>["124.1-dev", "126.1-dev"], "in_use"=>[]},
|
163
162
|
])
|
164
163
|
end
|
165
164
|
|
166
|
-
cmd.should_receive(:bosh_stemcell_versions).exactly(4).times.and_return(['0.
|
165
|
+
cmd.should_receive(:bosh_stemcell_versions).exactly(4).times.and_return(['0.7.0'])
|
167
166
|
cmd.should_receive(:render_system)
|
168
167
|
|
169
168
|
provider = Bosh::CloudFoundry::Providers::AWS.new
|
@@ -196,11 +195,13 @@ describe Bosh::Cli::Command::Base do
|
|
196
195
|
File.basename(@cmd.system).should == "production"
|
197
196
|
end
|
198
197
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
198
|
+
# TODO restore when appcloud-130 released
|
199
|
+
it "uploads latest stemcell & final cf-release by default"
|
200
|
+
# do
|
201
|
+
# generate_new_system(@cmd)
|
202
|
+
# File.basename(@cmd.system).should == "production"
|
203
|
+
# @cmd.system_config.release_name.should == "appcloud"
|
204
|
+
# end
|
204
205
|
|
205
206
|
it "new system has common random password" do
|
206
207
|
generate_new_system(@cmd)
|
@@ -17,10 +17,6 @@ describe Bosh::CloudFoundry::ConfigOptions do
|
|
17
17
|
mkdir_p(@options[:system])
|
18
18
|
end
|
19
19
|
|
20
|
-
describe "common_config attribute" do
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
20
|
describe "system_config attribute" do
|
25
21
|
it "release_name can be overridden but is stored in system_config" do
|
26
22
|
options[:release_name] = "CHANGED"
|
@@ -25,7 +25,7 @@ describe Bosh::CloudFoundry::SystemDeploymentManifestRenderer do
|
|
25
25
|
@system_config.release_name = 'appcloud'
|
26
26
|
@system_config.release_version = 'latest'
|
27
27
|
@system_config.stemcell_name = 'bosh-stemcell'
|
28
|
-
@system_config.stemcell_version = '0.
|
28
|
+
@system_config.stemcell_version = '0.7.0'
|
29
29
|
@system_config.core_server_flavor = 'm1.small'
|
30
30
|
@system_config.core_ip = '1.2.3.4'
|
31
31
|
@system_config.root_dns = 'mycompany.com'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-cloudfoundry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
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-02-
|
12
|
+
date: 2013-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bosh_cli
|
@@ -109,6 +109,9 @@ files:
|
|
109
109
|
- Rakefile
|
110
110
|
- bosh-cloudfoundry.gemspec
|
111
111
|
- config/defaults.yml
|
112
|
+
- docs/BOSH-cf-initial-create.png
|
113
|
+
- docs/BOSH-cf-scaled.png
|
114
|
+
- docs/concept.md
|
112
115
|
- lib/bosh-cloudfoundry.rb
|
113
116
|
- lib/bosh-cloudfoundry/bosh_release_manager.rb
|
114
117
|
- lib/bosh-cloudfoundry/config.rb
|
@@ -160,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
163
|
version: '0'
|
161
164
|
segments:
|
162
165
|
- 0
|
163
|
-
hash:
|
166
|
+
hash: 1064713131226492709
|
164
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
168
|
none: false
|
166
169
|
requirements:
|
@@ -169,10 +172,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
172
|
version: '0'
|
170
173
|
segments:
|
171
174
|
- 0
|
172
|
-
hash:
|
175
|
+
hash: 1064713131226492709
|
173
176
|
requirements: []
|
174
177
|
rubyforge_project:
|
175
|
-
rubygems_version: 1.8.
|
178
|
+
rubygems_version: 1.8.25
|
176
179
|
signing_key:
|
177
180
|
specification_version: 3
|
178
181
|
summary: Create and manage your Cloud Foundry deployments on AWS and OpenStack with
|