commit | 0530ec2f13c7b41fa379c77dc9d68a4fa2179b23 | [log] [tgz] |
---|---|---|
author | Matt Chu <matt.chu@gmail.com> | Sun Oct 12 11:07:14 2014 -0700 |
committer | Matt Chu <matt.chu@gmail.com> | Thu May 21 12:21:38 2015 -0700 |
tree | bbc0783086085695665fbe991bda7d01af605888 | |
parent | c21aedad80ef5a473b7fee9e3fdc902eb8bf00cc [diff] |
many changes for v0.5 release; see CHANGELOG
Chef cookbook for installing Continuum Analytic's Anaconda: "completely free Python distribution for large-scale data processing, predictive analytics, and scientific computing".
This also serves as a live example of the most up-to-date best practices for writing, maintaining, and testing Chef cookbooks:
This repo has only been tested with RVM; YMMV with other installation methods (rbenv, chef-dk, etc).
>= 2.0.1
is requiredIt sounds like Chef-DK is the new recommended installation path, but I have not had a good experience with it (as of 0.1.0-1). Again, YMMV.
The Vagrantfile is written to get you an Anaconda environment with minimal effort (though it will take at least a few minutes to download the Anaconda installer itself):
$> vagrant up --provision ... $> vagrant ssh $vagrant> export PATH=/opt/anaconda/2.2.0/bin:${PATH} $vagrant> conda --version conda 3.10.0 # if you included `recipe[anaconda::shell_conveniences]` you don't have to do anything; # it's sourced in /etc/profile.d $> vagrant ssh $vagrant> conda --version conda 3.10.0
In addition, by default an IPython notebook server is enabled and started:
To use it in a cookbook:
include_recipe 'anaconda::default'
You MUST include recipe[anaconda::python_workaround]
, otherwise subsequent chef runs will fail. See the issue for details.
The main recipe is anaconda::default
. Include it in your runlist, and it will install the package as well as any necessary dependencies.
The following are user-configurable attributes. Check attributes/default.rb for default values.
anaconda
version
: the version to install. Valid values are:flavor
: either x86
(32-bit) or x86_64
(64-bit)install_root
: the parent directory of all anaconda installs. note that individual installs go into #{install_root}/#{version}
accept_license
: must be explicitly set to the string yes
; any other value will reject the license.owner
: the user who owns the installgroup
: the group who owns the installrecipe[anaconda::shell_conveniences]
Include this to have the environment set for all users (login shells) via /etc/profile.d
. Useful for development.
$> vagrant ssh $vagrant> which conda /opt/anaconda/2.0.1/bin/conda
anaconda_package
You can use the anaconda_package
resource to install new packages into the Anaconda environment:
# I do not know what 'astroid' is, just using it as a sample package anaconda_package 'astroid' do # the other supported action is `:remove` action :install end
See the resource definition for additional options; in general, all it does is present the same options as conda install
/conda remove
.
anaconda_nbservice
This only works with a full Anaconda installation! I.e. the notebook service will not work out-of-the-box if installed with miniconda
The anaconda_nbservice
will run an IPython notebook server as a runit service:
anaconda_nbservice 'notebook-server' do # listen on all interfaces; there will be a warning since security is # disabled ip '*' port '8888' user 'vagrant' group 'vagrant' install_dir '/opt/ipython/server' service_action [ :enable, :start ] end
The standard configuration should be good enough, but you might need to write your own run service template:
anaconda_nbservice 'server-with-custom-template' do user ipython_user group ipython_group install_dir install_dir template_cookbook 'your_cookbook' # note that if your template name is TEMPLATE, then this value should be # 'TEMPLATE", but the file should be 'sv-TEMPLATE-run.erb' run_template_name 'your_template_name' run_template_opts({ ... }) service_action [ :enable, :start ] end
Run the full test suite:
# this will take a really long time $> script/cibuild ... # check the final result; bash return codes: 0 is good, anything else is not $> echo $?
Run just the chefspecs:
$> rspec
Run just the test kitchen serverspec integration tests:
# this is what takes so long: every platform and version is fully built in vagrant # the list of OSes is defined in [.kitchen.yml](.kitchen.yml) $> kitchen verify # test a specific OS; `kitchen list` $> kitchen verify default-ubuntu-1204
Check the style with Foodcritic:
$> foodcritic
Standard stuff:
git tag
'edIssues should be opened in the Github issue tracker
suggests
, supports
, etcAuthor:: Matt Chu (matt.chu@gmail.com)