README.md in testlab-0.6.11 vs README.md in testlab-0.6.12

- old
+ new

@@ -6,17 +6,19 @@ # TestLab A toolkit for building virtual computer labs. -What is TestLab? TestLab lets you iterate virtual infrastructure quickly. Using a `Labfile` you can define how you want your virtual infrastructure laid out. You can define multiple network segments and containers (i.e. boxen). TestLab will then setup and teardown this virtual infrastructure as you have dictated in the `Labfile`. +What is TestLab? TestLab lets you iterate virtual infrastructure quickly. Using a `Labfile` you can define how you want your virtual infrastructure laid out. You can define multiple network segments and containers (i.e. boxen). TestLab will then setup and tear down this virtual infrastructure as you have dictated in the `Labfile`. -TestLab can be run directly on the command-line or can be interfaced with directly via code. Unlike the trend with some popular open-source software recently, I want you to build off this API interface and hopefully create tools I would of never dreamed up. +TestLab can also import and export containers, making it easy to share them. TestLab supports the latest LXC versions, allowing for ephemeral cloning operations, furthering your ability to iterate quickly. TestLab can be used for many other applications, including infrastructure unit and integration testing, allowing for vastly more complex configurations and more effective resource sharing than traditional VM solutions. +TestLab can be run via the command-line or can be interfaced with directly via Ruby code. + # Using TestLab Interactively -The TestLab command-line program `tl` follows in the style of git (using the GLI RubyGem). +The TestLab command-line program `tl` follows in the style of git: $ tl help NAME tl - TestLab - A toolkit for building virtual computer labs @@ -48,31 +50,46 @@ You stand up your lab with the following command: tl build -You can down the entire lab: +You can down the entire lab (this would only down the containers on the Local provider for example): tl down You can also destroy it (only works for VM backed providers; this would be a NO-OP on the Local provider for example): tl destroy +## Getting Help + +TestLab uses the GLI RubyGem, which gives us a command line pattern similar to that of Git. Therefore help is easy to get: + + tl help + tl help node + tl help container + tl help network + ## Interacting with Containers -Most commands dealing will containers will take this argument: +Almost all commands dealing will containers will take this argument: COMMAND OPTIONS -n, --name=container - Container ID or Name (default: none) You can interact with containers via SSH: - tl container ssh -n <container ID> + tl container ssh -n <name> -You can pass an optional alternate username and/or identity to use. By default TestLab will attempt to SSH as the user defined in the `Labfile` for that container, otherwise the default user for the containers distro is used. +For example: + tl container ssh -n server-www-1 + +Would connect to the container defined as 'server-www-1' in our Labfile. + +You can pass an optional username and/or identity to use. By default TestLab will attempt to SSH as the user defined in the `Labfile` for that container, otherwise the default user for the containers distro is used. + $ tl help container ssh NAME ssh - Open an SSH console to a container SYNOPSIS @@ -93,11 +110,11 @@ tl container recycle -n server-www-1 ## Ephemeral Container Cloning -As it stands attempting to iterate infrastructure while developing with Vagrant is a slow and painful process. Enter LXC and it's ephemeral feature. The idea here is you have a container that is provisioned to a "pristine" state acording to the `Labfile`. You then clone this container and run actions against the container. After running your actions against the container you want to maybe tweak your Chef cookbook and re-run it against the container. As we all know running an ever changing cookbook in development against the same system over and over again causes drift and problems. With the cloning you can instantly reinstate the container as it was when you first cloned it. +As it stands attempting to iterate infrastructure with Vagrant is a slow and painful process. Enter LXC and ephemeral cloning. The idea here is that you have a container that is provisioned to a "pristine" state according to the `Labfile`. You then clone this container and run actions against the container. After running your actions against the container you want to maybe tweak your Chef cookbook, for example, and re-run it against the container. Running an ever changing cookbook in development against the same system over and over again causes drift and problems. With the cloning you can instantly reinstate the container as it was when you first cloned it. Here we are cloning the container for the first time. It takes a bit longer than normal because TestLab is actually shutting down the container so it can be retained as the "pristine" copy of it, and starting up a ephemeral container in its place. Subsequent calls to clone are very fast. $ tl container clone -n server-www-1 [TL] TestLab v0.6.1 Loaded @@ -110,10 +127,12 @@ [TL] container server-www-1 clone # Completed in 1.0794 seconds! $ tl container clone -n server-www-1 [TL] TestLab v0.6.1 Loaded [TL] container server-www-1 clone # Completed in 1.0281 seconds! +The idea in the above example is that you run the initial clone command to put your container into an ephemeral clone state. You would then modify the container in some fashion, test, etc. When you where done with that iteration you would run the clone command again, losing all the changes you did to the container, replacing it with a new clean cloned copy of your original container. RRP (Rinse, Repeat, Profit) + We can also see the containers status reflects that it is a clone currently: $ tl container status -n server-www-1 [TL] TestLab v0.6.1 Loaded +----------------------------------------------+ @@ -126,29 +145,33 @@ | RELEASE: precise | | INTERFACES: labnet:eth0:10.10.0.21/16 | | PROVISIONERS: Resolv/AptCacherNG/Apt/Shell | +----------------------------------------------+ -We can easily revert it back to a full container if we want to make changes to it: +We can easily revert it back to a full container if we want to make "permanent" changes to it: $ tl container up -n server-www-1 We can even recycle it while it is in a cloned state: $ tl container recycle -n server-www-1 +We can run setup against a clone as well (note: running `build`, calls `up`, which would revert us back to a non-cloned container and we would not want this to happen): + + $ tl container setup -n server-www-1 + ## Network Routes -TestLab will add network routes for any networks defined in the `Labfile` with the route flag set to true. This will allow you to directly interact with containers. Here is an example of the routes added with the multi-network `Labfile`. +TestLab will add network routes for any networks defined in the `Labfile` witch have the `TestLab::Provisioner::Route` provisioner class specified for them. This will allow you to directly interact with containers over the network. Here is an example of the routes added with the multi-network `Labfile`. $ tl network route show -n labnet [TL] TestLab v0.6.1 Loaded TestLab routes: 10.10.0.0 192.168.33.239 255.255.0.0 UG 0 0 0 vboxnet0 10.11.0.0 192.168.33.239 255.255.0.0 UG 0 0 0 vboxnet0 -These routes can be manually manipulated as well: +These routes can be manually manipulated as well (regardless of if you have specified the `TestLab::Provisioner::Route` provisioner class for the networks via the `Labfile`): $ tl help network route NAME route - Manage routes @@ -160,30 +183,21 @@ COMMANDS add - Add routes to lab networks del - Delete routes to lab networks show - Show routes to lab networks -## Getting Help - -TestLab uses the GLI RubyGem, which gives us a command line pattern similar to that of Git. Therefore help is easy to get: - - tl help - tl help node - tl help container - tl help network - # Using TestLab Programmatically Accessing TestLab via code is meant to be fairly easy and straightforward. To get an instance of TestLab you only need about four lines of code: log_file = File.join(Dir.pwd, "testlab.log") @logger = ZTK::Logger.new(log_file) @ui = ZTK::UI.new(:logger => @logger) @testlab = TestLab.new(:ui => @ui) -Calling `TestLab.new` without a `:labfile` option will, by default, attempt to read `Labfile` from the current directory. This behaviour can be changed by passing the `:labfile` key with a path to your desired "Labfile" as the value to your `TestLab.new`. +Calling `TestLab.new` without a `:labfile` option will, by default, attempt to read `Labfile` from the current directory. This behavior can be changed by passing the `:labfile` key with a path to your desired "Labfile" as the value to your `TestLab.new`. -There are several easy accessors available to grab the first container and execure the command `uptime` on it via and SSH connection: +There are several easy accessors available to grab the first container and execute the command `uptime` on it via and SSH connection: container = @testlab.containers.first container.ssh.exec(%(uptime)) We can also execute this command via `lxc-attach`: