inception-server 0.2.1

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 (75) hide show
  1. data/.chef/knife.rb +4 -0
  2. data/.gitignore +21 -0
  3. data/.kitchen.yml +47 -0
  4. data/.rspec +3 -0
  5. data/.travis.yml +18 -0
  6. data/Berksfile +8 -0
  7. data/Berksfile.lock +9 -0
  8. data/ChangeLog.md +20 -0
  9. data/Gemfile +27 -0
  10. data/Guardfile +6 -0
  11. data/LICENSE.txt +22 -0
  12. data/README.md +126 -0
  13. data/Rakefile +66 -0
  14. data/TODO.md +25 -0
  15. data/bin/inception +8 -0
  16. data/bin/inception-server +8 -0
  17. data/config/ssh/kitchen-aws +23 -0
  18. data/cookbooks/bosh_inception/README.md +15 -0
  19. data/cookbooks/bosh_inception/attributes/default.rb +25 -0
  20. data/cookbooks/bosh_inception/files/default/Gemfile.cf +5 -0
  21. data/cookbooks/bosh_inception/files/default/Gemfile.micro +5 -0
  22. data/cookbooks/bosh_inception/metadata.rb +32 -0
  23. data/cookbooks/bosh_inception/recipes/default.rb +16 -0
  24. data/cookbooks/bosh_inception/recipes/install_bosh.rb +37 -0
  25. data/cookbooks/bosh_inception/recipes/install_ruby.rb +10 -0
  26. data/cookbooks/bosh_inception/recipes/mount_store_volume.rb +24 -0
  27. data/cookbooks/bosh_inception/recipes/packages.rb +23 -0
  28. data/cookbooks/bosh_inception/recipes/setup_dotfog.rb +29 -0
  29. data/cookbooks/bosh_inception/recipes/setup_git.rb +34 -0
  30. data/cookbooks/bosh_inception/recipes/useful_dirs.rb +13 -0
  31. data/inception-server.gemspec +43 -0
  32. data/lib/inception/cli.rb +141 -0
  33. data/lib/inception/cli_helpers/display.rb +26 -0
  34. data/lib/inception/cli_helpers/interactions.rb +15 -0
  35. data/lib/inception/cli_helpers/prepare_deploy_settings.rb +89 -0
  36. data/lib/inception/cli_helpers/provider.rb +14 -0
  37. data/lib/inception/cli_helpers/settings.rb +53 -0
  38. data/lib/inception/inception_server.rb +304 -0
  39. data/lib/inception/inception_server_cookbook.rb +90 -0
  40. data/lib/inception/next_deploy_actions.rb +20 -0
  41. data/lib/inception/providers/README.md +5 -0
  42. data/lib/inception/providers/clients/aws_provider_client.rb +144 -0
  43. data/lib/inception/providers/clients/fog_provider_client.rb +185 -0
  44. data/lib/inception/providers/clients/openstack_provider_client.rb +84 -0
  45. data/lib/inception/providers/constants/aws_constants.rb +25 -0
  46. data/lib/inception/providers/constants/openstack_constants.rb +12 -0
  47. data/lib/inception/providers.rb +28 -0
  48. data/lib/inception/version.rb +3 -0
  49. data/lib/inception.rb +9 -0
  50. data/nodes/.gitkeep +0 -0
  51. data/spec/assets/.gitkeep +0 -0
  52. data/spec/assets/gitconfig +5 -0
  53. data/spec/assets/settings/aws-before-server.yml +14 -0
  54. data/spec/assets/settings/aws-created-server.yml +31 -0
  55. data/spec/integration/.gitkeep +0 -0
  56. data/spec/integration/aws/aws_basic_spec.rb +38 -0
  57. data/spec/spec_helper.rb +50 -0
  58. data/spec/support/aws/aws_helpers.rb +73 -0
  59. data/spec/support/settings_helper.rb +20 -0
  60. data/spec/support/stdout_capture.rb +17 -0
  61. data/spec/unit/.gitkeep +0 -0
  62. data/spec/unit/cli_delete_spec.rb +39 -0
  63. data/spec/unit/cli_deploy_aws_spec.rb +83 -0
  64. data/spec/unit/cli_ssh_spec.rb +80 -0
  65. data/spec/unit/inception_server_cookbook_spec.rb +62 -0
  66. data/spec/unit/inception_server_spec.rb +58 -0
  67. data/spec/unit/providers/aws_spec.rb +198 -0
  68. data/test/integration/default/bats/discover_user.bash +2 -0
  69. data/test/integration/default/bats/dotfog.bats +11 -0
  70. data/test/integration/default/bats/install_ruby.bats +8 -0
  71. data/test/integration/default/bats/useful_dirs.bats +8 -0
  72. data/test/integration/default/bats/user.bats +9 -0
  73. data/test/integration/default/bats/verify_bosh.bats +18 -0
  74. data/test/integration/default/bats/verify_git.bats +18 -0
  75. metadata +361 -0
data/.chef/knife.rb ADDED
@@ -0,0 +1,4 @@
1
+ cookbook_path ["cookbooks"]
2
+ role_path nil
3
+ data_bag_path nil
4
+ #encrypted_data_bag_secret "data_bag_key"
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .kitchen/
19
+ .kitchen.local.yml
20
+ nodes/*.json
21
+ .DS_Store
data/.kitchen.yml ADDED
@@ -0,0 +1,47 @@
1
+ ---
2
+ driver_plugin: <%= ENV['AWS_ACCESS_KEY_ID'] ? "ec2" : "vagrant" %>
3
+
4
+ platforms:
5
+ <% if ENV['AWS_ACCESS_KEY_ID'] %>
6
+ - name: precise64_ec2
7
+ driver_plugin: ec2
8
+ driver_config:
9
+ aws_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
10
+ aws_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
11
+ # Default keypair is in Stark & Wayne AWS account for kitchen CI testing
12
+ aws_ssh_key_id: <%= ENV['AWS_SSH_KEY_NAME'] || 'kitchen' %> # name of the AWS keypair to use
13
+ ssh_key: <%= ENV['AWS_SSH_KEY_PATH'] || File.expand_path("../config/ssh/kitchen-aws", __FILE__) %> # private key such as ~/.ssh/id_rsa that matches the AWS keypair
14
+ region: us-east-1
15
+ availability_zone: us-east-1b
16
+ flavor_id: m1.medium
17
+ image_id: ami-856f02ec # us-east-1 12.04 amd64
18
+ username: ubuntu
19
+ groups:
20
+ - default
21
+ - ssh
22
+ require_chef_omnibus: true
23
+ <% elsif `vagrant plugin list | grep vmware-fusion`.strip.size > 0 &&
24
+ `vagrant box list | grep precise64 | grep vmware_fusion`.strip.size > 0 %>
25
+ - name: precise64_vmware_fusion
26
+ driver_config:
27
+ provider: vmware_fusion
28
+ box: precise64
29
+ box_url: https://s3.amazonaws.com/gsc-vagrant-boxes/ubuntu-12.04.2-server-amd64.box
30
+ require_chef_omnibus: true
31
+ <% else %>
32
+ - name: precise64_virtualbox
33
+ driver_config:
34
+ provider: virtualbox
35
+ box: precise64
36
+ box_url: http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box
37
+ require_chef_omnibus: true
38
+ <% end %>
39
+
40
+ suites:
41
+ - name: default
42
+ run_list:
43
+ - recipe[bosh_inception]
44
+ attributes:
45
+ fog:
46
+ aws_access_key_id: PERSONAL_ACCESS_KEY
47
+ aws_secret_access_key: PERSONAL_SECRET
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format progress
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,18 @@
1
+ ---
2
+ language: ruby
3
+ script: bundle exec rake spec:$SUITE
4
+ bundler_args: --without=vagrant
5
+ rvm:
6
+ - ruby-1.9.3
7
+ notifications:
8
+ email:
9
+ recipients:
10
+ - drnicwilliams@gmail.com
11
+ on_success: change
12
+ on_failure: always
13
+ env:
14
+ matrix:
15
+ - SUITE=unit
16
+ - SUITE=integration:aws:basic
17
+ global:
18
+ secure: "e1M3OQJfiqM7V1IPqwRZNUlw53Kl+6nTo6CbfcGu5+hTtutnh0n0t9DZjYxz\nYwgawuxXKzQfbBi5sYoMPBgKylR3JT7GKjIVRm+bA+jip3wmBjXAmT/DlFNQ\nKmtiMG0kXitHfVnG6imz2wUWikbEdjCzji1+9LV33Y6JGBkD+90="
data/Berksfile ADDED
@@ -0,0 +1,8 @@
1
+ site :opscode
2
+
3
+ cookbook "apt"
4
+ cookbook "user"
5
+ cookbook "sudo"
6
+ cookbook "hub"
7
+ cookbook "rvm", github: "fnichol/chef-rvm"
8
+ cookbook "bosh_inception", path: "cookbooks/bosh_inception"
data/Berksfile.lock ADDED
@@ -0,0 +1,9 @@
1
+ cookbook 'bosh_inception', :path => '/Users/drnic/Projects/ruby/gems/inception/cookbooks/bosh_inception'
2
+ cookbook 'apt', :locked_version => '1.9.2'
3
+ cookbook 'user', :locked_version => '0.3.0'
4
+ cookbook 'sudo', :locked_version => '2.1.0'
5
+ cookbook 'rvm', :git => 'git://github.com/fnichol/chef-rvm.git', :ref => '7038fb8c518d0d7785767de215b1ae463f237973'
6
+ cookbook 'java', :locked_version => '1.10.2'
7
+ cookbook 'windows', :locked_version => '1.8.10'
8
+ cookbook 'chef_handler', :locked_version => '1.1.4'
9
+ cookbook 'chef_gem', :locked_version => '0.1.0'
data/ChangeLog.md ADDED
@@ -0,0 +1,20 @@
1
+ # Change Log for Inception Server
2
+
3
+ ## v0.2.0
4
+
5
+ * Settings stored in `~/.inception_server` instead of `~/.bosh_inception`
6
+ * Using [readwritesettings](https://github.com/drnic/readwritesettings) instead of settingslogic for access/save settings
7
+ * install bosh-bootstrap & latest bosh-cloudfoundry --pre (v0.2.1)
8
+
9
+ Fixes:
10
+
11
+ * Fixed running `deploy` after `delete` by removing `cookbooks.prepared` setting
12
+ * Do not destroy local ~/.gitconfig when running tests
13
+
14
+ ## v0.1.0
15
+
16
+ * Initial release to mailing list
17
+ * Extracted from bosh-bootstrap v0.10.2
18
+ * Settings stored in `~/.bosh_inception`
19
+ * Chef cookbook `bosh_inception` replacing old bosh-bootstrap shell scripts
20
+ * Using [cyoi](https://github.com/drnic/cyoi) to prompt for infrastructure/provider credentials
data/Gemfile ADDED
@@ -0,0 +1,27 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in inception.gemspec
4
+ gemspec
5
+
6
+ cyoi = File.expand_path("../../cyoi", __FILE__)
7
+ if File.directory?(cyoi)
8
+ gem "cyoi", path: cyoi
9
+ end
10
+
11
+ # gem 'knife-solo', github: 'matschaffer/knife-solo'
12
+ # gem 'knife-solo', github: 'drnic/knife-solo', branch: 'continue_connecting'
13
+
14
+ group :integration do
15
+ gem 'kitchen-ec2'
16
+ end
17
+
18
+ group :vagrant do
19
+ gem 'kitchen-vagrant', '~> 0.10.0'
20
+ end
21
+
22
+ group :development do
23
+ gem "awesome_print"
24
+ gem "rb-fsevent", "~> 0.9.1"
25
+ gem "guard-rspec"
26
+ end
27
+
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard :rspec, spec_paths: ["spec/unit"] do
2
+ watch(%r{^spec/unit/.+_spec\.rb$})
3
+ watch(%r{^lib/inception/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec/unit" }
5
+ end
6
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Dr Nic Williams, Stark & Wayne, LLC
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # Inception Server for Bosh development
2
+
3
+ Create an inception server for Bosh-related development.
4
+
5
+ Includes a CLI for creating and preparing an inception server for deploying/developing a Bosh universe. The created or targeted VM is upgraded into an inception server via a Chef cookbook.
6
+
7
+ [![Build Status](https://travis-ci.org/drnic/inception-server.png?branch=master)](https://travis-ci.org/drnic/inception-server)
8
+ [![Code Climate](https://codeclimate.com/github/drnic/inception-server.png)](https://codeclimate.com/github/drnic/inception-server)
9
+
10
+ ## Installation
11
+
12
+ The tool is distributed as a RubyGem.
13
+
14
+ ```
15
+ $ gem install inception-server
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ This project includes both a standalone CLI to create an inception server or transform an existing VM into an inception server; and the internal Chef cookbooks that can be used outside of the CLI.
21
+
22
+ ### CLI usage - create a remote inception server
23
+
24
+ To create a remote inception server, normally in the IaaS/region that you will be working with BOSH:
25
+
26
+ ```
27
+ $ inception deploy
28
+
29
+ Auto-detected infrastructure API credentials at ~/.fog (override with $FOG)
30
+ 1. AWS (default)
31
+ 2. AWS (starkandwayne)
32
+ 3. Alternate credentials
33
+ Choose infrastructure: 3
34
+
35
+ 1. AWS
36
+ 2. OpenStack
37
+ Choose infrastructure: 1
38
+
39
+
40
+ Using provider aws:
41
+
42
+ 1. *US East (Northern Virginia) Region (us-east-1)
43
+ 2. US West (Oregon) Region (us-west-2)
44
+ 3. US West (Northern California) Region (us-west-1)
45
+ 4. EU (Ireland) Region (eu-west-1)
46
+ 5. Asia Pacific (Singapore) Region (ap-southeast-1)
47
+ 6. Asia Pacific (Sydney) Region (ap-southeast-2)
48
+ 7. Asia Pacific (Tokyo) Region (ap-northeast-1)
49
+ 8. South America (Sao Paulo) Region (sa-east-1)
50
+ Choose AWS region: 2
51
+
52
+ Access key: KEYGOESHERE
53
+ Secret key: SECRETGOESHERE
54
+
55
+ Confirming: Using aws/us-west-2
56
+
57
+ Preparing deployment settings
58
+
59
+ Using your git user.name (Dr Nic Williams)
60
+ Acquiring a public IP address... 54.245.246.122
61
+
62
+ Provision inception server
63
+
64
+ Created security group ssh
65
+ -> opened ssh ports TCP 22..22 from IP range 0.0.0.0/0
66
+ Booting m1.small Inception VM...
67
+ Provisioning 16Gb persistent disk for inception VM...
68
+
69
+ Prepare inception VM
70
+
71
+ knife solo bootstrap ubuntu@ec2-54-214-66-166.us-west-2.compute.amazonaws.com [...]
72
+ Bootstrapping Chef...
73
+ ... lots of chef output...
74
+
75
+ ```
76
+
77
+ ### CLI usage - upgrade existing remote inception server
78
+
79
+ You can upgrade your remote inception server at any time by re-running the `deploy` command.
80
+
81
+ ```
82
+ $ inception deploy
83
+ ... lots of chef output ...
84
+ ```
85
+
86
+
87
+ ### Chef cookbook usage - remote VM
88
+
89
+ This project includes a `bosh_inception` Chef cookbook.
90
+
91
+ You can apply the cookbook to a preexisting remote VM using [knife solo](http://matschaffer.github.io/knife-solo/ "knife-solo"):
92
+
93
+ ```
94
+ $ bundle
95
+ $ bundle exec knife solo bootstrap ubuntu@HOST -r 'bosh_inception'
96
+ $ bundle exec knife solo bootstrap ubuntu@HOST -j '{"disk": {"mounted": true, "device": "/dev/xvdf"}}' -r 'bosh_inception'
97
+
98
+ # for more help information:
99
+ $ knife solo bootstrap -h
100
+ ```
101
+
102
+ See `cookbooks/bosh_inception/attributes/default.rb` for available JSON overrides.
103
+
104
+ ### Chef cookbook usage - local VM
105
+
106
+ You can also apply the cookbooks to the local VM (or a remote VM that you've shelled into) using your favourite Chef toolchain.
107
+
108
+ See `cookbooks/bosh_inception/attributes/default.rb` for available JSON overrides.
109
+
110
+ ## Development
111
+
112
+ One half of the functionality is in a Chef cookbook `bosh_inception`. To load this cookbook into a Vagrant VM and run a series of integration tests (via `test-kitchen`):
113
+
114
+ ```
115
+ $ bundle
116
+ $ kitchen test virtualbox
117
+ $ kitchen test vmware # if you have vagrant vmware plugin
118
+ ```
119
+
120
+ ## Contributing
121
+
122
+ 1. Fork it
123
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
124
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
125
+ 4. Push to the branch (`git push origin my-new-feature`)
126
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,66 @@
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __FILE__)
2
+
3
+ require "rubygems"
4
+ require "bundler"
5
+ Bundler.setup(:default, :test, :development, :integration)
6
+
7
+ require "bundler/gem_tasks"
8
+
9
+ require "rake/dsl_definition"
10
+ require "rake"
11
+ require "rspec/core/rake_task"
12
+
13
+
14
+ begin
15
+ require 'kitchen/rake_tasks'
16
+ Kitchen::RakeTasks.new
17
+ rescue LoadError
18
+ puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
19
+ end
20
+
21
+
22
+ if defined?(RSpec)
23
+ namespace :spec do
24
+ desc "Run Unit Tests"
25
+ unit_rspec_task = RSpec::Core::RakeTask.new(:unit) do |t|
26
+ t.pattern = "spec/unit/**/*_spec.rb"
27
+ t.rspec_opts = %w(--format progress --color)
28
+ end
29
+
30
+ desc "Run cookbook tests (only if $AWS_ACCESS_KEY_ID is set)"
31
+ task :cookbooks do
32
+ if ENV['AWS_ACCESS_KEY_ID']
33
+ sh "kitchen test ec2"
34
+ else
35
+ puts "Skipping spec:cookbooks. Please provide $AWS_ACCESS_KEY_ID & $AWS_SECRET_ACCESS_KEY_ID"
36
+ end
37
+ end
38
+
39
+ namespace :integration do
40
+ namespace :aws do
41
+ jobs = Dir["spec/integration/aws/*_spec.rb"].map {|f| File.basename(f).gsub(/aws_(.*)_spec.rb/, '\1')}
42
+ jobs.each do |job|
43
+ desc "Run AWS '#{job}' Integration Test"
44
+ RSpec::Core::RakeTask.new(job.to_sym) do |t|
45
+ t.pattern = "spec/integration/aws/aws_#{job}_spec.rb"
46
+ t.rspec_opts = %w(--format progress --color)
47
+ end
48
+ end
49
+ end
50
+
51
+ desc "Run AWS Integration Tests"
52
+ RSpec::Core::RakeTask.new(:aws) do |t|
53
+ t.pattern = "spec/integration/aws/*_spec.rb"
54
+ t.rspec_opts = %w(--format progress --color)
55
+ end
56
+ end
57
+
58
+ desc "Run all Integration Tests"
59
+ task :integration => %w[spec:integration:aws]
60
+ end
61
+
62
+ desc "Install dependencies and run tests"
63
+ task :spec => %w(spec:unit spec:integration)
64
+ end
65
+
66
+ task :default => ["spec:unit"]
data/TODO.md ADDED
@@ -0,0 +1,25 @@
1
+ ## CLI
2
+
3
+ * do not install Chef each time; run `knife solo prepare`, then only run `knife solo cook` after that
4
+ * rename to inception => inception
5
+ * --no-converge flag do not run chef on deploy
6
+ * next_deploy_actions - deleted from settings after deploy completes
7
+ * integration test - OpenStack - create VM, use busser (?) to run remote SSH bats tests, destroy VM
8
+ * observe InstanceServer#create stages and run save_settings! after each one (idempotence)
9
+ * observe InstanceServer#create stages and display STDOUT as it goes along
10
+ * interactive delete
11
+
12
+ ## Cookbooks
13
+
14
+ * echo "export TMPDIR=/var/vcap/store/tmp" >> /home/#{node.user.username}/.bashrc
15
+ * echo "export EDITOR=vim" >> /home/#{node.user.username}/.bashrc
16
+ * move bosh-micro & bosh-cf installation into separate cookbooks
17
+ * stuff that will go onto AMI must be installed into root volume, not /var/vcap/store
18
+ * where does btrfs need to be installed? should /var/vcap/store be btrfs instead of ext4?
19
+
20
+
21
+ ## AMIs
22
+
23
+ * export an AMI in us-east-1
24
+ * copy the AMI to other regions
25
+ * use the AMIs instead of 13.04 base AMIs
data/bin/inception ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ $:.push File.dirname(__FILE__) + '/../lib'
3
+
4
+ require "rubygems"
5
+ require 'inception'
6
+ require 'inception/cli'
7
+
8
+ Inception::Cli.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ $:.push File.dirname(__FILE__) + '/../lib'
3
+
4
+ require "rubygems"
5
+ require 'inception'
6
+ require 'inception/cli'
7
+
8
+ Inception::Cli.start
@@ -0,0 +1,23 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEowIBAAKCAQEAuUUa2QOpW4qb5shjxUa+ktUdNVcdsi3h1eqE+jDvH1wgxPGkRQyetiAZ+92/
3
+ aL7975lHX95x1T8f5LeLlH5t3PYpsfU8bXk5FVjCasCzBkCO4+QNPMP1pCAlbuDNKfoI530ShcRv
4
+ Znu5D4SEGGHsZzBKHBlpi3DytyPkIuPxUlnp/IMG0MGywvHENxf2gL6xODBbXDjn7kdn59cluztw
5
+ p2HFm+m06lt/VxJ0GvShMKqTLradneqw3551Vs7d6j9R75ofsl6BA50CLZoYDJhDH96nUOxzrC+m
6
+ zgr/v+Y2eS6oIeuuAytPYc8JEpUSlCXYR6MzIRzDGN5/9aOHJpVb8QIDAQABAoIBAAX8EnryIFVh
7
+ q9mPnZFw0JUjpzbi4oWv77yeP79pN0A3FKPn/ltwpevSK6S0LAuxJ7jGpcSWBe1ShbA4sZyRXPEn
8
+ Tn9+IX6TzOFApb8XDHFmQndgFYFh/xxXIX5sapQxjHoV0zRY/RQ9aOP0buPuvdkzeSFhPMSRWHXM
9
+ BgGOhWwYh0/41cvEIwFzGkIk5JsQWIKqigHPDTQD1SO6gxnVFgP7MtlvZoK7NE4190XvgCK3xFd4
10
+ aSK2diCGgZ4CBx7RIlHtn4H9KR3KCzG5xm+4K0L1RE2peRggo82Fc6TAQ/md+xk+Cq/Xl2UdTAkn
11
+ pCDNF64IwJFHUA0W4y6zmOQh7rECgYEA8F0DgfFFDWhR9YYLBOkeQXOL/faN7oGgb3ccnfz8rWn7
12
+ w5xccNg06AgM3cPBMkoo2lKUfHfvSzq7p+fpEvDJRiVtz1kKp6TsfWeMfePTR7CocKP0vDzqFpWm
13
+ 32WMaEpgHtAvvd/LDEpCI3VT9rXUa9KtvsxzCMjwgZFI9DsR0d0CgYEAxVKSSmSiZwGcGBBSYqnF
14
+ fctJd9Z8Dbte4UaRUK4jsZOXupNLAU3NOO+zDqx7IjT/1y7/WboLQfj5RwW8Lcol+gGQY0KiMkGl
15
+ 4RFkxSYoJMaTx0/Cx87V1hiOjSljB2Ubmbz6dxr/nRitC4fEw0wXkB1bM4LADydOVreyxzFPMyUC
16
+ gYAdCzA0UGIGp7dXkpXcRwrn371nt5YY3sLzFRJ5KKujjK3mSguFeyqRav+bAF9k4z8iel4E2D0q
17
+ +vLX7Bbmuf+oITeumVTHQw9sa8m3IINUI02HJtiYskea6QRb9BpOM8Z/kqpiKBuR5ZsuS6wUoI4F
18
+ ZVSnPG8d/aHKFjMZh9W0ZQKBgQCjNaP40nodlxBEOyPZpbDLVpzi+U5MkWFuFc9WG2M8muaSFQii
19
+ AHcxk9nX1kRWy92dX6snzSFIpSWSYCUA/sYgnrCN2WyNAw2wNpHSG7hyiqlq3wct+1+VoWQvUD8v
20
+ u6pzpALLB1LL3sAq3FacbtDCi/WGiqxPHGTIh1LhPWDT3QKBgEliTq4yzfkrCyaZ62SJDouyKr8F
21
+ RlaVV6mLQnuu6UXw2XMPEJjrjXu/2e8BM9tenNlHJSCWmgDQeqVBSw8m2HJJ28zs6UAR86BApR6H
22
+ BPHX1m0kRiABubxqWPCm9kciwqbiVMtlyrzFmN3kDescd9EAhexRI/CwnnkHh+iH2jUu
23
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,15 @@
1
+ # Cookbook for inception
2
+
3
+ Chef cookbook to convert a VM into an inception server to deploy/develop Bosh and bosh releases.
4
+
5
+ ## Development
6
+
7
+ To clone the repo containing this cookbook and run the cookbook tests:
8
+
9
+ ```
10
+ git clone git@github.com:drnic/inception.git
11
+ cd inception
12
+ bundle
13
+ kitchen test virtualbox
14
+ kitchen test vmware # if you have the plugin installed
15
+ ```
@@ -0,0 +1,25 @@
1
+ # A String or Array of SSH public keys to populate the user"s .ssh/authorized_keys file.
2
+
3
+ default["disk"]["mounted"] = false
4
+ default["disk"]["device"] = "/dev/xvdf"
5
+ default["disk"]["fstype"] = "btrfs"
6
+ default["disk"]["dir"] = "/var/vcap/store"
7
+ default["user"]["username"] = `users | head -n 1`.strip
8
+ default["git"]["name"] = "Nobody"
9
+ default["git"]["email"] = "nobody@in-the-house.com"
10
+ default["rvm"]["default_ruby"] = "ruby-1.9.3"
11
+ default["rvm"]["global_gems"] = [
12
+ { "name" => "bundler" },
13
+ { "name" => "rake" },
14
+ { "name" => "jazor" },
15
+ { "name" => "yaml_command" },
16
+ { "name" => "chef" },
17
+ { "name" => "rubygems-bundler",
18
+ "action" => "remove"
19
+ }
20
+ ]
21
+
22
+ # Pass in credentials to be dropped into a ~/.fog file
23
+ # They will be automatically converted to symbolized keys
24
+ # to make fog happy
25
+ default["fog"] = {}
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+ source 'https://s3.amazonaws.com/bosh-jenkins-gems/'
3
+
4
+ gem "bosh-bootstrap"
5
+ gem "bosh-cloudfoundry", ">= 0.7.0.alpha"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+ source 'https://s3.amazonaws.com/bosh-jenkins-gems/'
3
+
4
+ gem "bosh_cli", "~> 1.5.0.pre"
5
+ gem "bosh_cli_plugin_micro", "~> 1.5.0.pre"
@@ -0,0 +1,32 @@
1
+ name "bosh_inception"
2
+ version "0.1.0"
3
+ description "Become an inception server to deploy/develop Bosh and bosh releases"
4
+ long_description IO.read(File.expand_path('../README.md', __FILE__))
5
+ maintainer "Dr Nic Williams"
6
+ maintainer_email "drnicwilliams@gmail.com"
7
+
8
+ supports "ubuntu"
9
+
10
+ depends "apt"
11
+ depends "sudo"
12
+ depends "rvm"
13
+ depends "hub"
14
+
15
+ attribute "git",
16
+ display_name: "Git",
17
+ description: "Hash of git config attributes",
18
+ type: "hash",
19
+ required: "recommended"
20
+
21
+ attribute "git/name",
22
+ display_name: "Git user's name",
23
+ description: "Name for git user",
24
+ type: "string",
25
+ required: "recommended"
26
+
27
+ attribute "git/email",
28
+ display_name: "Git user's email",
29
+ description: "Email for git user",
30
+ type: "string",
31
+ required: "recommended"
32
+
@@ -0,0 +1,16 @@
1
+ #
2
+ # Cookbook Name:: bosh_inception
3
+ # Recipe:: default
4
+ #
5
+ # Copyright (c) 2013 Dr Nic Williams, Stark & Wayne, LLC
6
+ #
7
+ # MIT License
8
+ #
9
+
10
+ include_recipe "bosh_inception::mount_store_volume"
11
+ include_recipe "bosh_inception::useful_dirs"
12
+ include_recipe "bosh_inception::packages"
13
+ include_recipe "bosh_inception::setup_git"
14
+ include_recipe "bosh_inception::install_ruby"
15
+ include_recipe "bosh_inception::install_bosh"
16
+ include_recipe "bosh_inception::setup_dotfog"
@@ -0,0 +1,37 @@
1
+ cookbook_file "/var/vcap/store/microboshes/Gemfile" do
2
+ source "Gemfile.micro"
3
+ owner node.user.username
4
+ group node.user.username
5
+ mode "0644"
6
+ end
7
+
8
+ directory "/var/vcap/store/microboshes" do
9
+ owner node.user.username
10
+ group node.user.username
11
+ mode "0755"
12
+ recursive true
13
+ action :create
14
+ end
15
+
16
+ rvm_shell "install bosh micro" do
17
+ code "bundle install"
18
+ cwd "/var/vcap/store/microboshes"
19
+ # user node.user.username
20
+ # environment ({'HOME' => "/home/#{node.user.username}"})
21
+ action :run
22
+ end
23
+
24
+ cookbook_file "/var/vcap/store/systems/Gemfile" do
25
+ source "Gemfile.cf"
26
+ owner node.user.username
27
+ group node.user.username
28
+ mode "0644"
29
+ end
30
+
31
+ rvm_shell "install bosh cf" do
32
+ code "bundle install"
33
+ cwd "/var/vcap/store/systems"
34
+ # user node.user.username
35
+ # environment ({'HOME' => "/home/#{node.user.username}"})
36
+ action :run
37
+ end
@@ -0,0 +1,10 @@
1
+ #
2
+ # Cookbook Name:: bosh_inception
3
+ # Recipe:: install_ruby
4
+ #
5
+ # Copyright (c) 2013 Dr Nic Williams, Stark & Wayne, LLC
6
+ #
7
+ # MIT License
8
+ #
9
+
10
+ include_recipe "rvm::system"
@@ -0,0 +1,24 @@
1
+ if node.disk.mounted
2
+ package "btrfs-tools" if node.disk.fstype == "btrfs"
3
+
4
+ bash "format /var/vcap/store partition" do
5
+ code "mkfs.#{node.disk.fstype} #{node.disk.device}"
6
+ not_if "cat /proc/mounts | grep /var/vcap/store"
7
+ end
8
+
9
+ directory node.disk.dir do
10
+ owner "root"
11
+ group "root"
12
+ mode "0755"
13
+ recursive true
14
+ action :create
15
+ end
16
+
17
+ mount node.disk.dir do
18
+ device node.disk.device
19
+ options "rw noatime"
20
+ fstype node.disk.fstype
21
+ action [ :enable, :mount ]
22
+ not_if "cat /proc/mounts | grep /var/vcap/store"
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ #
2
+ # Cookbook Name:: bosh_inception
3
+ # Recipe:: packages
4
+ #
5
+ # Copyright (c) 2013 Dr Nic Williams, Stark & Wayne, LLC
6
+ #
7
+ # MIT License
8
+ #
9
+
10
+ include_recipe "apt"
11
+
12
+ %w[
13
+ build-essential libsqlite3-dev curl rsync git-core
14
+ libmysqlclient-dev libxml2-dev libxslt-dev libpq-dev libsqlite3-dev
15
+ runit
16
+ genisoimage
17
+ debootstrap kpartx qemu-kvm
18
+ whois
19
+ tmux mosh
20
+ vim
21
+ ].each do |pkg|
22
+ package pkg
23
+ end