dev-lxc 0.5.0 → 0.6.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.
- checksums.yaml +4 -4
- data/README.md +248 -141
- data/dev-lxc.gemspec +1 -1
- data/files/configs/open-source.yml +20 -10
- data/files/configs/standalone.yml +40 -18
- data/files/configs/tier.yml +56 -26
- data/lib/dev-lxc/cli.rb +128 -65
- data/lib/dev-lxc/cluster.rb +174 -0
- data/lib/dev-lxc/container.rb +2 -2
- data/lib/dev-lxc/server.rb +414 -0
- data/lib/dev-lxc/version.rb +1 -1
- data/lib/dev-lxc.rb +34 -34
- metadata +6 -6
- data/lib/dev-lxc/chef-cluster.rb +0 -97
- data/lib/dev-lxc/chef-server.rb +0 -339
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a53ebf97a2d361a6f04b0ce461b7209b45ce5504
|
4
|
+
data.tar.gz: 8dff129d818639fef6661972af488a9419a6e341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a2abf6c170530d27dde4bba706c6e188a97a36fc36e10c6f07fa6b55efdb51aa6d0a4ece988da52f3df519b56744f02be9998f4af440dad185ca51e7eadbad
|
7
|
+
data.tar.gz: 65a1c2809ed81b6692559c2a31923fac87031c5cee9a1ec32ed00d1c0d01f1f12168ac530c71b4dd3b733c8a6928f3c18b34823ca09861432947e038ff63908d
|
data/README.md
CHANGED
@@ -4,8 +4,8 @@ A tool for creating Chef Server clusters with a Chef Analytics server using LXC
|
|
4
4
|
|
5
5
|
Using [ruby-lxc](https://github.com/lxc/ruby-lxc) it builds a standalone Chef Server or
|
6
6
|
tier Chef Server cluster composed of a backend and multiple frontends with round-robin
|
7
|
-
DNS resolution. It will also optionally build a Chef Analytics server
|
8
|
-
the Chef Server.
|
7
|
+
DNS resolution. It will also optionally build a standalone or tier Chef Analytics server
|
8
|
+
and connect it with the Chef Server.
|
9
9
|
|
10
10
|
The dev-lxc tool is well suited as a tool for support related work, customized
|
11
11
|
cluster builds for demo purposes, as well as general experimentation and exploration.
|
@@ -15,10 +15,12 @@ cluster builds for demo purposes, as well as general experimentation and explora
|
|
15
15
|
1. LXC 1.0 Containers - Resource efficient servers with fast start/stop times and standard init
|
16
16
|
2. Btrfs - Efficient storage backend provides fast, lightweight container cloning
|
17
17
|
3. Dnsmasq - DHCP networking and DNS resolution
|
18
|
-
4.
|
18
|
+
4. Platform Images - Images that are built to resemble a traditional server
|
19
19
|
5. ruby-lxc - Ruby bindings for liblxc
|
20
20
|
6. YAML - Simple, customizable definition of clusters; No more setting ENV variables
|
21
21
|
7. Build process closely follows online installation documentation
|
22
|
+
8. Images - Images are created during the cluster's build process which makes rebuilding
|
23
|
+
a cluster very fast.
|
22
24
|
|
23
25
|
Its containers, standard init, networking and build process are designed to be similar
|
24
26
|
to what you would build if you follow the online installation documentation so the end
|
@@ -90,19 +92,13 @@ dl i standalone > dev-lxc.yml
|
|
90
92
|
```
|
91
93
|
|
92
94
|
```
|
93
|
-
dev-lxc
|
94
|
-
dl
|
95
|
-
|
96
|
-
# if no subcommand is given then `start` will be called by default
|
97
|
-
# and any arguments will be passed to the `start` subcommand
|
98
|
-
# so both of the following commands will start all servers
|
99
|
-
dev-lxc
|
100
|
-
dl
|
95
|
+
dev-lxc up
|
96
|
+
dl u
|
101
97
|
```
|
102
98
|
|
103
99
|
```
|
104
100
|
dev-lxc status
|
105
|
-
dl
|
101
|
+
dl st
|
106
102
|
```
|
107
103
|
|
108
104
|
```
|
@@ -112,8 +108,8 @@ dl d
|
|
112
108
|
|
113
109
|
### Create and Manage a Cluster
|
114
110
|
|
115
|
-
The following instructions will build a tier
|
116
|
-
demonstration purposes.
|
111
|
+
The following instructions will build a tier Chef Server with a tier Analytics server
|
112
|
+
for demonstration purposes.
|
117
113
|
The size of this cluster uses about 3GB ram and takes awhile for the first
|
118
114
|
build of the servers. Feel free to try the standalone config first.
|
119
115
|
|
@@ -125,18 +121,28 @@ Be sure you configure the
|
|
125
121
|
[mounts and packages entries](https://github.com/jeremiahsnapp/dev-lxc#cluster-config-files)
|
126
122
|
appropriately.
|
127
123
|
|
128
|
-
|
124
|
+
```
|
125
|
+
dev-lxc init tier > dev-lxc.yml
|
126
|
+
```
|
129
127
|
|
130
|
-
|
128
|
+
#### List Images
|
129
|
+
|
130
|
+
List of each servers' images created during the build process.
|
131
|
+
|
132
|
+
```
|
133
|
+
dev-lxc list_images
|
134
|
+
```
|
131
135
|
|
132
136
|
#### Start cluster
|
133
137
|
|
134
138
|
Starting the cluster the first time takes awhile since it has a lot to build.
|
135
139
|
|
136
|
-
The tool automatically creates
|
137
|
-
|
140
|
+
The tool automatically creates images at appropriate times so future creation of the
|
141
|
+
cluster's servers is very quick.
|
138
142
|
|
139
|
-
|
143
|
+
```
|
144
|
+
dev-lxc up
|
145
|
+
```
|
140
146
|
|
141
147
|
A test org, user, knife.rb and keys are automatically created in
|
142
148
|
the bootstrap backend server in `/root/chef-repo/.chef` for testing purposes.
|
@@ -149,31 +155,41 @@ org and user.
|
|
149
155
|
|
150
156
|
Run the following command to see the status of the cluster.
|
151
157
|
|
152
|
-
|
158
|
+
```
|
159
|
+
dev-lxc status
|
160
|
+
```
|
153
161
|
|
154
162
|
This is an example of the output.
|
155
163
|
|
156
164
|
```
|
157
|
-
|
158
|
-
Analytics is available at https://analytics.lxc
|
159
|
-
tier-be.lxc running 10.0.3.203
|
160
|
-
tier-fe1.lxc running 10.0.3.204
|
161
|
-
tier-analytics.lxc running 10.0.3.206
|
162
|
-
```
|
165
|
+
Chef Server: https://chef.lxc
|
163
166
|
|
164
|
-
|
167
|
+
Analytics: https://analytics.lxc
|
168
|
+
|
169
|
+
chef-be.lxc running 10.0.3.203
|
170
|
+
chef-fe1.lxc running 10.0.3.204
|
171
|
+
analytics-be.lxc running 10.0.3.206
|
172
|
+
analytics-fe1.lxc running 10.0.3.207
|
173
|
+
```
|
165
174
|
|
166
175
|
#### Create chef-repo
|
167
176
|
|
168
177
|
Create a local chef-repo with appropriate knife.rb and pem files.
|
169
178
|
|
170
|
-
|
179
|
+
Also create a `./bootstrap-node` script to simplify creating and
|
180
|
+
bootstrapping nodes in the `dev-lxc-platform`.
|
181
|
+
|
182
|
+
```
|
183
|
+
dev-lxc chef-repo
|
184
|
+
```
|
171
185
|
|
172
186
|
Now you can easily use knife to access the cluster.
|
173
187
|
|
174
|
-
|
175
|
-
|
176
|
-
|
188
|
+
```
|
189
|
+
cd chef-repo
|
190
|
+
knife ssl fetch
|
191
|
+
knife client list
|
192
|
+
```
|
177
193
|
|
178
194
|
#### Cheap cluster rebuilds
|
179
195
|
|
@@ -181,78 +197,112 @@ Clones of the servers as they existed immediately after initial installation, co
|
|
181
197
|
test org and user creation are available so you can destroy the cluster and "rebuild" it within
|
182
198
|
seconds effectively starting with a clean slate very easily.
|
183
199
|
|
184
|
-
|
185
|
-
|
200
|
+
```
|
201
|
+
dev-lxc destroy
|
202
|
+
dev-lxc up
|
203
|
+
```
|
186
204
|
|
187
205
|
#### Stop and start the cluster
|
188
206
|
|
189
|
-
|
190
|
-
|
207
|
+
```
|
208
|
+
dev-lxc halt
|
209
|
+
dev-lxc up
|
210
|
+
```
|
191
211
|
|
192
212
|
#### Backdoor access to each server's filesystem
|
193
213
|
|
194
214
|
The abspath subcommand can be used to prepend each server's rootfs path to a particular file.
|
195
215
|
|
196
|
-
For example, you can use the following command to edit the
|
216
|
+
For example, you can use the following command to edit the Chef Servers' chef-server.rb
|
197
217
|
file without logging into the containers.
|
198
218
|
|
199
|
-
|
219
|
+
```
|
220
|
+
emacs $(dev-lxc abspath chef /etc/opscode/chef-server.rb)
|
221
|
+
```
|
200
222
|
|
201
223
|
#### Run arbitrary commands in each server
|
202
224
|
|
203
225
|
After modifying the chef-server.rb you could use the run_command subcommand to tell the backend and
|
204
226
|
frontend servers to run `chef-server-ctl reconfigure`.
|
205
227
|
|
206
|
-
|
228
|
+
```
|
229
|
+
dev-lxc run_command chef 'chef-server-ctl reconfigure'
|
230
|
+
```
|
231
|
+
|
232
|
+
#### Make a snapshot of the servers
|
233
|
+
|
234
|
+
Save the changes in the servers to custom images.
|
235
|
+
|
236
|
+
```
|
237
|
+
dev-lxc halt
|
238
|
+
dev-lxc snapshot
|
239
|
+
```
|
240
|
+
|
241
|
+
Now the servers can be destroyed and recreated with the same changes captured at the time of the snapshot.
|
242
|
+
|
243
|
+
```
|
244
|
+
dev-lxc destroy
|
245
|
+
dev-lxc up
|
246
|
+
```
|
207
247
|
|
208
248
|
#### Destroy cluster
|
209
249
|
|
210
|
-
Use the following command to destroy the cluster's servers and also destroy their unique and shared
|
211
|
-
|
250
|
+
Use the following command to destroy the cluster's servers and also destroy their custom, unique and shared
|
251
|
+
images if you want to build them from scratch.
|
212
252
|
|
213
|
-
|
253
|
+
```
|
254
|
+
dev-lxc destroy -c -u -s
|
255
|
+
```
|
214
256
|
|
215
|
-
#### Use commands against
|
216
|
-
You can also run most of these commands against a set of servers by specifying a
|
217
|
-
a set of server names.
|
257
|
+
#### Use commands against specific servers
|
258
|
+
You can also run most of these commands against a set of servers by specifying a regular expression
|
259
|
+
that matches a set of server names.
|
218
260
|
|
219
|
-
|
261
|
+
```
|
262
|
+
dev-lxc <subcommand> [SERVER_NAME_REGEX]
|
263
|
+
```
|
220
264
|
|
221
|
-
For example, to only start the
|
265
|
+
For example, to only start the Chef Servers named `chef-be.lxc` and `chef-fe1.lxc`
|
222
266
|
you can run the following command.
|
223
267
|
|
224
|
-
|
268
|
+
```
|
269
|
+
dev-lxc up 'chef'
|
270
|
+
```
|
225
271
|
|
226
272
|
### Using the dev-lxc library
|
227
273
|
|
228
274
|
dev-lxc cli interface can be used as a library.
|
229
275
|
|
230
|
-
|
276
|
+
```
|
277
|
+
require 'dev-lxc/cli'
|
231
278
|
|
232
|
-
|
233
|
-
|
279
|
+
ARGV = [ 'up' ] # start all servers
|
280
|
+
DevLXC::CLI::DevLXC.start
|
234
281
|
|
235
|
-
|
236
|
-
|
282
|
+
ARGV = [ 'status' ] # show status of all servers
|
283
|
+
DevLXC::CLI::DevLXC.start
|
237
284
|
|
238
|
-
|
239
|
-
|
285
|
+
ARGV = [ 'run_command', 'uptime' ] # run `uptime` in all servers
|
286
|
+
DevLXC::CLI::DevLXC.start
|
240
287
|
|
241
|
-
|
242
|
-
|
288
|
+
ARGV = [ 'destroy' ] # destroy all servers
|
289
|
+
DevLXC::CLI::DevLXC.start
|
290
|
+
```
|
243
291
|
|
244
292
|
dev-lxc itself can also be used as a library
|
245
293
|
|
246
|
-
|
247
|
-
|
294
|
+
```
|
295
|
+
require 'yaml'
|
296
|
+
require 'dev-lxc'
|
248
297
|
|
249
|
-
|
250
|
-
|
298
|
+
config = YAML.load(IO.read('dev-lxc.yml'))
|
299
|
+
server = DevLXC::Server.new("chef-fe1.lxc", 'chef-server', config)
|
251
300
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
301
|
+
server.start # start chef-fe1.lxc
|
302
|
+
server.status # show status of chef-fe1.lxc
|
303
|
+
server.run_command("chef-server-ctl reconfigure") # run command in chef-fe1.lxc
|
304
|
+
server.stop # stop chef-fe1.lxc
|
305
|
+
```
|
256
306
|
|
257
307
|
## Cluster Config Files
|
258
308
|
|
@@ -260,36 +310,70 @@ dev-lxc uses a YAML configuration file named `dev-lxc.yml` to define a cluster.
|
|
260
310
|
|
261
311
|
The following command generates sample config files for various cluster topologies.
|
262
312
|
|
263
|
-
|
313
|
+
```
|
314
|
+
dev-lxc init
|
315
|
+
```
|
264
316
|
|
265
317
|
`dev-lxc init tier > dev-lxc.yml` creates a `dev-lxc.yml` file with the following content:
|
266
318
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
319
|
+
```
|
320
|
+
## Mount source directories must exist in the LXC host
|
321
|
+
|
322
|
+
## Make sure package paths are correct
|
323
|
+
|
324
|
+
## All FQDNs and server names must end with the `.lxc` domain
|
325
|
+
|
326
|
+
## DHCP reserved (static) IPs must be selected from the IP range 10.0.3.150 - 254
|
327
|
+
|
328
|
+
chef-server:
|
329
|
+
platform_image: p-ubuntu-1404
|
330
|
+
mounts:
|
331
|
+
- /dev-shared dev-shared
|
332
|
+
packages:
|
333
|
+
server: /dev-shared/chef-packages/cs/chef-server-core_12.0.6-1_amd64.deb
|
334
|
+
manage: /dev-shared/chef-packages/manage/opscode-manage_1.11.2-1_amd64.deb
|
335
|
+
# reporting: /dev-shared/chef-packages/reporting/opscode-reporting_1.2.3-1_amd64.deb
|
336
|
+
# push-jobs-server: /dev-shared/chef-packages/push-jobs-server/opscode-push-jobs-server_1.1.6-1_amd64.deb
|
337
|
+
|
338
|
+
## The chef-sync package would only be installed.
|
339
|
+
## It would NOT be configured since we don't know whether it should be a master or replica.
|
340
|
+
# sync: /dev-shared/chef-packages/sync/chef-sync_1.0.0~rc.6-1_amd64.deb
|
341
|
+
|
342
|
+
api_fqdn: chef.lxc
|
343
|
+
topology: tier
|
344
|
+
servers:
|
345
|
+
chef-be.lxc:
|
346
|
+
role: backend
|
347
|
+
ipaddress: 10.0.3.203
|
348
|
+
bootstrap: true
|
349
|
+
chef-fe1.lxc:
|
350
|
+
role: frontend
|
351
|
+
ipaddress: 10.0.3.204
|
352
|
+
# chef-fe2.lxc:
|
353
|
+
# role: frontend
|
354
|
+
# ipaddress: 10.0.3.205
|
355
|
+
|
356
|
+
analytics:
|
357
|
+
platform_image: p-ubuntu-1404
|
358
|
+
mounts:
|
359
|
+
- /dev-shared dev-shared
|
360
|
+
packages:
|
361
|
+
analytics: /dev-shared/chef-packages/analytics/opscode-analytics_1.1.2-1_amd64.deb
|
362
|
+
|
363
|
+
analytics_fqdn: analytics.lxc
|
364
|
+
topology: tier
|
365
|
+
servers:
|
366
|
+
analytics-be.lxc:
|
367
|
+
role: backend
|
368
|
+
ipaddress: 10.0.3.206
|
369
|
+
bootstrap: true
|
370
|
+
analytics-fe1.lxc:
|
371
|
+
role: frontend
|
372
|
+
ipaddress: 10.0.3.207
|
373
|
+
# analytics-fe2.lxc:
|
374
|
+
# role: frontend
|
375
|
+
# ipaddress: 10.0.3.208
|
376
|
+
```
|
293
377
|
|
294
378
|
This config defines a tier cluster consisting of a single backend and a single frontend.
|
295
379
|
|
@@ -298,7 +382,7 @@ frontend then both frontends will be created and dnsmasq will resolve the `api_f
|
|
298
382
|
[chef.lxc](chef.lxc) to both frontends using a round-robin policy.
|
299
383
|
|
300
384
|
The config file is very customizable. You can add or remove mounts, packages or servers,
|
301
|
-
change ip addresses, change server names, change the
|
385
|
+
change ip addresses, change server names, change the platform_image and more.
|
302
386
|
|
303
387
|
The `mounts` list describes what directories get mounted from the Vagrant VM platform into
|
304
388
|
each container. You need to make sure that you configure the mount entries to be
|
@@ -325,33 +409,37 @@ You can also specify a particular config file as an option for most dev-lxc comm
|
|
325
409
|
The following is an example of managing multiple clusters while still avoiding specifying
|
326
410
|
each cluster's config file.
|
327
411
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
412
|
+
```
|
413
|
+
mkdir -p ~/clusters/{clusterA,clusterB}
|
414
|
+
dev-lxc init tier > ~/clusters/clusterA/dev-lxc.yml
|
415
|
+
dev-lxc init standalone > ~/clusters/clusterB/dev-lxc.yml
|
416
|
+
cd ~/clusters/clusterA && dev-lxc up # starts clusterA
|
417
|
+
cd ~/clusters/clusterB && dev-lxc up # starts clusterB
|
418
|
+
```
|
333
419
|
|
334
420
|
### Maintain Uniqueness Across Multiple Clusters
|
335
421
|
|
336
422
|
The default cluster configs are already designed to be unique from each other but as you build
|
337
423
|
more clusters you have to maintain uniqueness across the YAML config files for the following items.
|
338
424
|
|
339
|
-
* Server names and `
|
425
|
+
* Server names, `api_fqdn` and `analytics_fqdn`
|
340
426
|
|
341
427
|
Server names should really be unique across all clusters.
|
342
428
|
|
343
429
|
Even when cluster A is shutdown, if cluster B uses the same server names when it is created it
|
344
430
|
will use the already existing servers from cluster A.
|
345
431
|
|
346
|
-
`api_fqdn` uniqueness only matters when clusters with the same `api_fqdn`
|
432
|
+
`api_fqdn` and `analytics_fqdn` uniqueness only matters when clusters with the same `api_fqdn`
|
433
|
+
and `analytics_fqdn` are running.
|
347
434
|
|
348
|
-
If cluster B is started with the same `api_fqdn` as an already running cluster A,
|
349
|
-
will overwrite cluster A's DNS resolution of `api_fqdn`.
|
435
|
+
If cluster B is started with the same `api_fqdn` or `analytics_fqdn` as an already running cluster A,
|
436
|
+
then cluster B will overwrite cluster A's DNS resolution of `api_fqdn` or `analytics_fqdn`.
|
350
437
|
|
351
|
-
It is easy to provide uniqueness
|
352
|
-
|
438
|
+
It is easy to provide uniqueness in the server names, `api_fqdn` and `analytics_fqdn`.
|
439
|
+
For example, you can use the following command to prefix the servers names with `1234-` when
|
440
|
+
generating a cluster's config.
|
353
441
|
|
354
|
-
|
442
|
+
dev-lxc init tier 1234- > dev-lxc.yml
|
355
443
|
|
356
444
|
* IP Addresses
|
357
445
|
|
@@ -366,99 +454,118 @@ more clusters you have to maintain uniqueness across the YAML config files for t
|
|
366
454
|
|
367
455
|
Use unique IP's from that range when configuring clusters.
|
368
456
|
|
369
|
-
##
|
457
|
+
## Images
|
370
458
|
|
371
|
-
One of the key things this tool uses is the concept of
|
459
|
+
One of the key things this tool uses is the concept of images.
|
372
460
|
|
373
|
-
`dev-lxc` creates
|
374
|
-
a "platform", "shared" or "
|
461
|
+
`dev-lxc` creates images with a "p-", "s-", "u-" or "c-" prefix on the name to distinguish
|
462
|
+
it as a "platform", "shared", "unique" or "custom" image.
|
375
463
|
|
376
|
-
|
377
|
-
|
378
|
-
|
464
|
+
Images are then cloned using the btrfs filesystem to very quickly provide a lightweight duplicate
|
465
|
+
of the image. This clone is either used to build the next image in the build process or the final
|
466
|
+
container that will actually be run.
|
379
467
|
|
380
|
-
|
468
|
+
There are four image categories.
|
381
469
|
|
382
470
|
1. Platform
|
383
471
|
|
384
|
-
The platform
|
385
|
-
"p-" prefix on the
|
472
|
+
The platform image is the first to get created and is identified by the
|
473
|
+
"p-" prefix on the image name.
|
386
474
|
|
387
|
-
`DevLXC#
|
475
|
+
`DevLXC#create_platform_image` controls the creation of a platform image.
|
388
476
|
|
389
|
-
This
|
477
|
+
This image provides the chosen OS platform and version (e.g. p-ubuntu-1404).
|
390
478
|
A typical LXC container has minimal packages installed so `dev-lxc` makes sure that the
|
391
479
|
same packages used in Chef's [bento boxes](https://github.com/opscode/bento) are
|
392
480
|
installed to provide a more typical server environment.
|
393
481
|
A few additional packages are also installed.
|
394
482
|
|
395
|
-
*Once this platform
|
483
|
+
*Once this platform image is created there is rarely a need to delete it.*
|
396
484
|
|
397
485
|
2. Shared
|
398
486
|
|
399
|
-
The shared
|
400
|
-
"s-" prefix on the
|
487
|
+
The shared image is the second to get created and is identified by the
|
488
|
+
"s-" prefix on the image name.
|
401
489
|
|
402
|
-
`DevLXC::
|
490
|
+
`DevLXC::Server#create_shared_image` controls the creation of a shared image.
|
403
491
|
|
404
492
|
Chef packages that are common to all servers in a Chef cluster, such as chef-server-core,
|
405
|
-
opscode-reporting
|
493
|
+
opscode-reporting, opscode-push-jobs-server and chef-sync are installed using `dpkg` or `rpm`.
|
406
494
|
|
407
495
|
Note the manage package will not be installed at this point since it is not common to all
|
408
496
|
servers (i.e. it does not get installed on backend servers).
|
409
497
|
|
410
|
-
The name of this
|
411
|
-
get installed which makes this
|
498
|
+
The name of this image is built from the names and versions of the Chef packages that
|
499
|
+
get installed which makes this image easy to be reused by another cluster that is
|
412
500
|
configured to use the same Chef packages.
|
413
501
|
|
414
|
-
*Since no configuration actually happens yet there is rarely a need to delete this
|
502
|
+
*Since no configuration actually happens yet there is rarely a need to delete this image.*
|
415
503
|
|
416
504
|
3. Unique
|
417
505
|
|
418
|
-
The unique
|
419
|
-
"u-" prefix on the
|
506
|
+
The unique image is the last to get created and is identified by the
|
507
|
+
"u-" prefix on the image name.
|
420
508
|
|
421
|
-
`DevLXC::
|
509
|
+
`DevLXC::Server#create` controls the creation of a unique image.
|
422
510
|
|
423
511
|
Each unique Chef server (e.g. standalone, backend or frontend) is created.
|
424
512
|
|
425
513
|
* The specified hostname is assigned.
|
426
|
-
* dnsmasq is configured to reserve the specified IP address for the
|
514
|
+
* dnsmasq is configured to reserve the specified IP address for the image's MAC address.
|
427
515
|
* A DNS entry is created in dnsmasq if appropriate.
|
428
516
|
* All installed Chef packages are configured.
|
429
517
|
* Test users and orgs are created.
|
430
518
|
* The opscode-manage package is installed and configured if specified.
|
431
519
|
|
432
|
-
After each server is fully configured a
|
433
|
-
unique
|
520
|
+
After each server is fully configured a clone of it is made resulting in the server's
|
521
|
+
unique image. These unique images make it very easy to quickly recreate
|
434
522
|
a Chef cluster from a clean starting point.
|
435
523
|
|
436
|
-
|
524
|
+
4. Custom
|
525
|
+
|
526
|
+
The custom image is only created when the `snapshot` command is used and is identified
|
527
|
+
by the "c-" prefix on the image name.
|
528
|
+
|
529
|
+
`DevLXC::Server#snapshot` controls the creation of a custom image.
|
530
|
+
|
531
|
+
Custom images can be used to save the changes that have been made in servers.
|
532
|
+
Later, when the servers are destroyed and recreated, they will start running with the changes
|
533
|
+
that were captured at the time of the snapshot.
|
534
|
+
|
535
|
+
### Destroying Images
|
437
536
|
|
438
537
|
When using `dev-lxc destroy` to destroy servers you have the option to also destroy any or all of
|
439
|
-
the
|
538
|
+
the four types of images associated with the servers.
|
440
539
|
|
441
540
|
The following command will list the options available.
|
442
541
|
|
443
|
-
|
542
|
+
```
|
543
|
+
dev-lxc help destroy
|
544
|
+
```
|
444
545
|
|
445
546
|
Of course, you can also just use the standard LXC commands to destroy any container.
|
446
547
|
|
447
|
-
|
548
|
+
```
|
549
|
+
lxc-destroy -n [NAME]
|
550
|
+
```
|
448
551
|
|
449
|
-
### Manually Create a Platform
|
552
|
+
### Manually Create a Platform Image
|
450
553
|
|
451
|
-
Platform
|
554
|
+
Platform images can be used for purposes other than building clusters. For example, they can
|
452
555
|
be used as Chef nodes for testing purposes.
|
453
556
|
|
454
|
-
You can see a menu of platform
|
557
|
+
You can see a menu of platform images this tool can create by using the following command.
|
455
558
|
|
456
|
-
|
559
|
+
```
|
560
|
+
dev-lxc create
|
561
|
+
```
|
457
562
|
|
458
|
-
The initial creation of platform
|
459
|
-
an Ubuntu
|
563
|
+
The initial creation of platform images can take awhile so let's go ahead and start creating
|
564
|
+
an Ubuntu 14.04 image now.
|
460
565
|
|
461
|
-
|
566
|
+
```
|
567
|
+
dev-lxc create p-ubuntu-1404
|
568
|
+
```
|
462
569
|
|
463
570
|
## Contributing
|
464
571
|
|
data/dev-lxc.gemspec
CHANGED
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake", "~> 0"
|
23
23
|
spec.add_runtime_dependency "thor", "~> 0"
|
24
|
-
spec.add_runtime_dependency "ruby-lxc", "~> 1.0
|
24
|
+
spec.add_runtime_dependency "ruby-lxc", "~> 1.2.0"
|
25
25
|
end
|
@@ -1,10 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
## Mount source directories must exist in the LXC host
|
2
|
+
|
3
|
+
## Make sure package paths are correct
|
4
|
+
|
5
|
+
## All FQDNs and server names must end with the `.lxc` domain
|
6
|
+
|
7
|
+
## DHCP reserved (static) IPs must be selected from the IP range 10.0.3.150 - 254
|
8
|
+
|
9
|
+
chef-server:
|
10
|
+
platform_image: p-ubuntu-1204
|
11
|
+
mounts:
|
12
|
+
- /dev-shared dev-shared
|
13
|
+
packages:
|
14
|
+
server: /dev-shared/chef-packages/osc/chef-server_11.1.6-1_amd64.deb
|
15
|
+
|
16
|
+
api_fqdn: chef.lxc
|
17
|
+
topology: open-source
|
18
|
+
servers:
|
19
|
+
osc-chef.lxc:
|
20
|
+
ipaddress: 10.0.3.199
|