Cookbook testing with Vagrant/LXC


#1

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have been using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of our CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good answer
but seems like it might be a bit harder to use. It also seems like the bento
project doesn’t support building LXC boxes and doing them manually doesn’t seem
terribly easy. Any resources or suggestions would be great.


#2

Not to detract from a good discussion on Vagrant & LXC, but FWIW…
vagrant/virtualbox can work inside a VM. I’ve been using test-kitchen +
virtualbox on a vmware esxi5 VM running ubuntu 12.04. I had to enable
Hardware Virtualization along with Hardware CPU and MMU on the VM. And
then feed it a buttload of resources/tune it for performance. But it works
almost as quickly on that VM as it does on my workstation.

So there’s that.

On Mon, Sep 23, 2013 at 8:49 PM, bjbq4d@gmail.com wrote:

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have been
using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of our CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good
answer
but seems like it might be a bit harder to use. It also seems like the
bento
project doesn’t support building LXC boxes and doing them manually doesn’t
seem
terribly easy. Any resources or suggestions would be great.


George Miranda
Consultant, Evangelist, Trainer, : | Opscode Inc.
gmiranda@opscode.com | (512) 481-2876
Twitter, IRC, GitHub, Most IMs: gmiranda23


#3

I had tried once to get it to work and was able to get it to work with
32bit OS but not 64bit which is what we were wanting to test. I can’t quite
remember the reasoning but it didn’t seem like it was something we could
easily fix.

On Mon, Sep 23, 2013 at 11:14 PM, George Miranda gmiranda@opscode.comwrote:

Not to detract from a good discussion on Vagrant & LXC, but FWIW…
vagrant/virtualbox can work inside a VM. I’ve been using test-kitchen +
virtualbox on a vmware esxi5 VM running ubuntu 12.04. I had to enable
Hardware Virtualization along with Hardware CPU and MMU on the VM. And
then feed it a buttload of resources/tune it for performance. But it works
almost as quickly on that VM as it does on my workstation.

So there’s that.

On Mon, Sep 23, 2013 at 8:49 PM, bjbq4d@gmail.com wrote:

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have been
using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of our
CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good
answer
but seems like it might be a bit harder to use. It also seems like the
bento
project doesn’t support building LXC boxes and doing them manually
doesn’t seem
terribly easy. Any resources or suggestions would be great.


George Miranda
Consultant, Evangelist, Trainer, : | Opscode Inc.
gmiranda@opscode.com | (512) 481-2876
Twitter, IRC, GitHub, Most IMs: gmiranda23


-Bryan


#4

I just happened to be on this box and working on it now…

Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.5.0-39-generic x86_64)
$ uname -a
Linux rt-bb8-rti-cheftest5 3.5.0-39-generic #60~precise1-Ubuntu SMP Wed Aug
14 15:38:41 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

But I don’t want to derail the conversation. If you’re interested in going
the vm in a vm route, ping me off list and we can talk it through.

-g

On Mon, Sep 23, 2013 at 9:30 PM, Bryan Baugher bjbq4d@gmail.com wrote:

I had tried once to get it to work and was able to get it to work with
32bit OS but not 64bit which is what we were wanting to test. I can’t quite
remember the reasoning but it didn’t seem like it was something we could
easily fix.

On Mon, Sep 23, 2013 at 11:14 PM, George Miranda gmiranda@opscode.comwrote:

Not to detract from a good discussion on Vagrant & LXC, but FWIW…
vagrant/virtualbox can work inside a VM. I’ve been using test-kitchen +
virtualbox on a vmware esxi5 VM running ubuntu 12.04. I had to enable
Hardware Virtualization along with Hardware CPU and MMU on the VM. And
then feed it a buttload of resources/tune it for performance. But it works
almost as quickly on that VM as it does on my workstation.

So there’s that.

On Mon, Sep 23, 2013 at 8:49 PM, bjbq4d@gmail.com wrote:

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have
been using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of our
CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good
answer
but seems like it might be a bit harder to use. It also seems like the
bento
project doesn’t support building LXC boxes and doing them manually
doesn’t seem
terribly easy. Any resources or suggestions would be great.


George Miranda
Consultant, Evangelist, Trainer, : | Opscode Inc.
gmiranda@opscode.com | (512) 481-2876
Twitter, IRC, GitHub, Most IMs: gmiranda23


-Bryan


George Miranda
Consultant, Evangelist, Trainer, : | Opscode Inc.
gmiranda@opscode.com | (512) 481-2876
Twitter, IRC, GitHub, Most IMs: gmiranda23


#5

test kitchen already has lxc drivers. I know bryan and joe was using it
during chef conf. I use raw lxc-ruby for running integration testing using
my own libraries (which provides few chef helpers), i was also able to run
the same code on EC2 instances (we too run our CI in aws).

On Mon, Sep 23, 2013 at 9:35 PM, George Miranda gmiranda@opscode.comwrote:

I just happened to be on this box and working on it now…

Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.5.0-39-generic x86_64)
$ uname -a
Linux rt-bb8-rti-cheftest5 3.5.0-39-generic #60~precise1-Ubuntu SMP Wed
Aug 14 15:38:41 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

But I don’t want to derail the conversation. If you’re interested in
going the vm in a vm route, ping me off list and we can talk it through.

-g

On Mon, Sep 23, 2013 at 9:30 PM, Bryan Baugher bjbq4d@gmail.com wrote:

I had tried once to get it to work and was able to get it to work with
32bit OS but not 64bit which is what we were wanting to test. I can’t quite
remember the reasoning but it didn’t seem like it was something we could
easily fix.

On Mon, Sep 23, 2013 at 11:14 PM, George Miranda gmiranda@opscode.comwrote:

Not to detract from a good discussion on Vagrant & LXC, but FWIW…
vagrant/virtualbox can work inside a VM. I’ve been using test-kitchen +
virtualbox on a vmware esxi5 VM running ubuntu 12.04. I had to enable
Hardware Virtualization along with Hardware CPU and MMU on the VM. And
then feed it a buttload of resources/tune it for performance. But it works
almost as quickly on that VM as it does on my workstation.

So there’s that.

On Mon, Sep 23, 2013 at 8:49 PM, bjbq4d@gmail.com wrote:

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have
been using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of
our CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good
answer
but seems like it might be a bit harder to use. It also seems like the
bento
project doesn’t support building LXC boxes and doing them manually
doesn’t seem
terribly easy. Any resources or suggestions would be great.


George Miranda
Consultant, Evangelist, Trainer, : | Opscode Inc.
gmiranda@opscode.com | (512) 481-2876
Twitter, IRC, GitHub, Most IMs: gmiranda23


-Bryan


George Miranda
Consultant, Evangelist, Trainer, : | Opscode Inc.
gmiranda@opscode.com | (512) 481-2876
Twitter, IRC, GitHub, Most IMs: gmiranda23


#6

I’ve been using kitchen-lxc for Cook testing for quite some time using Ubuntu 12.04 as the “host”. I used base templates to build Ubuntu templates. I used this template for CentOS iirc. https://gist.github.com/hagix9/3514296

There is a lxc cookbook from heavy water ops that will build containers for u as well here:

There is also a kitchen-docker driver I haven’t tried but might be a bit easier to get up and running with docker if u haven’t played with lxc yet.

For muti-vm testing I’ve been using vagabond which is also Lxc backed and uses the lxc cookbook to magic up containers. I haven’t used vagrant-lxc, but imagine u will have to spin containers for it as well.

Tl;dr. Go read up on using lxc tools to make containers. There are templates to make it easy. The hw lxc cookbook makes it easier. My best successes have been using Ubuntu 12.04.

On Sep 23, 2013, at 8:49 PM, bjbq4d@gmail.com wrote:

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have been using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of our CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good answer
but seems like it might be a bit harder to use. It also seems like the bento
project doesn’t support building LXC boxes and doing them manually doesn’t seem
terribly easy. Any resources or suggestions would be great.


#7

We’ve been using kitchen-docker and test kitchen on our local and CI
systems for cookbook testing. So far it’s been working well for our use
case.

On Tue, Sep 24, 2013 at 3:32 AM, Jesse Nelson spheromak@gmail.com wrote:

I’ve been using kitchen-lxc for Cook testing for quite some time using
Ubuntu 12.04 as the “host”. I used base templates to build Ubuntu
templates. I used this template for CentOS iirc.
https://gist.github.com/hagix9/3514296

There is a lxc cookbook from heavy water ops that will build containers
for u as well here:
https://github.com/hw-cookbooks/lxc

There is also a kitchen-docker driver I haven’t tried but might be a bit
easier to get up and running with docker if u haven’t played with lxc yet.

For muti-vm testing I’ve been using vagabond which is also Lxc backed and
uses the lxc cookbook to magic up containers. I haven’t used vagrant-lxc,
but imagine u will have to spin containers for it as well.

Tl;dr. Go read up on using lxc tools to make containers. There are
templates to make it easy. The hw lxc cookbook makes it easier. My best
successes have been using Ubuntu 12.04.

On Sep 23, 2013, at 8:49 PM, bjbq4d@gmail.com wrote:

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have been
using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of our CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good
answer
but seems like it might be a bit harder to use. It also seems like the
bento
project doesn’t support building LXC boxes and doing them manually doesn’t
seem
terribly easy. Any resources or suggestions would be great.


#8

I’ve been using Vagrant + LXC vía LXC provider[1] for months and it’s
really great and waaay faster than with Virtualbox. It has improven a lot
my workflow and feedback loop.

Right now, there are boxes just for 64bits[2], but its really easy to built
your own box with the scripts providers by the project:

BTW, I’m currently using Vagrant + vagrant-lxc on Ubuntu 12.04 on two
laptops, one with 32bits and other with 64bits.

[1] https://github.com/fgrehm/vagrant-lxc
[2] https://github.com/fgrehm/vagrant-lxc/wiki/Base-boxes#available-boxes

On Tue, Sep 24, 2013 at 2:48 PM, Pete Cheslock petecheslock@gmail.comwrote:

We’ve been using kitchen-docker and test kitchen on our local and CI
systems for cookbook testing. So far it’s been working well for our use
case.

https://github.com/portertech/kitchen-docker/

On Tue, Sep 24, 2013 at 3:32 AM, Jesse Nelson spheromak@gmail.com wrote:

I’ve been using kitchen-lxc for Cook testing for quite some time using
Ubuntu 12.04 as the “host”. I used base templates to build Ubuntu
templates. I used this template for CentOS iirc.
https://gist.github.com/hagix9/3514296

There is a lxc cookbook from heavy water ops that will build containers
for u as well here:
https://github.com/hw-cookbooks/lxc

There is also a kitchen-docker driver I haven’t tried but might be a bit
easier to get up and running with docker if u haven’t played with lxc yet.

For muti-vm testing I’ve been using vagabond which is also Lxc backed and
uses the lxc cookbook to magic up containers. I haven’t used vagrant-lxc,
but imagine u will have to spin containers for it as well.

Tl;dr. Go read up on using lxc tools to make containers. There are
templates to make it easy. The hw lxc cookbook makes it easier. My best
successes have been using Ubuntu 12.04.

On Sep 23, 2013, at 8:49 PM, bjbq4d@gmail.com wrote:

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have been
using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of our
CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good
answer
but seems like it might be a bit harder to use. It also seems like the
bento
project doesn’t support building LXC boxes and doing them manually
doesn’t seem
terribly easy. Any resources or suggestions would be great.


Juanje


#9

I can only second that. Having tried vagrant-lxc over the weekend it took
only 30 seconds to bring up a simple apache VM using lxc vs. 2 minutes to
bring up the same VM with virtualbox.

@juanje: btw do you have an example for network configuration
(private/hostonly) with the vagrant-lxc provider? That’s one thing I
haven’t gotten around yet…

P.S.: for even faster feedback loops you could also check out
vagrant-cachier:


On Oct 1, 2013 12:53 AM, “Juanje Ojeda Croissier” juanje.ojeda@gmail.com
wrote:

I’ve been using Vagrant + LXC vía LXC provider[1] for months and it’s
really great and waaay faster than with Virtualbox. It has improven a lot
my workflow and feedback loop.

Right now, there are boxes just for 64bits[2], but its really easy to
built your own box with the scripts providers by the project:
https://github.com/fgrehm/vagrant-lxc/blob/master/BOXES.md

BTW, I’m currently using Vagrant + vagrant-lxc on Ubuntu 12.04 on two
laptops, one with 32bits and other with 64bits.

[1] https://github.com/fgrehm/vagrant-lxc
[2] https://github.com/fgrehm/vagrant-lxc/wiki/Base-boxes#available-boxes

On Tue, Sep 24, 2013 at 2:48 PM, Pete Cheslock petecheslock@gmail.comwrote:

We’ve been using kitchen-docker and test kitchen on our local and CI
systems for cookbook testing. So far it’s been working well for our use
case.

https://github.com/portertech/kitchen-docker/

On Tue, Sep 24, 2013 at 3:32 AM, Jesse Nelson spheromak@gmail.comwrote:

I’ve been using kitchen-lxc for Cook testing for quite some time using
Ubuntu 12.04 as the “host”. I used base templates to build Ubuntu
templates. I used this template for CentOS iirc.
https://gist.github.com/hagix9/3514296

There is a lxc cookbook from heavy water ops that will build containers
for u as well here:
https://github.com/hw-cookbooks/lxc

There is also a kitchen-docker driver I haven’t tried but might be a bit
easier to get up and running with docker if u haven’t played with lxc yet.

For muti-vm testing I’ve been using vagabond which is also Lxc backed
and uses the lxc cookbook to magic up containers. I haven’t used
vagrant-lxc, but imagine u will have to spin containers for it as well.

Tl;dr. Go read up on using lxc tools to make containers. There are
templates to make it easy. The hw lxc cookbook makes it easier. My best
successes have been using Ubuntu 12.04.

On Sep 23, 2013, at 8:49 PM, bjbq4d@gmail.com wrote:

Hi everyone,

Has anyone tried to do cookbook testing with Vagrant and LXC? I have
been using
Vagrant/VirtualBox for awhile now for my cookbook testing but all of our
CI
boxes are VMs which means VirtualBox won’t work. LXC seems like a good
answer
but seems like it might be a bit harder to use. It also seems like the
bento
project doesn’t support building LXC boxes and doing them manually
doesn’t seem
terribly easy. Any resources or suggestions would be great.


Juanje

http://about.me/juanje