vagabond 0.2.8 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/CHANGELOG.md +16 -0
  2. data/DEVELOP.md +38 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +33 -0
  5. data/README.md +55 -21
  6. data/USAGE.md +28 -3
  7. data/Vagabondfile.sample +47 -0
  8. data/Vagrantfile +17 -5
  9. data/bin/vagabond +5 -0
  10. data/lib/vagabond/Cheffile +7 -0
  11. data/lib/vagabond/Cheffile.dev +7 -0
  12. data/lib/vagabond/actions/cluster.rb +22 -8
  13. data/lib/vagabond/actions/create.rb +7 -4
  14. data/lib/vagabond/actions/destroy.rb +24 -14
  15. data/lib/vagabond/actions/freeze.rb +1 -0
  16. data/lib/vagabond/actions/init.rb +8 -11
  17. data/lib/vagabond/actions/provision.rb +16 -8
  18. data/lib/vagabond/actions/rebuild.rb +4 -9
  19. data/lib/vagabond/actions/ssh.rb +9 -1
  20. data/lib/vagabond/actions/start.rb +1 -0
  21. data/lib/vagabond/actions/status.rb +1 -0
  22. data/lib/vagabond/actions/thaw.rb +1 -0
  23. data/lib/vagabond/actions/up.rb +22 -7
  24. data/lib/vagabond/bootstraps/chef_10_compat_config.erb +62 -0
  25. data/lib/vagabond/bootstraps/no_lazy_load.erb +63 -0
  26. data/lib/vagabond/bootstraps/server-zero.erb +1 -8
  27. data/lib/vagabond/bootstraps/server.erb +9 -6
  28. data/lib/vagabond/constants.rb +1 -6
  29. data/lib/vagabond/core.rb +209 -0
  30. data/lib/vagabond/errors.rb +3 -0
  31. data/lib/vagabond/helpers.rb +11 -99
  32. data/lib/vagabond/helpers/base.rb +134 -0
  33. data/lib/vagabond/helpers/callbacks.rb +47 -0
  34. data/lib/vagabond/helpers/chains.rb +23 -0
  35. data/lib/vagabond/helpers/commands.rb +49 -0
  36. data/lib/vagabond/helpers/knife.rb +47 -0
  37. data/lib/vagabond/helpers/naming.rb +39 -0
  38. data/lib/vagabond/helpers/server.rb +30 -0
  39. data/lib/vagabond/internal_configuration.rb +186 -32
  40. data/lib/vagabond/kitchen.rb +110 -60
  41. data/lib/vagabond/knife.rb +5 -1
  42. data/lib/vagabond/layout.rb +1 -0
  43. data/lib/vagabond/monkey/kitchen_config.rb +1 -0
  44. data/lib/vagabond/notify_mash.rb +25 -0
  45. data/lib/vagabond/server.rb +81 -49
  46. data/lib/vagabond/settings.rb +17 -0
  47. data/lib/vagabond/spec.rb +125 -99
  48. data/lib/vagabond/uploader.rb +4 -1
  49. data/lib/vagabond/uploader/berkshelf.rb +2 -1
  50. data/lib/vagabond/uploader/knife.rb +3 -9
  51. data/lib/vagabond/uploader/librarian.rb +2 -5
  52. data/lib/vagabond/vagabond.rb +77 -93
  53. data/lib/vagabond/vagabondfile.rb +73 -9
  54. data/lib/vagabond/version.rb +2 -1
  55. data/vagabond.gemspec +7 -5
  56. metadata +58 -81
  57. data/lib/vagabond/cookbooks/apt/Berksfile +0 -8
  58. data/lib/vagabond/cookbooks/apt/CHANGELOG.md +0 -97
  59. data/lib/vagabond/cookbooks/apt/CONTRIBUTING +0 -29
  60. data/lib/vagabond/cookbooks/apt/LICENSE +0 -201
  61. data/lib/vagabond/cookbooks/apt/README.md +0 -243
  62. data/lib/vagabond/cookbooks/apt/TESTING.md +0 -25
  63. data/lib/vagabond/cookbooks/apt/attributes/default.rb +0 -4
  64. data/lib/vagabond/cookbooks/apt/files/default/apt-proxy-v2.conf +0 -50
  65. data/lib/vagabond/cookbooks/apt/metadata.rb +0 -30
  66. data/lib/vagabond/cookbooks/apt/providers/preference.rb +0 -61
  67. data/lib/vagabond/cookbooks/apt/providers/repository.rb +0 -132
  68. data/lib/vagabond/cookbooks/apt/recipes/cacher-client.rb +0 -59
  69. data/lib/vagabond/cookbooks/apt/recipes/cacher-ng.rb +0 -40
  70. data/lib/vagabond/cookbooks/apt/recipes/default.rb +0 -68
  71. data/lib/vagabond/cookbooks/apt/resources/preference.rb +0 -30
  72. data/lib/vagabond/cookbooks/apt/resources/repository.rb +0 -40
  73. data/lib/vagabond/cookbooks/apt/templates/debian-6.0/acng.conf.erb +0 -174
  74. data/lib/vagabond/cookbooks/apt/templates/default/01proxy.erb +0 -2
  75. data/lib/vagabond/cookbooks/apt/templates/default/acng.conf.erb +0 -276
  76. data/lib/vagabond/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +0 -270
  77. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/README.md +0 -1
  78. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/cacher-ng_test.rb +0 -28
  79. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/default_test.rb +0 -28
  80. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/lwrps_test.rb +0 -48
  81. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/support/helpers.rb +0 -29
  82. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/metadata.rb +0 -6
  83. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/cacher-ng.rb +0 -20
  84. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/default.rb +0 -20
  85. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/lwrps.rb +0 -66
  86. data/lib/vagabond/cookbooks/lxc/CHANGELOG.md +0 -37
  87. data/lib/vagabond/cookbooks/lxc/Gemfile +0 -4
  88. data/lib/vagabond/cookbooks/lxc/Gemfile.lock +0 -41
  89. data/lib/vagabond/cookbooks/lxc/README.md +0 -112
  90. data/lib/vagabond/cookbooks/lxc/attributes/default.rb +0 -26
  91. data/lib/vagabond/cookbooks/lxc/files/default/knife_lxc +0 -228
  92. data/lib/vagabond/cookbooks/lxc/files/default/lxc-awesome-ephemeral +0 -499
  93. data/lib/vagabond/cookbooks/lxc/libraries/lxc.rb +0 -477
  94. data/lib/vagabond/cookbooks/lxc/libraries/lxc_expanded_resources.rb +0 -40
  95. data/lib/vagabond/cookbooks/lxc/libraries/lxc_file_config.rb +0 -84
  96. data/lib/vagabond/cookbooks/lxc/libraries/monkey.rb +0 -51
  97. data/lib/vagabond/cookbooks/lxc/metadata.rb +0 -12
  98. data/lib/vagabond/cookbooks/lxc/providers/config.rb +0 -75
  99. data/lib/vagabond/cookbooks/lxc/providers/container.rb +0 -354
  100. data/lib/vagabond/cookbooks/lxc/providers/default.rb +0 -57
  101. data/lib/vagabond/cookbooks/lxc/providers/ephemeral.rb +0 -40
  102. data/lib/vagabond/cookbooks/lxc/providers/fstab.rb +0 -30
  103. data/lib/vagabond/cookbooks/lxc/providers/interface.rb +0 -45
  104. data/lib/vagabond/cookbooks/lxc/providers/service.rb +0 -53
  105. data/lib/vagabond/cookbooks/lxc/recipes/containers.rb +0 -13
  106. data/lib/vagabond/cookbooks/lxc/recipes/default.rb +0 -58
  107. data/lib/vagabond/cookbooks/lxc/recipes/install_dependencies.rb +0 -15
  108. data/lib/vagabond/cookbooks/lxc/recipes/knife.rb +0 -37
  109. data/lib/vagabond/cookbooks/lxc/resources/config.rb +0 -19
  110. data/lib/vagabond/cookbooks/lxc/resources/container.rb +0 -54
  111. data/lib/vagabond/cookbooks/lxc/resources/default.rb +0 -12
  112. data/lib/vagabond/cookbooks/lxc/resources/ephemeral.rb +0 -13
  113. data/lib/vagabond/cookbooks/lxc/resources/fstab.rb +0 -12
  114. data/lib/vagabond/cookbooks/lxc/resources/interface.rb +0 -13
  115. data/lib/vagabond/cookbooks/lxc/resources/service.rb +0 -5
  116. data/lib/vagabond/cookbooks/lxc/templates/default/client.rb.erb +0 -13
  117. data/lib/vagabond/cookbooks/lxc/templates/default/default-lxc.erb +0 -3
  118. data/lib/vagabond/cookbooks/lxc/templates/default/file_content.erb +0 -2
  119. data/lib/vagabond/cookbooks/lxc/templates/default/fstab.erb +0 -5
  120. data/lib/vagabond/cookbooks/lxc/templates/default/interface.erb +0 -27
  121. data/lib/vagabond/cookbooks/vagabond/README.md +0 -10
  122. data/lib/vagabond/cookbooks/vagabond/attributes/default.rb +0 -18
  123. data/lib/vagabond/cookbooks/vagabond/files/default/lxc-centos +0 -460
  124. data/lib/vagabond/cookbooks/vagabond/libraries/vagabond.rb +0 -10
  125. data/lib/vagabond/cookbooks/vagabond/metadata.rb +0 -8
  126. data/lib/vagabond/cookbooks/vagabond/recipes/default.rb +0 -132
  127. data/lib/vagabond/cookbooks/vagabond/recipes/zero.rb +0 -9
  128. data/lib/vagabond/helpers/cheffile_loader.rb +0 -20
  129. data/vagabond-0.2.6.gem +0 -0
@@ -1,10 +0,0 @@
1
- module Vagabond
2
- class << self
3
- def get_bytes(s)
4
- s = s.to_s
5
- indx = [nil, 'k', 'm', 'g']
6
- power = indx.index(s.slice(-1, s.length).to_s.downcase).to_i * 10
7
- (2**power) * s.to_i
8
- end
9
- end
10
- end
@@ -1,8 +0,0 @@
1
- name 'vagabond'
2
- version '1.0.0'
3
- license 'Apache 2.0'
4
- maintainer 'Chris Roberts'
5
- maintainer_email 'chrisroberts.code@gmail.com'
6
-
7
- depends 'lxc'
8
- depends 'apt'
@@ -1,132 +0,0 @@
1
-
2
- # TODO: Move this to lxc cookbook proper at some point
3
- # TODO: Test this on fresh node to ensure start up scripts actuall do
4
- # what they are expected to
5
- =begin
6
- dpkg_autostart 'lxc' do
7
- allow false
8
- end
9
-
10
- dpkg_autostart 'lxc-net' do
11
- allow false
12
- end
13
-
14
- # Start at 0 and increment up if found
15
- unless(node[:network][:interfaces][:lxcbr0])
16
- max = node.network.interfaces.map do |name, val|
17
- Array(val[:routes]).map do |route|
18
- if(route[:family] == 'inet' && route[:destination].start_with?('10.0'))
19
- route[:destination].split('/').first.split('.')[3].to_i
20
- end
21
- end
22
- end.compact.max
23
-
24
- node.default[:vagabond][:lxc_network][:oct] = max ? max + 1 : 0
25
-
26
- # Test for existing bridge. Use different subnet if found
27
- l_net = "10.0.#{node[:vagabond][:lxc_network][:oct]}"
28
-
29
- node.set[:lxc][:addr] = "#{l_net}.1"
30
- node.set[:lxc][:network] = "#{l_net}.0/24"
31
- node.set[:lxc][:dhcp_range] = "#{l_net}.2,#{l_net}.199"
32
- node.set[:lxc][:dhcp_max] = '199'
33
- end
34
- =end
35
-
36
- include_recipe 'apt::cacher-ng'
37
- include_recipe 'lxc'
38
-
39
- ruby_block 'LXC template: lxc-centos' do
40
- block do
41
- dir = %w(/usr/share /usr/lib).map do |prefix|
42
- if(File.directory?(d = File.join(prefix, 'lxc/templates')))
43
- d
44
- end
45
- end.compact.first
46
- raise 'Failed to locate LXC template directory' unless dir
47
- cfl = Chef::Resource::CookbookFile.new(
48
- ::File.join(dir, 'lxc-centos'),
49
- run_context
50
- )
51
- cfl.source 'lxc-centos'
52
- cfl.mode 0755
53
- cfl.cookbook cookbook_name.to_s
54
- cfl.action :nothing
55
- cfl.run_action(:create)
56
- end
57
- end
58
-
59
- node[:vagabond][:bases].each do |name, options|
60
-
61
- next unless options[:enabled]
62
-
63
- pkg_coms = [
64
- 'update -y -q',
65
- 'upgrade -y -q',
66
- 'install curl -y -q'
67
- ]
68
- if(!options[:template].scan(%r{debian|ubuntu}).empty?)
69
- pkg_man = 'apt-get'
70
- proxy = ["echo \"Acquire::http::Proxy \\\"http://#{node[:lxc][:addr]}:#{node[:apt][:cacher_port]}\\\";\" > /etc/apt/apt.conf.d/01proxy"]
71
- proxy << "echo \"Acquire::https::Proxy \\\"DIRECT\\\";\" >> /etc/apt/apt.conf.d/01proxy"
72
- elsif(!options[:template].scan(%r{fedora|centos}).empty?)
73
- pkg_man = 'yum'
74
- end
75
- if(pkg_man)
76
- pkg_coms.map! do |c|
77
- "#{pkg_man} #{c}"
78
- end
79
- else
80
- pkg_coms = []
81
- end
82
- pkg_coms = proxy + pkg_coms if proxy
83
-
84
- lxc_container name do
85
- template options[:template]
86
- template_opts options[:template_options]
87
- default_config false if options[:memory]
88
- create_environment options[:environment] if options[:environment]
89
- initialize_commands [
90
- 'locale-gen en_US.UTF-8',
91
- 'update-locale LANG="en_US.UTF-8"',
92
- 'rm -f /etc/sysctl.d/10-console-messages.conf',
93
- 'rm -f /etc/sysctl.d/10-ptrace.conf',
94
- 'rm -f /etc/sysctl.d/10-kernel-hardening.conf'
95
- ] + pkg_coms + [
96
- 'curl -L https://www.opscode.com/chef/install.sh | bash'
97
- ]
98
- end
99
- end
100
-
101
- =begin
102
- # TODO: This will be the base for building ephemeral servers
103
- lxc_container 'chef-server' do
104
- clone 'ubuntu_1204'
105
- initialize_commands [
106
-
107
- ]
108
- only_if do
109
- node[:vagabond][:server_base]
110
- end
111
- end
112
- =end
113
-
114
- node[:vagabond][:customs].each do |name, options|
115
-
116
- lxc_container name do
117
- action :create
118
- clone options[:base]
119
- end
120
-
121
- if(options[:memory])
122
- lxc_config name do
123
- cgroup(
124
- 'memory.limit_in_bytes' => options[:memory][:ram],
125
- 'memory.memsw.limit_in_bytes' => (
126
- Vagabond.get_bytes(options[:memory][:ram]) +
127
- Vagabond.get_bytes(options[:memory][:swap])
128
- )
129
- )
130
- end
131
- end
132
- end
@@ -1,9 +0,0 @@
1
- execute 'apt-get update'
2
- package 'build-essential'
3
- gem_package 'chef-zero'
4
-
5
- execute 'start chef-zero' do
6
- command "start-stop-daemon --background --start --quiet --exec #{File.join(node[:languages][:ruby][:bin_dir],'chef-zero')} -- -H #{node[:ipaddress]} -p 80 start"
7
- not_if 'netstat -lpt | grep "tcp[[:space:]]" | grep ruby'
8
- end
9
-
@@ -1,20 +0,0 @@
1
- module Vagabond
2
- class CheffileLoader
3
-
4
- attr_reader :cookbooks
5
-
6
- def initialize(path=nil)
7
- @cookbooks = []
8
- load(path) if path
9
- end
10
-
11
- def cookbook(name, *args)
12
- cookbooks[name] = args
13
- end
14
-
15
- def load(path)
16
- instance_eval(File.read(path))
17
- end
18
-
19
- end
20
- end
Binary file