Permalink
Browse files

Add chef recipe

  • Loading branch information...
1 parent 8dcfe8c commit 1653792837469fa83bfdfc3886c3416d49ad3752 @marsam marsam committed Jun 28, 2013
Showing with 118 additions and 19 deletions.
  1. +2 −0 .gitignore
  2. +14 −19 Vagrantfile
  3. +8 −0 deploy/Berksfile
  4. +12 −0 deploy/metadata.rb
  5. +79 −0 deploy/recipes/default.rb
  6. +3 −0 deploy/templates/default/sv-ipython-run.erb
View
@@ -7,3 +7,5 @@ vagrant/bootstrap_complete.txt
ipynb/ipython_notebook.nohup.out
vagrant/.vagrant/
twitter.oauth_access
+.vagrant
+Berksfile.lock
View
@@ -2,16 +2,13 @@
# 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 = "precise64"
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
+ config.ssh.forward_agent = true
- # The url from where the 'config.vm.box' box will be fetched if it
- # doesn't already exist on the user's system.
- config.vm.box_url = "http://files.vagrantup.com/precise64.box"
+ # Berkshelf
+ config.berkshelf.enabled = true
+ config.berkshelf.berksfile_path = File.join(File.dirname(__FILE__), "deploy", "Berksfile")
# Map through port 8888 for IPython Notebook
config.vm.network :forwarded_port, host: 8888, guest: 8888
@@ -25,15 +22,13 @@ Vagrant.configure("2") do |config|
config.vm.network :forwarded_port, host: 27019, guest: 27019
config.vm.network :forwarded_port, host: 28017, guest: 28017
- # Setup a shared folder to make it simple to access data
- # that's on the host machine from the IPython Notebook
- # server that's running on the guest VM without needing to ssh
- # e.g. any files copied into the "share" folder in this same
- # directory where the Vagrantfile is located are available
- # on the VM through "/home/vagrant/share/"
- config.vm.synced_folder "../", "/home/vagrant/share/"
-
- # Bootstrap
- config.vm.provision :shell, :path => "bootstrap.sh"
-
+ config.vm.provision :chef_solo do |chef|
+ chef.log_level = :debug
+ chef.json = {
+ :answer => "42",
+ }
+ chef.run_list = [
+ "recipe[mtsw2e::default]"
+ ]
+ end
end
View
@@ -0,0 +1,8 @@
+site :opscode
+
+metadata
+
+cookbook "runit", "1.0.4"
+cookbook "python", "~> 1.3.4"
+cookbook "build-essential", "~> 1.4.0"
+cookbook "mongodb", git: "git://github.com/edelight/chef-mongodb.git"
View
@@ -0,0 +1,12 @@
+name "mtsw2e"
+maintainer "marsam"
+maintainer_email "rodasmario2@gmail.com"
+license "MIT"
+description "Installs/Configures mtsw2e"
+version "0.2.0"
+
+depends "apt"
+depends "runit"
+depends "python"
+
+supports "ubuntu"
@@ -0,0 +1,79 @@
+
+include_recipe "apt"
+include_recipe "runit"
+include_recipe "python"
+include_recipe "build-essential"
+include_recipe "mongodb::10gen_repo"
+
+package "mongodb-10gen"
+
+service "mongodb" do
+ action :enable
+end
+
+execute "mongodb_textsearch" do
+ command "echo 'setParameter=textSearchEnabled=true' >> /etc/mongodb.conf"
+ not_if "grep textSearchEnabled /etc/mongodb.conf"
+ notifies :reload, "service[mongodb]"
+end
+
+dependencies = [
+ "openjdk-6-jdk", # required by one of the dependencies
+ "libfreetype6-dev", "libpng-dev", # Matplotlib dependencies
+ "libncurses5-dev", "vim", "git-core",
+]
+
+dependencies.each do |pkg|
+ package pkg do
+ action :install
+ end
+end
+
+packages = [
+ # Matplotlib won't install any other way right now unless you install numpy first.
+ # http://stackoverflow.com/q/11797688
+ "numpy==1.7.1",
+
+ # Also need to guarantee that jpype is installed prior to boilerpipe, so just do it here
+ "git+git://github.com/ptwobrussell/jpype.git#egg=jpype-ptwobrussell-github",
+ "git+git://github.com/ptwobrussell/python-boilerpipe.git#egg=boilerpipe-ptwobrussell-github",
+
+ # Relying on a fix that's in IPython master branch and not yet in a release (#2791), so we also
+ # need to install IPython Notebook itself until 13.3, 1.0 or some other version includes it
+ "git+git://github.com/ptwobrussell/ipython.git#egg=ipython-ptwobrussell-github",
+
+ # Workaround for https://github.com/ozgur/python-linkedin/issues/11.
+ # See also https://github.com/ozgur/python-linkedin/pull/12
+ "git+git://github.com/ptwobrussell/python-linkedin.git#egg=python-linkedin-ptwobrussell-github",
+
+ # Install FuXi per https://code.google.com/p/fuxi/wiki/Installation_Testing
+ "http://cheeseshop.python.org/packages/source/p/pyparsing/pyparsing-1.5.5.tar.gz",
+ "https://fuxi.googlecode.com/hg/layercake-python.tar.bz2",
+ "https://pypi.python.org/packages/source/F/FuXi/FuXi-1.4.1.production.tar.gz",
+]
+
+packages.each do |package|
+ python_pip package do
+ action :install
+ end
+end
+
+execute "install_requirements" do
+ command "pip install -r /vagrant/mtsw2e-requirements.txt"
+ # action :nothing
+ notifies :run, "execute[download_nltk_data]"
+end
+
+# Install a few ancillary packages for NLTK in a central location. See http://nltk.org/data.html
+execute "download_nltk_data" do
+ command "python -m nltk.downloader -d /usr/share/nltk_data punkt maxent_treebank_pos_tagger maxent_ne_chunker words stopwords"
+ action :nothing
+end
+
+runit_service "ipython" do
+ default_logger true
+ options({
+ :port => "8888",
+ :notebook_dir => "/vagrant/ipynb",
+ })
+end
@@ -0,0 +1,3 @@
+#!/bin/sh
+exec 2>&1
+exec /usr/local/bin/ipython notebook --ip='0.0.0.0' --notebook-dir=<%= @options[:notebook_dir] %> --port=<%= @options[:port] %> --pylab=inline --no-browser

0 comments on commit 1653792

Please sign in to comment.