vagrant-cachier-ng/docs/how-does-it-work.md
2013-12-07 02:42:49 -02:00

2 KiB

How does it work?

On vagrant-cachier's "jargon", cached packages are kept in cache buckets. Those buckets are basically directories that are shared between the host machine and VMs that are kept around between vagrant destroys. Each bucket (or synced folder if you prefer) is meant to cache specific types of packages, like apt's .debs or RubyGems .gems. Please have a look at the "Available Buckets" menu above for more information on each bucket.

Regarding configurations, right now the plugin does not make any assumptions for you and you have to configure things properly from your Vagrantfile. In other words, the plugin is disabled by default.

Cache buckets will always be available from /tmp/vagrant-cachier on your guest and the appropriate folders will get symlinked to the right path after the machine is up but right before it gets provisioned. We could potentially do it on one go and share bucket's folders directly to the right path if we were only using VirtualBox because it shares folders after booting the machine but the LXC provider does that as part of the boot process (synced folders are actually lxc-start parameters) and as of now we are not able to get some information that this plugin requires about the guest machine / container before it is actually up and running.

Under the hood, the plugin will monkey patch Vagrant::Builtin::Provision and will set things up for each configured cache bucket before and after running each defined provisioner. Before halting the machine, it will also revert the changes required to set things up by hooking into calls to Vagrant::Builtin::GracefulHalt so that you can repackage the machine for others to use without requiring users to install the plugin as well.

Please keep in mind that this plugin won't do magic, if you are compiling things during provisioning or manually downloading packages outside of a bucket you won't see that much of improvement.