bosh-gen 0.23.0 → 0.24.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.
Files changed (18) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +4 -0
  3. data/lib/bosh/gen/cli.rb +7 -0
  4. data/lib/bosh/gen/generators/blacksmith_forge_generator.rb +40 -0
  5. data/lib/bosh/gen/generators/blacksmith_forge_generator/templates/.gitkeep +0 -0
  6. data/lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/monit.tt +0 -0
  7. data/lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/spec.tt +51 -0
  8. data/lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/bin/configure-blacksmith.tt +45 -0
  9. data/lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/plans/service.yml +12 -0
  10. data/lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/plans/standalone/credentials.yml +18 -0
  11. data/lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/plans/standalone/init +3 -0
  12. data/lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/plans/standalone/manifest.yml.tt +14 -0
  13. data/lib/bosh/gen/generators/new_release_generator/templates/templates/deployment.yml.tt +1 -1
  14. data/lib/bosh/gen/generators/new_release_generator/templates/templates/infrastructure-aws-ec2.yml.tt +1 -1
  15. data/lib/bosh/gen/generators/new_release_generator/templates/templates/infrastructure-warden.yml.tt +1 -1
  16. data/lib/bosh/gen/generators/new_release_generator/templates/templates/jobs.yml.tt +2 -2
  17. data/lib/bosh/gen/version.rb +1 -1
  18. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8b00234c82d49b763a3ed19a84afceafc7493c8
4
- data.tar.gz: 3c69fec977cc0128d6a91353e9933a647a715c42
3
+ metadata.gz: fbd5f5ae54cc9d6045654c2545801a6c4f1f3d05
4
+ data.tar.gz: 1763c8535dbd032b94009dc164e1d178d983de8c
5
5
  SHA512:
6
- metadata.gz: 6b32ffaff5af4640f65a567baa60864021eb4faaccad2d870abbd308653874dea027a8ca9e32a2fa56f6c15974008c01052237dd6e50a1de24878a310a49c0a4
7
- data.tar.gz: 77f926b0c7c91283989e7b3f237dff994fb32b8fff2976bac04269231853db3bc19c1c8b2629a3524559d74bb952779e928c71934e1e88f3e4c1d20f5251672d
6
+ metadata.gz: bc70d4413f65711c68f4644f63fbec7c02f6c9a66865adba53bcc7e946416bfe206af44ab5ed5a0c709cc21c317402f9c328412d5fb74145191e774dc38227c7
7
+ data.tar.gz: 41a3a15b2d28a5e60cc33d076e8eebb24893a915e8e47ecdd4b82fba86d16dc7c49aab1b7752b947b5199da2fba98426c9fd591b1333665d0b69c0505ceb3583
@@ -1,6 +1,10 @@
1
1
  Change Log
2
2
  ==========
3
3
 
4
+ v0.24.0
5
+
6
+ - Added new `forge` command to generate new forges for [blacksmith](https://github.com/cloudfoundry-community/blacksmith). Thanks @jhunt
7
+
4
8
  v0.23.0
5
9
 
6
10
  Appreciation to James Hunt, Dennis Bell and Chris Weibel for the contributions.
@@ -94,6 +94,13 @@ module Bosh
94
94
  Bosh::Gen::Generators::JobTemplateGenerator.start([job_name, file_path])
95
95
  end
96
96
 
97
+ desc "forge NAME",
98
+ "Creates a Blacksmith Forge job to get you up and running"
99
+ def forge(job_name)
100
+ require 'bosh/gen/generators/blacksmith_forge_generator'
101
+ Bosh::Gen::Generators::BlacksmithForgeGenerator.start([job_name])
102
+ end
103
+
97
104
  desc "extract-job SOURCE_PACKAGE_PATH",
98
105
  "Extracts a job from another release and all its " +
99
106
  "dependent packages and source"
@@ -0,0 +1,40 @@
1
+ require 'yaml'
2
+ require 'thor/group'
3
+
4
+ module Bosh::Gen
5
+ module Generators
6
+ class BlacksmithForgeGenerator < Thor::Group
7
+ include Thor::Actions
8
+
9
+ argument :name
10
+
11
+ def self.source_root
12
+ File.join(File.dirname(__FILE__), "blacksmith_forge_generator", "templates")
13
+ end
14
+
15
+ # FYI, bosh-gen (the CLI) will eventually call Thor, telling it to `start()`
16
+ # Don't bother looking for a start() function anywhere; Thor just calls all of
17
+ # the public methods of this class.
18
+
19
+ def check_root_is_release
20
+ unless File.exist?("jobs") && File.exist?("packages")
21
+ raise Thor::Error.new("run inside a BOSH release project")
22
+ end
23
+ end
24
+
25
+ def check_name
26
+ raise Thor::Error.new("'#{name}' is not a valid BOSH id") unless "#{name}-blacksmith-plans".bosh_valid_id?
27
+ end
28
+
29
+ def copy_files
30
+ generator_job_templates_path = File.join(self.class.source_root, "jobs/%job_name%")
31
+ directory "jobs/%job_name%", "jobs/#{job_name}"
32
+ end
33
+
34
+ private
35
+ def job_name
36
+ "#{name}-blacksmith-plans"
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,51 @@
1
+ name: <%= job_name %>
2
+ packages: []
3
+ templates:
4
+ bin/configure-blacksmith: bin/configure-blacksmith
5
+
6
+ plans/service.yml: plans/service.yml
7
+
8
+ plans/standalone/manifest.yml: plans/standalone/manifest.yml
9
+ plans/standalone/credentials.yml: plans/standalone/credentials.yml
10
+ plans/standalone/init: plans/standalone/init
11
+
12
+
13
+ properties:
14
+ service.id:
15
+ description: Machine-friendly name for this service.
16
+ default: <%= name %>
17
+
18
+ service.name:
19
+ description: Human-friendly name for this service, to be displayed in the Cloud Foundry marketplace.
20
+ default: <%= name.capitalize %>
21
+
22
+ service.description:
23
+ description: A description for this service, to be displayed in the Cloud Foundry marketplace.
24
+ default: A dedicated <%= name.capitalize %> instance, deployed just for you.
25
+
26
+ service.tags:
27
+ description: List of tags to apply to service instances.
28
+ default: [blacksmith, dedicated, <%= name %>]
29
+
30
+ service.limit:
31
+ description: A global limit on the number of <%= name.capitalize %> services (regardless of the plan); 0 = unlimited.
32
+ default: 0
33
+
34
+ plans:
35
+ description: |
36
+ A map of plans. I.e.:
37
+
38
+ standalone:
39
+ name: Standalone <%= name.capitalize %> Instance
40
+ description: A single <%= name %> server, with no redundancy or replication
41
+ limit: 7
42
+ type: standalone
43
+ vm_type: default
44
+
45
+ Configuration keys beyond `name', `description', `limit', and `type' are type-specific.
46
+ limit: 7
47
+
48
+ For type=standalone:
49
+
50
+ vm_type What VM type to use for the standalone <%= name %> server.
51
+ Defaults to 'default'
@@ -0,0 +1,45 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
4
+ PLANSRC=/var/vcap/jobs/<%= job_name %>/plans
5
+ SVCROOT=/var/vcap/data/blacksmith/<%= name %>-forge/services
6
+ rm -rf $SVCROOT
7
+ mkdir -p $SVCROOT
8
+
9
+ # Copy the service definition stub for Blacksmith
10
+ cp $PLANSRC/service.yml $SVCROOT
11
+
12
+ <%= "<"+"%" %> p('plans').each do |id, plan| <%= "%"+">" %>
13
+ ##############################################
14
+ #
15
+ # Set up plan <%= "<"+"%" %>= id <%= "%"+">" %>
16
+ #
17
+ PLANROOT="$SVCROOT/<%= "<"+"%" %>= id <%= "%"+">" %>"
18
+ PLANTYPE="<%= "<"+"%" %>= plan["type"] || 'standalone' <%= "%"+">" %>"
19
+
20
+ mkdir -p $PLANROOT
21
+ cat > $PLANROOT/plan.yml <<EOF
22
+ ---
23
+ id: <%= "<"+"%" %>= id <%= "%"+">" %>
24
+ name: <%= "<"+"%" %>= plan["name"] || id <%= "%"+">" %>
25
+ limit: <%= "<"+"%" %>= plan["limit"] || 0 <%= "%"+">" %>
26
+ description: |+
27
+ <%= "<"+"%" %>= plan["description"] || 'no description provided' <%= "%"+">" %>
28
+ EOF
29
+
30
+ for file in init credentials.yml manifest.yml; do
31
+ cp $PLANSRC/$PLANTYPE/$file $PLANROOT/
32
+ done
33
+ chmod 0755 $PLANROOT/init
34
+
35
+ cat > $PLANROOT/params.yml <<EOF
36
+ ---
37
+ # auto-generated by <%= job_name %>
38
+ # for plan-id <%= "<"+"%" %>= id <%= "%"+">" %> (<%= "<"+"%" %>= plan["name"] || id <%= "%"+">" %>)
39
+ meta:
40
+ size: <%= "<"+"%" %>= plan["vm_type"] || 'default' <%= "%"+">" %>
41
+ EOF
42
+
43
+
44
+
45
+ <%= "<"+"%" %> end <%= "%"+">" %>
@@ -0,0 +1,12 @@
1
+ ---
2
+ id: <%= p('service.id') %>
3
+ name: <%= p('service.name') %>
4
+ description: |
5
+ <%= p('service.description') %>
6
+ tags:
7
+ <% p('service.tags', []).each { |tag| %> - <%= tag %>
8
+ <% } %>
9
+ bindable: true
10
+ metadata: {}
11
+ plan_updateable: true
12
+ <% if p('service.limit') > 0 %>limit: <%= p('service.limit') %><% end %>
@@ -0,0 +1,18 @@
1
+ ---
2
+ # credentials.yml is the means to communicate credentials
3
+ # and connection information to cf applications, when they
4
+ # bind your service to their applications.
5
+ #
6
+ # Blacksmith will `spruce merge` this file with:
7
+ # - The full BOSH deployment manifest
8
+ # - A file with the IP addresses for each BOSH instance.
9
+ #
10
+ # For example, if you have a job named `xyzzy', and you
11
+ # need to pass back the IP address of the first instance to
12
+ # bound applications, you could do this:
13
+ #
14
+ # ---
15
+ # credentials:
16
+ # host: (( grab jobs.xyzzy/0.ips[0] ))
17
+ #
18
+ credentials: {}
@@ -0,0 +1,14 @@
1
+ ---
2
+ stemcells:
3
+ - alias: default
4
+ os: ubuntu-trusty
5
+ version: latest
6
+
7
+ update:
8
+ canaries: 1
9
+ max_in_flight: 10
10
+ canary_watch_time: 1000-30000
11
+ update_watch_time: 1000-30000
12
+
13
+ releases: (( param "The author or this Forge forgot to define any releases. Oops." ))
14
+ instance_groups: (( param "The author of this Forge forgot to define any instance_groups. Oops." ))
@@ -9,7 +9,7 @@ director_uuid: (( param "Please set the UUID of your BOSH Directory" ))
9
9
 
10
10
  releases: (( param "Please list the BOSH releases to use for this deployment" ))
11
11
 
12
- jobs: (( param "Please configure the constituent Jobs for this Deployment" ))
12
+ instance_groups: (( param "Please configure the constituent instance groups for this Deployment" ))
13
13
 
14
14
  compilation:
15
15
  workers: 6
@@ -8,7 +8,7 @@ meta:
8
8
  name: bosh-aws-xen-hvm-ubuntu-trusty-go_agent
9
9
  version: latest
10
10
 
11
- jobs:
11
+ instance_groups:
12
12
  - name: just_install_packages
13
13
  networks:
14
14
  - name: <%= project_name_underscored %>1
@@ -12,7 +12,7 @@ update:
12
12
  canary_watch_time: 1000-30000
13
13
  update_watch_time: 1000-30000
14
14
 
15
- jobs:
15
+ instance_groups:
16
16
  - name: just_install_packages
17
17
  networks:
18
18
  - name: <%= project_name_underscored %>1
@@ -6,9 +6,9 @@ update:
6
6
  update_watch_time: 1000-30000
7
7
  serial: false
8
8
 
9
- jobs:
9
+ instance_groups:
10
10
  - name: just_install_packages
11
- templates:
11
+ jobs:
12
12
  - name: just_install_packages
13
13
  release: <%= project_name_hyphenated %>
14
14
  instances: 1
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Gen
3
- VERSION = "0.23.0"
3
+ VERSION = "0.24.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -192,6 +192,15 @@ files:
192
192
  - lib/bosh/cli/commands/share_release.rb
193
193
  - lib/bosh/gen.rb
194
194
  - lib/bosh/gen/cli.rb
195
+ - lib/bosh/gen/generators/blacksmith_forge_generator.rb
196
+ - lib/bosh/gen/generators/blacksmith_forge_generator/templates/.gitkeep
197
+ - lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/monit.tt
198
+ - lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/spec.tt
199
+ - lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/bin/configure-blacksmith.tt
200
+ - lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/plans/service.yml
201
+ - lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/plans/standalone/credentials.yml
202
+ - lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/plans/standalone/init
203
+ - lib/bosh/gen/generators/blacksmith_forge_generator/templates/jobs/%job_name%/templates/plans/standalone/manifest.yml.tt
195
204
  - lib/bosh/gen/generators/bosh_cli_plugin_generator.rb
196
205
  - lib/bosh/gen/generators/bosh_cli_plugin_generator/templates/lib/bosh/cli/commands/%underscore_plugin_name%.rb.tt
197
206
  - lib/bosh/gen/generators/errand_generator.rb