Added optional local apt cache
This commit is contained in:
parent
532824a395
commit
e5879e924e
40
README.md
40
README.md
@ -26,20 +26,7 @@ vagrant plugin install vagrant-berkshelf
|
|||||||
gem install berkshelf or gem install --http-proxy <http://some-proxy.foo.com:8088> berkshelf
|
gem install berkshelf or gem install --http-proxy <http://some-proxy.foo.com:8088> berkshelf
|
||||||
```
|
```
|
||||||
|
|
||||||
## Start mini-mon
|
# Using mini-mon
|
||||||
Berkshelf will download some cookbooks from the community so http_proxy and https_proxy environment variables must be set if applicable.
|
|
||||||
From within the `mini-mon` directory, to start all the vms run:
|
|
||||||
```
|
|
||||||
bin/vup
|
|
||||||
```
|
|
||||||
The standard vagrant commands can also be used, the vup script just starts things up in a dependency order using parallel startup.
|
|
||||||
|
|
||||||
## Halt mini-mon
|
|
||||||
In some cases halting mini-mon can result in certain vms being left in an odd state, to avoid this a script has been made to halt boxes in the
|
|
||||||
correct order
|
|
||||||
```
|
|
||||||
bin/vhalt
|
|
||||||
```
|
|
||||||
|
|
||||||
- Your home dir is synced to `/vagrant_home` on each vm
|
- Your home dir is synced to `/vagrant_home` on each vm
|
||||||
- Vms created
|
- Vms created
|
||||||
@ -55,6 +42,20 @@ bin/vhalt
|
|||||||
- Can also run `ssh vagrant@<ip address>` to login
|
- Can also run `ssh vagrant@<ip address>` to login
|
||||||
- password is `vagrant`
|
- password is `vagrant`
|
||||||
|
|
||||||
|
## Start mini-mon
|
||||||
|
Berkshelf will download some cookbooks from the community so http_proxy and https_proxy environment variables must be set if applicable.
|
||||||
|
From within the `mini-mon` directory, to start all the vms run:
|
||||||
|
```
|
||||||
|
bin/vup
|
||||||
|
```
|
||||||
|
The standard vagrant commands can also be used, the vup script just starts things up in a dependency order using parallel startup.
|
||||||
|
|
||||||
|
## Halt mini-mon
|
||||||
|
In some cases halting mini-mon can result in certain vms being left in an odd state, to avoid this a script has been made to halt boxes in the
|
||||||
|
correct order
|
||||||
|
```
|
||||||
|
bin/vhalt
|
||||||
|
```
|
||||||
|
|
||||||
## Updating a VM
|
## Updating a VM
|
||||||
When someone updates the config for a vm this process should allow you to bring up an updated vm.
|
When someone updates the config for a vm this process should allow you to bring up an updated vm.
|
||||||
@ -62,3 +63,14 @@ When someone updates the config for a vm this process should allow you to bring
|
|||||||
- `berks update`
|
- `berks update`
|
||||||
- `vagrant destroy vm` - Where vm is the name of the vm being updated, for example 'vertica'
|
- `vagrant destroy vm` - Where vm is the name of the vm being updated, for example 'vertica'
|
||||||
- `vagrant up vm`
|
- `vagrant up vm`
|
||||||
|
|
||||||
|
## Improving Provisioning Speed
|
||||||
|
The slowest part of the provisioning process is the downloading of deb packages. To speed this up a local apt-cache-ng can be used.
|
||||||
|
To install on a mac
|
||||||
|
```
|
||||||
|
brew install apt-cache-ng
|
||||||
|
```
|
||||||
|
Run `apt-cache-ng -c /usr/local/etc/apt-cacher-ng/` or optionaly follow the instructions from brew to start up the cache automatically.
|
||||||
|
That is all that is needed from now on the cache will be used.
|
||||||
|
|
||||||
|
A report from the cache is found at http://localhost:3142/acng-report.html
|
||||||
|
@ -3,5 +3,5 @@ maintainer_email "hpcs-mon@hp.com"
|
|||||||
license "All rights reserved"
|
license "All rights reserved"
|
||||||
description "Base setup for all vagrant boxes"
|
description "Base setup for all vagrant boxes"
|
||||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||||
version "0.0.1"
|
version "0.0.2"
|
||||||
depends "apt"
|
depends "apt"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# Common setup for all vagrant boxes
|
# Common setup for all vagrant boxes
|
||||||
|
|
||||||
|
|
||||||
## Todo - This apt setup is specific to HP Cloud and should be moved to an optional recipe.
|
## Todo - This apt setup is specific to HP Cloud and should be moved to an optional recipe.
|
||||||
|
|
||||||
# This move the default apt sources which are the standard ubuntu apt ones aside, so we are forced to deal with what hpcloud has mirrored
|
# This move the default apt sources which are the standard ubuntu apt ones aside, so we are forced to deal with what hpcloud has mirrored
|
||||||
@ -33,3 +32,24 @@ apt_repository 'dev' do
|
|||||||
components ['release']
|
components ['release']
|
||||||
key 'http://packages.dev.uswest.hpcloud.net/cloud/som/developer/hpcs.gpg'
|
key 'http://packages.dev.uswest.hpcloud.net/cloud/som/developer/hpcs.gpg'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Look for a local apt cache
|
||||||
|
rb = ruby_block "Check for local apt cache" do
|
||||||
|
action :nothing
|
||||||
|
block do
|
||||||
|
if system("wget -T 1 -t 1 http://#{node[:network][:default_gateway]}:#{node[:apt][:cacher_port]}/acng-report.html -O /dev/null > /dev/null 2>&1")
|
||||||
|
node.default[:apt][:cacher_ipaddress] = node[:network][:default_gateway]
|
||||||
|
node.default[:apt][:cacher_interface] = 'eth0'
|
||||||
|
Chef::Log.info('Enabling local apt-cache-ng')
|
||||||
|
else
|
||||||
|
node.default[:apt][:cacher_ipaddress] = nil
|
||||||
|
Chef::Log.info('Disabling local apt-cache-ng')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
rb.run_action(:create) # Run during compile time so that apt::cacher-client has the correct variables set
|
||||||
|
|
||||||
|
# Add in the cacher-client, it will do something or nothing depending on the value of node[:apt][:cacher_ipaddress]
|
||||||
|
include_recipe('apt::cacher-client')
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
},
|
},
|
||||||
"chef_type": "role",
|
"chef_type": "role",
|
||||||
"run_list": [
|
"run_list": [
|
||||||
"recipe[mini-mon]",
|
"recipe[mini-mon]"
|
||||||
"recipe[apt]"
|
|
||||||
],
|
],
|
||||||
"env_run_lists": {
|
"env_run_lists": {
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user