cabot/bin/provision

72 lines
1.6 KiB
Plaintext
Raw Normal View History

2014-01-05 17:24:04 +00:00
#!/bin/bash
# A provisioning script for installing deps on ubuntu
set -eo pipefail
cd /vagrant
PACKAGES=(
'gcc'
'git'
'python-dev'
'python-pip'
'libpq-dev'
'ruby1.9.1-full'
'ruby1.9.3'
'npm'
'redis-tools'
'redis-server'
'libsasl2-dev'
'libldap2-dev'
2014-01-05 17:24:04 +00:00
)
# OS-specific install instructions
case $(lsb_release -sc) in
"precise")
# add-apt-repository is not available in the base system
if ! which add-apt-repository; then
apt-get update
apt-get install -y python-software-properties
fi
;;
"trusty")
# add-apt-repository is not available in the base system
if ! which add-apt-repository; then
apt-get update
apt-get install -y software-properties-common
fi
;;
esac
2014-01-05 17:24:04 +00:00
add-apt-repository -y ppa:chris-lea/redis-server
apt-get update
apt-get install -y --force-yes ${PACKAGES[@]}
gem install foreman
# ubuntu 14.04 has `nodejs` not `node`
[ ! -f /usr/bin/node ] && ln -s /usr/bin/nodejs /usr/bin/node
2014-01-05 17:24:04 +00:00
pip install virtualenv
if [ ! -d /home/vagrant/venv ]; then
virtualenv --no-site-packages /home/vagrant/venv/
fi
npm install --no-color -g coffee-script less@1.3 --registry http://registry.npmjs.org/ # eco browserify
2014-01-05 17:24:04 +00:00
2014-08-01 15:36:20 +00:00
/home/vagrant/venv/bin/pip install --timeout=30 --exists-action=w -e /vagrant/ --no-use-wheel
2014-01-05 17:24:04 +00:00
# Start redis
sudo service redis-server restart
# Add in a venv activate to our bash profile
profile_file=/home/vagrant/.bashrc
if ! grep -q 'venv' "${profile_file}" ; then
echo -e ". ~/venv/bin/activate\ncd /vagrant/" >> ${profile_file}
fi
if ! grep -q '/vagrant/bin/activate' "${profile_file}" ; then
echo -e ". /vagrant/bin/activate" >> ${profile_file}
fi