From 30b25fd4ebf727399ef80ac38c25d60e459c71ad Mon Sep 17 00:00:00 2001 From: Jon Burgess Date: Thu, 27 Jun 2013 21:14:33 +1000 Subject: [PATCH 1/3] Provision VM with required python and R packages using vagrant and chef-solo. --- Berksfile | 6 +++ Berksfile.lock | 4 ++ Vagrantfile | 43 +++++++++++++++ cookbooks/imos_python/CHANGELOG.md | 12 +++++ cookbooks/imos_python/README.md | 68 ++++++++++++++++++++++++ cookbooks/imos_python/metadata.rb | 9 ++++ cookbooks/imos_python/recipes/default.rb | 21 ++++++++ 7 files changed, 163 insertions(+) create mode 100644 Berksfile create mode 100644 Berksfile.lock create mode 100644 Vagrantfile create mode 100644 cookbooks/imos_python/CHANGELOG.md create mode 100644 cookbooks/imos_python/README.md create mode 100644 cookbooks/imos_python/metadata.rb create mode 100644 cookbooks/imos_python/recipes/default.rb diff --git a/Berksfile b/Berksfile new file mode 100644 index 0000000..2ebd218 --- /dev/null +++ b/Berksfile @@ -0,0 +1,6 @@ +site :opscode + +cookbook "apt" +cookbook "python" +cookbook "imos_python", :path => "cookbooks/imos_python" +cookbook "r", :github => "stevendanna/cookbook-r" diff --git a/Berksfile.lock b/Berksfile.lock new file mode 100644 index 0000000..9513668 --- /dev/null +++ b/Berksfile.lock @@ -0,0 +1,4 @@ +cookbook 'python', :locked_version => '1.3.4' +cookbook 'imos_python', :path => '/Users/jburgess/git/imos_user_code_library/cookbooks/imos_python' +cookbook 'build-essential', :locked_version => '1.4.0' +cookbook 'yum', :locked_version => '2.3.0' \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..1354332 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,43 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + # All Vagrant configuration is done here. The most common configuration + # options are documented and commented below. For a complete reference, + # please see the online documentation at vagrantup.com. + + # Every Vagrant virtual environment requires a box to build off of. + config.vm.box_url = "http://grahamc.com/vagrant/ubuntu-12.04-omnibus-chef.box" + config.vm.box = "ubuntu-12.04-omnibus-chef.box" + + # config.vm.synced_folder "../data", "/vagrant_data" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + config.vm.provider :virtualbox do |vb| + # Don't boot with headless mode + # vb.gui = true + + # # Use VBoxManage to customize the VM. For example to change memory: + # vb.customize ["modifyvm", :id, "--memory", "1024"] + end + + # Enable provisioning with chef solo, specifying a cookbooks path, roles + # path, and data_bags path (all relative to this Vagrantfile), and adding + # some recipes and/or roles. + # + config.vm.provision :chef_solo do |chef| + + chef.add_recipe "apt::default" + chef.add_recipe "python" + chef.add_recipe "imos_python" + chef.add_recipe "r" + + + # You may also specify custom JSON attributes: +# chef.json = { :mysql_password => "foo" } + end + +end diff --git a/cookbooks/imos_python/CHANGELOG.md b/cookbooks/imos_python/CHANGELOG.md new file mode 100644 index 0000000..ed0b876 --- /dev/null +++ b/cookbooks/imos_python/CHANGELOG.md @@ -0,0 +1,12 @@ +# CHANGELOG for imos_python + +This file is used to list changes made in each version of imos_python. + +## 0.1.0: + +* Initial release of imos_python + +- - - +Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. + +The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown. diff --git a/cookbooks/imos_python/README.md b/cookbooks/imos_python/README.md new file mode 100644 index 0000000..1b980f9 --- /dev/null +++ b/cookbooks/imos_python/README.md @@ -0,0 +1,68 @@ +imos_python Cookbook +==================== +TODO: Enter the cookbook description here. + +e.g. +This cookbook makes your favorite breakfast sandwhich. + +Requirements +------------ +TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc. + +e.g. +#### packages +- `toaster` - imos_python needs toaster to brown your bagel. + +Attributes +---------- +TODO: List you cookbook attributes here. + +e.g. +#### imos_python::default + + + + + + + + + + + + + +
KeyTypeDescriptionDefault
['imos_python']['bacon']Booleanwhether to include bacontrue
+ +Usage +----- +#### imos_python::default +TODO: Write usage instructions for each cookbook. + +e.g. +Just include `imos_python` in your node's `run_list`: + +```json +{ + "name":"my_node", + "run_list": [ + "recipe[imos_python]" + ] +} +``` + +Contributing +------------ +TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section. + +e.g. +1. Fork the repository on Github +2. Create a named feature branch (like `add_component_x`) +3. Write you change +4. Write tests for your change (if applicable) +5. Run the tests, ensuring they all pass +6. Submit a Pull Request using Github + +License and Authors +------------------- +Authors: TODO: List authors diff --git a/cookbooks/imos_python/metadata.rb b/cookbooks/imos_python/metadata.rb new file mode 100644 index 0000000..3c71c19 --- /dev/null +++ b/cookbooks/imos_python/metadata.rb @@ -0,0 +1,9 @@ +name 'imos_python' +maintainer 'YOUR_COMPANY_NAME' +maintainer_email 'YOUR_EMAIL' +license 'All rights reserved' +description 'Installs/Configures imos_python' +long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +version '0.1.0' + +depends "python" diff --git a/cookbooks/imos_python/recipes/default.rb b/cookbooks/imos_python/recipes/default.rb new file mode 100644 index 0000000..643a6dc --- /dev/null +++ b/cookbooks/imos_python/recipes/default.rb @@ -0,0 +1,21 @@ +# Packages by Marty's request + +# Maths & plotting (installs numpy as a dependency) +package "python-matplotlib" + +# Connect to postgres db +package "python-psycopg2" + +# email helper +package "python-beautifulsoup" + +# NetCDF +package "libhdf5-serial-dev" +package "libnetcdf-dev" +python_pip "netCDF4" do + action :install +end + +# Optional but very useful +package "ipython" +package "python-scipy" From 940eb435c1bb34512f568322697fb6de4ba5d184 Mon Sep 17 00:00:00 2001 From: Jon Burgess Date: Fri, 28 Jun 2013 09:36:15 +1000 Subject: [PATCH 2/3] Importing imos_python cookbooks from common cookbook repo. Cleaned up Vagrantfile and forward X11 by default. --- Berksfile | 2 +- Vagrantfile | 26 +-------- cookbooks/imos_python/CHANGELOG.md | 12 ----- cookbooks/imos_python/README.md | 68 ------------------------ cookbooks/imos_python/metadata.rb | 9 ---- cookbooks/imos_python/recipes/default.rb | 21 -------- 6 files changed, 2 insertions(+), 136 deletions(-) delete mode 100644 cookbooks/imos_python/CHANGELOG.md delete mode 100644 cookbooks/imos_python/README.md delete mode 100644 cookbooks/imos_python/metadata.rb delete mode 100644 cookbooks/imos_python/recipes/default.rb diff --git a/Berksfile b/Berksfile index 2ebd218..73a00a6 100644 --- a/Berksfile +++ b/Berksfile @@ -2,5 +2,5 @@ site :opscode cookbook "apt" cookbook "python" -cookbook "imos_python", :path => "cookbooks/imos_python" +cookbook "imos_python", :github => "aodn/cookbooks", :rel => "imos_python" cookbook "r", :github => "stevendanna/cookbook-r" diff --git a/Vagrantfile b/Vagrantfile index 1354332..43fd4f4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,32 +2,12 @@ # vi: set ft=ruby : Vagrant.configure("2") do |config| - # All Vagrant configuration is done here. The most common configuration - # options are documented and commented below. For a complete reference, - # please see the online documentation at vagrantup.com. - # Every Vagrant virtual environment requires a box to build off of. config.vm.box_url = "http://grahamc.com/vagrant/ubuntu-12.04-omnibus-chef.box" config.vm.box = "ubuntu-12.04-omnibus-chef.box" - # config.vm.synced_folder "../data", "/vagrant_data" + config.ssh.forward_x11 = true - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # - config.vm.provider :virtualbox do |vb| - # Don't boot with headless mode - # vb.gui = true - - # # Use VBoxManage to customize the VM. For example to change memory: - # vb.customize ["modifyvm", :id, "--memory", "1024"] - end - - # Enable provisioning with chef solo, specifying a cookbooks path, roles - # path, and data_bags path (all relative to this Vagrantfile), and adding - # some recipes and/or roles. - # config.vm.provision :chef_solo do |chef| chef.add_recipe "apt::default" @@ -35,9 +15,5 @@ Vagrant.configure("2") do |config| chef.add_recipe "imos_python" chef.add_recipe "r" - - # You may also specify custom JSON attributes: -# chef.json = { :mysql_password => "foo" } end - end diff --git a/cookbooks/imos_python/CHANGELOG.md b/cookbooks/imos_python/CHANGELOG.md deleted file mode 100644 index ed0b876..0000000 --- a/cookbooks/imos_python/CHANGELOG.md +++ /dev/null @@ -1,12 +0,0 @@ -# CHANGELOG for imos_python - -This file is used to list changes made in each version of imos_python. - -## 0.1.0: - -* Initial release of imos_python - -- - - -Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. - -The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown. diff --git a/cookbooks/imos_python/README.md b/cookbooks/imos_python/README.md deleted file mode 100644 index 1b980f9..0000000 --- a/cookbooks/imos_python/README.md +++ /dev/null @@ -1,68 +0,0 @@ -imos_python Cookbook -==================== -TODO: Enter the cookbook description here. - -e.g. -This cookbook makes your favorite breakfast sandwhich. - -Requirements ------------- -TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc. - -e.g. -#### packages -- `toaster` - imos_python needs toaster to brown your bagel. - -Attributes ----------- -TODO: List you cookbook attributes here. - -e.g. -#### imos_python::default - - - - - - - - - - - - - -
KeyTypeDescriptionDefault
['imos_python']['bacon']Booleanwhether to include bacontrue
- -Usage ------ -#### imos_python::default -TODO: Write usage instructions for each cookbook. - -e.g. -Just include `imos_python` in your node's `run_list`: - -```json -{ - "name":"my_node", - "run_list": [ - "recipe[imos_python]" - ] -} -``` - -Contributing ------------- -TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section. - -e.g. -1. Fork the repository on Github -2. Create a named feature branch (like `add_component_x`) -3. Write you change -4. Write tests for your change (if applicable) -5. Run the tests, ensuring they all pass -6. Submit a Pull Request using Github - -License and Authors -------------------- -Authors: TODO: List authors diff --git a/cookbooks/imos_python/metadata.rb b/cookbooks/imos_python/metadata.rb deleted file mode 100644 index 3c71c19..0000000 --- a/cookbooks/imos_python/metadata.rb +++ /dev/null @@ -1,9 +0,0 @@ -name 'imos_python' -maintainer 'YOUR_COMPANY_NAME' -maintainer_email 'YOUR_EMAIL' -license 'All rights reserved' -description 'Installs/Configures imos_python' -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.0' - -depends "python" diff --git a/cookbooks/imos_python/recipes/default.rb b/cookbooks/imos_python/recipes/default.rb deleted file mode 100644 index 643a6dc..0000000 --- a/cookbooks/imos_python/recipes/default.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Packages by Marty's request - -# Maths & plotting (installs numpy as a dependency) -package "python-matplotlib" - -# Connect to postgres db -package "python-psycopg2" - -# email helper -package "python-beautifulsoup" - -# NetCDF -package "libhdf5-serial-dev" -package "libnetcdf-dev" -python_pip "netCDF4" do - action :install -end - -# Optional but very useful -package "ipython" -package "python-scipy" From d1712e9389cd6553391ee0bc891fa694f5213f5e Mon Sep 17 00:00:00 2001 From: Jon Burgess Date: Fri, 28 Jun 2013 09:44:53 +1000 Subject: [PATCH 3/3] Ignore .vagrant. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index cc33fcc..d5f1316 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ .settings target-eclipse *~ +.vagrant +