Improve buckets docs

This commit is contained in:
Fabio Rehm 2013-12-07 12:36:03 -02:00
parent 3c4a20f44d
commit 16b68e72f1
13 changed files with 83 additions and 50 deletions

View file

@ -3,8 +3,8 @@
During the early days of this plugin, [@fgrehm](https://github.com/fgrehm) wrote During the early days of this plugin, [@fgrehm](https://github.com/fgrehm) wrote
a [blog post](http://fabiorehm.com/blog/2013/05/24/stop-wasting-bandwidth-with-vagrant-cachier#show_me_the_numbers) a [blog post](http://fabiorehm.com/blog/2013/05/24/stop-wasting-bandwidth-with-vagrant-cachier#show_me_the_numbers)
with some benchmarks on the time that was cut down by using the plugin. If you with some benchmarks on the time that was cut down by using the plugin. If you
are interested on the numbers only, the projects tested were one of vagrant-lxc's are interested on the numbers only, the VMs tested were one of vagrant-lxc's
Ubuntu [dev box](https://github.com/fgrehm/vagrant-lxc/wiki/Development#using-virtualbox-for-development), Ubuntu [dev boxes](https://github.com/fgrehm/vagrant-lxc/wiki/Development#using-virtualbox-for-development),
[rails-dev-box](https://github.com/rails/rails-dev-box), his own [rails-base-box](https://github.com/fgrehm/rails-base-box) [rails-dev-box](https://github.com/rails/rails-dev-box), his own [rails-base-box](https://github.com/fgrehm/rails-base-box)
and Discourse's [dev box](https://github.com/discourse/discourse/blob/master/Vagrantfile) and Discourse's [dev box](https://github.com/discourse/discourse/blob/master/Vagrantfile)

View file

@ -1,5 +1,11 @@
# APT-CACHER # APT-CACHER
Used by Debian-like Linux distros, will get configured under guest's `/var/cache/apt-cacher-ng`
and only works with NFS-shared folders since `vboxsf` is enforcing `vagrant`-user and `apt-cacher`
is running under `apt-cacher-ng` user.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-debian-box' config.vm.box = 'some-debian-box'
@ -7,10 +13,9 @@ Vagrant.configure("2") do |config|
end end
``` ```
This is useful, if you are using containers inside your VMs, e.g VirtualBox -> LXC. One use case for this bucket is if you are using containers inside your VMs, e.g
This would allow you to reuse packages without sharing folder inside VirtualBox. Only VirtualBox -> LXC. This would allow you to reuse packages without sharing folder
works with NFS-shared folders (since `vboxsf` is enforcing `vagrant`-user and `apt-cacher` inside VirtualBox:
is running under `apt-cacher-ng` user)
# install apt-cacher on (Host)-VM # install apt-cacher on (Host)-VM
$ sudo apt-get install apt-cacher-ng $ sudo apt-get install apt-cacher-ng
@ -23,7 +28,3 @@ is running under `apt-cacher-ng` user)
# check, if working by tailing log on (Host)-VM, while installing packages on (Guest)-VMs # check, if working by tailing log on (Host)-VM, while installing packages on (Guest)-VMs
$ tail -f /var/log/apt-cacher-ng/apt-cacher.log $ tail -f /var/log/apt-cacher-ng/apt-cacher.log
Used by Debian-like Linux distros, will get configured under guest's `/var/cache/apt-cacher-ng`.

View file

@ -1,5 +1,9 @@
# APT # APT
Used by Debian-like Linux distros, will get configured under guest's `/var/cache/apt/archives`.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-debian-box' config.vm.box = 'some-debian-box'
@ -7,8 +11,7 @@ Vagrant.configure("2") do |config|
end end
``` ```
Used by Debian-like Linux distros, will get configured under guest's `/var/cache/apt/archives`.
_Please note that to avoid re-downloading packages, you should avoid `apt-get clean` _Please note that to avoid re-downloading packages, you should avoid `apt-get clean`
as much as possible in order to make a better use of the cache, even if you are as much as possible in order to make a better use of the cache, even if you are
packaging a box_ packaging a box since the downloaded packages are actually stored on the host
machine._

View file

@ -1,11 +1,13 @@
# Chef # Chef
When a Chef provisioner is detected, this bucket caches the default
`file_cache_path` directory, `/var/chef/cache`. Requires Vagrant 1.2.4+.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-box-using-chef-provisioner' config.vm.box = 'some-box-using-chef-provisioner'
config.cache.enable :chef config.cache.enable :chef
end end
``` ```
When a Chef provisioner is detected, this bucket caches the default
`file_cache_path` directory, `/var/chef/cache`. Requires Vagrant 1.2.4+.

View file

@ -1,11 +1,13 @@
# [Composer](http://getcomposer.org/) # [Composer](http://getcomposer.org/)
Compatible with probably any type of linux guest distro, will cache guests'
`$HOME/.composer` if PHP is detected.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-box-with-php-installed' config.vm.box = 'some-box-with-php-installed'
config.cache.enable :composer config.cache.enable :composer
end end
``` ```
Compatible with probably any type of linux guest distro, will cache guests'
`$HOME/.composer` if PHP is detected.

View file

@ -1,5 +1,11 @@
# [npm](https://npmjs.org/) # [npm](https://npmjs.org/)
Compatible with probably any type of linux guest distro, will hook into npm's
cache directory under the result of running `npm config get cache` as
the default SSH user (usually `vagrant`) on your guest.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-box-with-nodejs-installed' config.vm.box = 'some-box-with-nodejs-installed'
@ -7,10 +13,6 @@ Vagrant.configure("2") do |config|
end end
``` ```
Compatible with probably any type of linux guest distro, will hook into npm's
cache directory under the result of running `npm config get cache` as
the default SSH user (usually `vagrant`) on your guest.
If you use [nvm](https://github.com/creationix/nvm) / [n](https://github.com/visionmedia/n) If you use [nvm](https://github.com/creationix/nvm) / [n](https://github.com/visionmedia/n)
on the guest machine, make sure it is already installed before enabling on the guest machine, make sure it is already installed before enabling
the bucket, otherwise you won't benefit from this plugin. the bucket, otherwise you won't benefit from this plugin.

View file

@ -1,10 +1,12 @@
# Pacman # Pacman
Used by Arch Linux, will get configured under guest's `/var/cache/pacman/pkg`.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-arch-linux-box' config.vm.box = 'some-arch-linux-box'
config.cache.enable :pacman config.cache.enable :pacman
end end
``` ```
Used by Arch Linux, will get configured under guest's `/var/cache/pacman/pkg`.

View file

@ -1,14 +1,16 @@
# RubyGems # RubyGems
Compatible with probably with any type of guest distro, will hook into the `cache`
folder under the result of running `gem env gemdir` as the default SSH user (usualy
`vagrant`) on your guest. If you use rbenv / rvm on the guest machine, make sure
it is already installed before enabling the bucket, otherwise you won't benefit
from this plugin.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-box-with-ruby-installed' config.vm.box = 'some-box-with-ruby-installed'
config.cache.enable :gem config.cache.enable :gem
end end
``` ```
Compatible with probably with any type of guest distro, will hook into the `cache`
folder under the result of running `gem env gemdir` as the default SSH user (usualy
`vagrant`) on your guest. If you use rbenv / rvm on the guest machine, make sure
it is already installed before enabling the bucket, otherwise you won't benefit
from this plugin.

View file

@ -1,14 +1,16 @@
# [rvm](https://rvm.io/) # [rvm](https://rvm.io/)
Compatible with probably with any type of linux guest distro, will hook into the
`cache` folder under the result of running rvm info as the default SSH user (usualy
`vagrant`) on your guest. If you use rvm on the guest machine, make sure it is
already installed before enabling the bucket, otherwise you won't benefit from
this plugin.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-box-with-rvm-installed' config.vm.box = 'some-box-with-rvm-installed'
config.cache.enable :gem config.cache.enable :gem
end end
``` ```
Compatible with probably with any type of linux guest distro, will hook into the
`cache` folder under the result of running rvm info as the default SSH user (usualy
`vagrant`) on your guest. If you use rvm on the guest machine, make sure it is
already installed before enabling the bucket, otherwise you won't benefit from
this plugin.

View file

@ -1,12 +1,14 @@
# Yum # Yum
Used by CentOS guests, will get configured under guest's `/var/cache/yum`. It will
also [make sure](lib/vagrant-cachier/bucket/yum.rb#L20) that `keepcache` is set to
`1` on guest's `/etc/yum.conf`.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-centos-box' config.vm.box = 'some-centos-box'
config.cache.enable :yum config.cache.enable :yum
end end
``` ```
Used by CentOS guests, will get configured under guest's `/var/cache/yum`. It will
also [make sure](lib/vagrant-cachier/bucket/yum.rb#L20) that `keepcache` is set to
`1` on guest's `/etc/yum.conf`.

View file

@ -1,12 +1,14 @@
# Zypper # Zypper
Used by SuSE guests, will get configured under guest's `/var/cache/zypp/packages`. It will
also [make sure](lib/vagrant-cachier/bucket/zypper.rb#L20) that `keep-packages` is enabled
for all repositories.
To manually enable it:
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'some-suse-box' config.vm.box = 'some-suse-box'
config.cache.enable :zypper config.cache.enable :zypper
end end
``` ```
Used by SuSE guests, will get configured under guest's `/var/cache/zypp/packages`. It will
also [make sure](lib/vagrant-cachier/bucket/zypper.rb#L20) that `keep-packages` is enabled
for all repositories.

View file

@ -17,7 +17,7 @@ vagrant plugin install vagrant-cachier
## Quick start ## Quick start
The easiest way to set things up is just to enable [cache buckets auto detection](config/auto-detection) The easiest way to set things up is just to enable [cache buckets auto detection](usage)
from within your `Vagrantfile`: from within your `Vagrantfile`:
```ruby ```ruby

View file

@ -1,8 +1,6 @@
# Usage # Usage
## Configurations ## Auto detect supported cache buckets
### Auto detect supported cache buckets
This is the easiest way to get started with plugin. By adding the code below to This is the easiest way to get started with plugin. By adding the code below to
your `Vagrantfile` you can enable automatic detection of supported cache _buckets_: your `Vagrantfile` you can enable automatic detection of supported cache _buckets_:
@ -17,7 +15,22 @@ end
This will make vagrant-cachier do its best to find out what is supported on the This will make vagrant-cachier do its best to find out what is supported on the
guest machine and will set buckets accordingly. guest machine and will set buckets accordingly.
### Cache scope ## Enable buckets as needed
If for whatever reason you need to have a fined grained control over what buckets
are configured, you can do so by "cherry picking" them on your `Vagrantfile`:
```ruby
Vagrant.configure("2") do |config|
config.cache.enable :apt
config.cache.enable :gem
end
```
_Please refer to the "Available Buckets" menu above to find out which buckets
are supported._
## Cache scope
By default downloaded packages will get stored on a folder scoped to base boxes By default downloaded packages will get stored on a folder scoped to base boxes
under your `$HOME/.vagrant.d/cache`. The idea is to leverage the cache by allowing under your `$HOME/.vagrant.d/cache`. The idea is to leverage the cache by allowing