Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Development

Virgil Dupras edited this page Dec 13, 2017 · 7 revisions

If want to develop from your physical machine, just sing that same old song:

Hint: you need to have bundler installed, if you don't have it, do:

gem install bundler
git clone git:/fgrehm/vagrant-lxc.git
cd vagrant-lxc
bundle install
bundle exec rake # to run unit specs

To run acceptance specs, you'll have to ssh into one of the development boxes and run:

bundle exec rake spec:acceptance

Installing the plugin from source

git clone git:/fgrehm/vagrant-lxc.git
cd vagrant-lxc
bundle install
bundle exec rake build
vagrant plugin install pkg/vagrant-lxc-VERSION.gem

Using vagrant-lxc to develop itself

Yes! The gem has been bootstrapped and since you can boot a container from within another, after cloning the project you can run the commands below from the host machine to get a container ready for development:

# Required in order to allow nested containers to be started
sudo apt-get install apparmor-utils
sudo aa-complain /usr/bin/lxc-start
bundle install
cd development
bundle exec vagrant up quantal --provider=lxc
bundle exec vagrant ssh quantal

That should result in a container ready to rock. Once you've SSH into the guest container, you'll be already on the project's root. Keep in mind that you'll probably need to run sudo aa-complain /usr/bin/lxc-start on the host whenever you want to hack on it, otherwise you won't be able to start nested containers there to try things out.

Using VirtualBox for development

bundle install
cd development
# Pass in --provider=virtualbox in case you have VAGRANT_DEFAULT_PROVIDER set to something else
bundle exec vagrant up quantal
# A reload is needed to ensure the updated kernel gets loaded
bundle exec vagrant reload quantal
bundle exec vagrant ssh quantal

Running acceptance tests

The acceptance test haven't seen some love in a while and they're not trivial to run. For now, to run them, you have to build a box with vagrant-lxc-base-boxes and then copy it to the path it's expecting at https:/fgrehm/vagrant-lxc/blob/master/vagrant-spec.config.rb#L13 . At the time I'm writing this, it's <vagrant-lxc-repo-path>/boxes/output/2014-03-21/vagrant-lxc-acceptance-amd64.box.

Then, run bundle exec rake spec. You will likely see some tests fail because the box or the host lacks features such as puppet or NFS. Adjust your box/host accordingly.

Hopefully, this process will be made easier soon.