omnia-md / virtual-machines

Virtual machines provisioning for building releases and conda packages
0 stars 3 forks source link

Speeding up provisioning #4

Open jchodera opened 9 years ago

jchodera commented 9 years ago

It takes a long time to provision these VMs over the network, so I am thinking we either need to either (1) locally share already-provisioned Vagrant boxes, or (2) set up a local mirror for yum to use.

rmcgibbo commented 9 years ago

You can export the provisioned VM as a new .box file.

jchodera commented 9 years ago

You can export the provisioned VM as a new .box file.

Awesome! Is this

vagrant package --base my-virtual-machine

?

rmcgibbo commented 9 years ago

Just vagrant package should work fine, assuming your current directory contains the vagrantfile.

jchodera commented 9 years ago

I've packaged a vanilla provisioned vagrant box. Any idea of the simplest way to use this to create new vagrant VMs?

rmcgibbo commented 9 years ago

just declare it as the base in your vagrantfile.

jchodera commented 9 years ago

Hm, I imagine we don't want to add or replace the stuff in the virtual machines github repo, but instead want to use local Jenkins scripts to do this.

Maybe I can script something like this:

vagrant box add $HOME/vagrant/provisioned.box --name linux
vagrant init linux
vagrant up

and this could do the trick.

kyleabeauchamp commented 9 years ago

What do we need to resolve Is this issue?

We now use vagrant halt to resume the VM for most operations, re-provisioning quite rarely. I think the only outstanding component is to occasionally run vagrant package to "freeze" working versions of the VM for quick re-provisioning if necessary? So we might just need an template vagrantfile for using the frozen output?

rmcgibbo commented 9 years ago

I'm not 100% sure about this, but I think you want to export the box, after provisioning, as a fixed image. Then for each run, you should create a fresh VM from that image. This is safer than halting and restarting the same VM, because you know you're always starting from a known good image.

jchodera commented 9 years ago

I'm not 100% sure about this, but I think you want to export the box, after provisioning, as a fixed image.

This is exactly what we want to do. I think we want to have the test-omnia-virtual-machines project check out the virtual-machines repo, attempt to provision the vagrant box, and if everything succeeds, roll a new vagrant box from that image and upload it somewhere, replacing our current "working image" somewhere.