Make Cabot work on 14.04 as well as 12.04

Closes upstream #122
This commit is contained in:
Daniel Nelson 2014-11-22 20:45:42 -08:00
parent 3ed5f36bca
commit 569c71d0b1
5 changed files with 70 additions and 14 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ celerybeat-schedule
*.orig *.orig
.vagrant .vagrant
conf/*.env conf/*.env
local_config.yml

25
Vagrantfile vendored
View File

@ -1,3 +1,8 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Load local config overrides
local_config = File.file?("local_config.yml") ? YAML.load(File.read("local_config.yml")) : {}
Vagrant::configure("2") do |config| Vagrant::configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration # All Vagrant configuration is done here. The most common configuration
@ -5,15 +10,23 @@ Vagrant::configure("2") do |config|
# please see the online documentation at vagrantup.com. # please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of. # Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64" config.vm.box = local_config["box"] || "hashicorp/precise64"
config.vm.provider "virtualbox" do |v| # Virtualbox
v.customize ["modifyvm", :id, "--memory", "1024", "--cpus", "1"] config.vm.provider "virtualbox" do |vb|
vb.customize [
"modifyvm", :id,
"--memory", local_config['ram'] || "1024",
"--cpus", local_config['cpu'] || 1,
"--ioapic", "on",
]
end end
# The url from where the 'config.vm.box' box will be fetched if it #vmware_fusion
# doesn't already exist on the user's system. config.vm.provider "vmware_fusion" do |v|
config.vm.box_url = "http://files.vagrantup.com/precise64.box" v.vmx["memsize"] = local_config['ram'] || "1024"
v.vmx["numvcpus"] = local_config['cpu'] || 1
end
# Boot with a GUI so you can see the screen. (Default is headless) # Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui # config.vm.boot_mode = :gui

View File

@ -17,12 +17,24 @@ PACKAGES=(
'redis-server' 'redis-server'
) )
# 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
# 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
add-apt-repository -y ppa:chris-lea/redis-server add-apt-repository -y ppa:chris-lea/redis-server
apt-get update apt-get update
@ -31,6 +43,9 @@ apt-get install -y --force-yes ${PACKAGES[@]}
gem install foreman gem install foreman
# ubuntu 14.04 has `nodejs` not `node`
[ ! -f /usr/bin/node ] && ln -s /usr/bin/nodejs /usr/bin/node
pip install virtualenv pip install virtualenv
if [ ! -d /home/vagrant/venv ]; then if [ ! -d /home/vagrant/venv ]; then
virtualenv --no-site-packages /home/vagrant/venv/ virtualenv --no-site-packages /home/vagrant/venv/

View File

@ -51,18 +51,32 @@ packages=(
'build-essential' 'build-essential'
'redis-server' 'redis-server'
'libpq-dev' 'libpq-dev'
'rubygems'
'libxml2-dev' 'libxml2-dev'
'libxslt-dev' 'libxslt-dev'
'nodejs' 'nodejs'
'npm' 'npm'
'postgresql-9.1' 'postgresql'
'nginx' 'nginx'
'htop' 'htop'
) )
sudo apt-get update sudo apt-get update
sudo apt-get install --quiet --assume-yes ${packages[*]} sudo apt-get install --quiet --assume-yes ${packages[*]}
# install ruby if it's not installed
if ! which ruby; then
sudo apt-get install -y ruby1.9.3
fi
# install rubygems if it's not included in ruby
if ! which gem; then
sudo apt-get install -y rubygems
fi
# symlink node to nodejs for 14.04 compatibility
if ! which node && which nodejs; then
sudo ln -s `which nodejs` /usr/bin/node
fi
set +e set +e
sudo pip install -U pip # upgrade pip sudo pip install -U pip # upgrade pip
set -e set -e

13
example_local_config.yml Normal file
View File

@ -0,0 +1,13 @@
---
# Example Local Vagrant config
# With this file, you can override the amount of RAM and CPUs allocated
# to the VM, as well as change the base box it uses. Just copy it to
# local_config.yml and edit with whatever values you want.
#
# Note that it doesn't take effect until you vagrant destroy && vagrant up
# double your pleasure double your CPU and RAM
ram: 2048
cpu: 2
# hashicorp ubuntu doesn't support VMWare, so use box-cutter
box: box-cutter/ubuntu1404