dev-lxc 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -11,19 +11,19 @@ cluster builds for demo purposes, as well as general experimentation and explora
11
11
  ### Features
12
12
 
13
13
  1. LXC 1.0 Containers - Resource efficient servers with fast start/stop times and standard init
14
- 2. Btrfs - Storage efficient container backend provides fast container cloning
14
+ 2. Btrfs - Efficient storage backend provides fast, lightweight container cloning
15
15
  3. Dnsmasq - DHCP networking and DNS resolution
16
16
  4. Base platforms - Containers that are built to resemble a traditional server
17
- 5. ruby-lxc - Ruby bindings for LXC
17
+ 5. ruby-lxc - Ruby bindings for liblxc
18
18
  6. YAML - Simple, customizable definition of clusters; No more setting ENV variables
19
- 7. Build process closely models the docs instructions
19
+ 7. Build process closely models online installation documentation
20
20
 
21
21
  Its containers, standard init, networking and build process are designed to be similar
22
- to what you would build if you follow the product installation documentation so the end
22
+ to what you would build if you follow the online installation documentation so the end
23
23
  result is a cluster that is relatively similar to a more traditionally built cluster.
24
24
 
25
- The Btrfs backed clones provides a quick clean slate which is so helpful especially
26
- for experimenting and troubleshooting. Or it can be used to build a customized cluster
25
+ The Btrfs backed clones provide a quick clean slate which is helpful especially for
26
+ experimenting and troubleshooting. Or it can be used to build a customized cluster
27
27
  for demo purposes and be able to bring it up quickly and reliably.
28
28
 
29
29
  While most of the plumbing is already in place for an HA cluster it actually can't be
@@ -35,12 +35,12 @@ If you aren't familiar with using containers please read this introduction.
35
35
 
36
36
  ## Requirements
37
37
 
38
- The dev-lxc tool is designed to be used in platform built by the
38
+ The `dev-lxc` tool is designed to be used in a platform built by the
39
39
  [dev-lxc-platform](https://github.com/jeremiahsnapp/dev-lxc-platform) cookbook.
40
40
 
41
41
  Please follow the dev-lxc-platform usage instructions to create a suitable platform.
42
42
 
43
- The cookbook will automatically install this dev-lxc tool.
43
+ The cookbook will automatically install this `dev-lxc` tool.
44
44
 
45
45
  ### Use root
46
46
 
@@ -57,32 +57,31 @@ This config file describes what directories get mounted from the Vagrant VM host
57
57
  each container. You need to make sure that you configure the mount entries to be
58
58
  appropriate for your environment.
59
59
 
60
- The same goes for the paths to each package. The paths that are provided in the default
60
+ The same goes for the paths to each Chef package. The paths that are provided in the default
61
61
  configs are just examples. You need to make sure that you have each package you want to
62
62
  use downloaded to appropriate directories that will be available to the container when
63
63
  it is started.
64
64
 
65
65
  I recommend downloading the packages to a directory on your workstation.
66
66
  Then configure the `dev-lxc-platform` `Vagrantfile` to mount that directory in the
67
- Vagrant VM. Finally, configure the cluster's YAML config mount entries to mount the Vagrant
67
+ Vagrant VM. Finally, configure the cluster's mount entries to mount the Vagrant
68
68
  VM directory into each container.
69
69
 
70
- ## Upgrade dev-lxc gem
70
+ ## Update `dev-lxc` gem
71
71
 
72
- To upgrade the dev-lxc gem at any time you can run `gem uninstall -x dev-lxc` inside
73
- the Vagrant VM and then reprovision the VM using `vagrant provision`.
72
+ Run `gem update dev-lxc` inside the Vagrant VM to ensure you have the latest version.
74
73
 
75
- ## Usage
74
+ ## Background
76
75
 
77
- ### Base Containers Explained
76
+ ### Base Containers
78
77
 
79
78
  One of the key things this tool uses is the concept of "base" containers.
80
79
 
81
80
  `dev-lxc` creates containers with "b-" prepended to the name to distinguish it as
82
81
  a base container.
83
82
 
84
- Base containers are then snapshot cloned using the btrfs filesystem to provide very
85
- quick, lightweight duplicates of the base container that are either used to build
83
+ Base containers are then snapshot cloned using the btrfs filesystem to very quickly
84
+ provide lightweight duplicates of the base container that are either used to build
86
85
  another base container or a container that will actually be run.
87
86
 
88
87
  During a cluster build process the base containers that get created fall into three categories.
@@ -91,41 +90,70 @@ During a cluster build process the base containers that get created fall into th
91
90
 
92
91
  The platform base container is the first to get created.
93
92
 
94
- It is just the chosen OS platform and version (e.g. b-ubuntu-1204). A typical LXC container
95
- has minimal packages installed so `dev-lxc` makes sure that the same packages used in Chef's
96
- [bento boxes](https://github.com/opscode/bento) are installed to provide a more typical
97
- server environment. A few additional packages are also installed.
93
+ `DevLXC#create_base_platform` controls the creation of a platform base container.
94
+
95
+ This container provides the chosen OS platform and version (e.g. b-ubuntu-1204).
96
+ A typical LXC container has minimal packages installed so `dev-lxc` makes sure that the
97
+ same packages used in Chef's [bento boxes](https://github.com/opscode/bento) are
98
+ installed to provide a more typical server environment.
99
+ A few additional packages are also installed.
98
100
 
99
- Once this platform base container is created there is rarely a need to delete it
100
- or recreate it.
101
+ Once this platform base container is created there is rarely a need to delete it.
101
102
 
102
103
  2. Shared
103
104
 
104
105
  The shared base container is the second to get created.
105
106
 
106
- Common Chef packages such as Chef server, opscode-reporting and opscode-push-jobs-server are
107
- installed using `dpkg` or `rpm`.
107
+ `DevLXC::ChefServer#create_base_server` controls the creation of a shared base container.
108
+
109
+ Chef packages that are common to all servers in a Chef cluster, such as Chef server,
110
+ opscode-reporting and opscode-push-jobs-server are installed using `dpkg` or `rpm`.
108
111
 
109
112
  Note the manage package will not be installed at this point since it is not common to all
110
113
  servers (i.e. it does not get installed on backend servers).
111
114
 
115
+ The name of this base container is built from the names and versions of the Chef packages that
116
+ get installed which makes this base container easy to be reused by another cluster that is
117
+ configured to use the same Chef packages.
118
+
112
119
  Since no configuration actually happens yet there is rarely a need to delete this container.
113
- If another cluster is configured to use the same packages that are installed in this container
114
- then time is saved by just cloning this container for the new cluster to use.
115
120
 
116
121
  3. Unique
117
122
 
118
123
  The unique base container is the last to get created.
119
124
 
125
+ `DevLXC::ChefServer#create` controls the creation of a unique base container.
126
+
120
127
  Each unique Chef server (e.g. standalone, backend or frontend) is created.
121
128
 
122
129
  * The specified hostname is assigned.
123
130
  * dnsmasq is configured to reserve the specified IP address for the container's MAC address.
124
131
  * A DNS entry is created in dnsmasq if appropriate.
125
132
  * All installed Chef packages are configured.
133
+ * Test users and orgs are created.
126
134
  * The opscode-manage package is installed and configured if specified.
127
135
 
128
- ### Using `dev-lxc` to manually create a platform base container
136
+ After each server is fully configured a snapshot clone of it is made resulting in the server's
137
+ unique base container. These unique base containers make it very easy to quickly recreate
138
+ a Chef cluster from a clean starting point.
139
+
140
+ #### Destroying Base Containers
141
+
142
+ When using `dev-lxc cluster destroy` to destroy an entire Chef cluster or `dev-lxc server destroy [NAME]`
143
+ to destroy a single Chef server you have the option to also destroy any or all of the three types
144
+ of base containers associated with the cluster or server.
145
+
146
+ Either of the following commands will list the options available.
147
+
148
+ dev-lxc cluster help destroy
149
+
150
+ dev-lxc server help destroy
151
+
152
+ Of course, you can also just use the standard LXC commands to destroy any container.
153
+
154
+ lxc-destroy -n [NAME]
155
+
156
+ #### Manually Create a Platform Base Container
129
157
 
130
158
  Platform base containers can be used for purposes other than building clusters. For example, they can
131
159
  be used as Chef nodes for testing purposes.
@@ -187,7 +215,7 @@ Make sure the mounts and packages represent paths that are available in your env
187
215
  By default, `dev-lxc` looks for a `dev-lxc.yaml` file in the present working directory.
188
216
  You can also specify a particular config file as an option for most dev-lxc commands.
189
217
 
190
- I use the following to avoid specifying each cluster's config file while managing multiple clusters.
218
+ I use the following strategy to avoid specifying each cluster's config file while managing multiple clusters.
191
219
 
192
220
  mkdir -p ~/clusters/{clusterA,clusterB}
193
221
  dev-lxc cluster init tier > ~/clusters/clusterA/dev-lxc.yaml
@@ -229,7 +257,9 @@ more clusters you have to maintain uniqueness across the YAML config files for t
229
257
  The `dev-lxc-platform` creates the IP range 10.0.3.150 - 254 for DHCP reserved IP's.
230
258
 
231
259
  Use unique IP's from that range when configuring clusters.
232
-
260
+
261
+ ## Usage
262
+
233
263
  ### Shorter Commands are Faster (to type that is :)
234
264
 
235
265
  The root user's `~/.bashrc` file has aliased `dl` to `dev-lxc` for ease of use but for most
@@ -296,10 +326,10 @@ to run `private-chef-ctl reconfigure`.
296
326
 
297
327
  dev-lxc cluster run_command 'private-chef-ctl reconfigure'
298
328
 
299
- Use the following command to destroy the cluster's servers and also destroy their corresponding
300
- base servers so you can build them from scratch.
329
+ Use the following command to destroy the cluster's servers and also destroy their unique and shared
330
+ base containers so you can build them from scratch.
301
331
 
302
- dev-lxc cluster destroy -b
332
+ dev-lxc cluster destroy -u -s
303
333
 
304
334
  You can also run most of these commands against individual servers by using the server subcommand.
305
335
 
@@ -48,7 +48,7 @@ module DevLXC
48
48
  end
49
49
 
50
50
  def install_package(package_path)
51
- raise "File #{package_path} does not exist in container #{self.name}" unless run_command("test -e #{package_path}")
51
+ raise "File #{package_path} does not exist in container #{self.name}" unless run_command("test -e #{package_path}") == 0
52
52
  puts "Installing #{package_path} in container #{self.name}"
53
53
  case File.extname(package_path)
54
54
  when ".deb"
@@ -1,3 +1,3 @@
1
1
  module DevLXC
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev-lxc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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: 2014-03-06 00:00:00.000000000 Z
12
+ date: 2014-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler