Skip to content

Chef Solo Guide

Steve Androulakis edited this page Aug 23, 2013 · 52 revisions

This is a brief, informal guide on running chef-solo on a server with the MyTardis recipe. This deploys a recipe on the machine that's executing this and doesn't require a chef server (Hosted Chef or other).

Confirmed working on these images (built from NeCTAR, tested on 17 Jan 2013)

Option 1: Deploy on your local machine with Vagrant

Follow the Vagrant getting started guide up to the point of adding the lucid32 box, then follow the commands below.

git clone https://github.com/mytardis/mytardis-chef.git
cd mytardis-chef/
cd vagrant/lucid32/
vagrant up

The server will be available on localhost:8000.

Note: This also works on CentOS 6 / Ubuntu Precise 64. vagrant box add centos6 https://s3.amazonaws.com/itmat-public/centos-6.3-chef-10.14.2.box then follow the instructions above (except cd vagrant/centos6/ or vagrant/precise64 instead of lucid32).

Use vagrant ssh , then skip down to After Installing.

Option 2: Install on a server (non-vagrant chef build)

Non-vagrant setup appropriate for installation on Amazon EC2, NeCTAR, or anything else you have root to.

Note: If your NeCTAR cloud node is complaining about not being able to resolve its hostname then fix it first before running this guide ($ echo "127.0.0.1 $(uname -n)" | sudo tee -a /etc/hosts). This is a NeCTAR cloud issue.

Ubuntu:

You can copy and paste this:

sudo bash <<EOF
true && curl -L https://www.opscode.com/chef/install.sh | bash
apt-get update
apt-get install -y git-core
mkdir -p /var/chef-solo
cd /var/chef-solo
git clone https://github.com/mytardis/mytardis-chef.git
cd mytardis-chef/
chef-solo -c solo/solo.rb -j solo/node.json -ldebug
EOF

CentOS 6/RHEL:

sudo -E bash <<EOF
rpm --httpproxy $http_proxy -Uvh http://rbel.frameos.org/rbel6
yum -y install ruby ruby-devel ruby-rdoc ruby-shadow gcc gcc-c++ automake autoconf make curl dmidecode

cd /tmp
curl -O http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar zxf rubygems-1.8.10.tgz
cd rubygems-1.8.10
ruby setup.rb --no-format-executable

# Bug in version 11.4.4 of gem. 
gem install chef --no-ri --no-rdoc --version '11.4.2'
yum -y install git
mkdir -p /var/chef-solo
cd /var/chef-solo
mkdir mytardis-chef
git clone https://github.com/mytardis/mytardis-chef.git
cd mytardis-chef
if [ $http_proxy != "" ]; then echo http_proxy '"'$http_proxy'"' >> solo/solo.rb;  fi
chef-solo -c solo/solo.rb -j solo/node.json -ldebug
EOF

After installing

MyTardis is now running! Just put http://[localhost or your server's IP address] in your browser.

Now create a MyTardis administrator :

  1. ssh into your server
  2. sudo -su mytardis
  3. cd /opt/mytardis/current
  4. bin/django createsuperuser

Run unit tests:

  1. sudo stop mytardis
  2. cd /opt/mytardis/current
  3. bin/django test --settings=tardis.test_settings
  4. sudo start mytardis