diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-08-18 13:38:55 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-08-18 13:38:55 +0100 |
commit | e09834d1cc7cf5f9f57e356d8145fd9383fa1228 (patch) | |
tree | d415d6c556ff3148ac3a686d7d8dfbd9309adbc4 | |
parent | 35862d85c4aea5a8a806410e1b1d9ae9e1fa3612 (diff) | |
parent | f0679b4321f6d1eb3aaca3412d73edde22ce667c (diff) |
Merge branch 'customisable-vagrant-box' into rails-3-develop
-rw-r--r-- | Vagrantfile | 22 | ||||
m--------- | commonlib | 0 | ||||
-rwxr-xr-x | script/site-specific-install.sh | 59 | ||||
-rwxr-xr-x | script/test-vagrant-provisioning | 19 |
4 files changed, 97 insertions, 3 deletions
diff --git a/Vagrantfile b/Vagrantfile index 183df5893..0fcf73de0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -60,12 +60,27 @@ ALAVETELI_FQDN = ENV['ALAVETELI_VAGRANT_FQDN'] || "alaveteli.10.10.10.30.xip.io" ALAVETELI_MEMORY = ENV['ALAVETELI_VAGRANT_MEMORY'] || 1536 ALAVETELI_THEMES_DIR = ENV['ALAVETELI_THEMES_DIR'] || '../alaveteli-themes' +ALAVETELI_OS = ENV['ALAVETELI_VAGRANT_OS'] || 'precise64' + +SUPPORTED_OPERATING_SYSTEMS = { + 'precise64' => 'https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box', + 'squeeze64' => 'http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210-nocm.box', + 'wheezy64' => 'http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box' +} + +def box + ALAVETELI_OS +end + +def box_url + SUPPORTED_OPERATING_SYSTEMS[ALAVETELI_OS] +end VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.box = "precise64" - config.vm.box_url = "http://files.vagrantup.com/precise64.box" + config.vm.box = box + config.vm.box_url = box_url config.vm.network :private_network, :ip => "10.10.10.30" config.vm.synced_folder ".", "/home/vagrant/alaveteli", :owner => "vagrant", :group => "vagrant" @@ -86,7 +101,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end # Fetch and run the install script: - config.vm.provision :shell, :inline => "wget -O install-site.sh https://raw.githubusercontent.com/mysociety/commonlib/master/bin/install-site.sh" + config.vm.provision :shell, :inline => "apt-get -y install curl" + config.vm.provision :shell, :inline => "curl -O https://raw.githubusercontent.com/mysociety/commonlib/master/bin/install-site.sh" config.vm.provision :shell, :inline => "chmod a+rx install-site.sh" config.vm.provision :shell, :inline => "./install-site.sh " \ "--dev " \ diff --git a/commonlib b/commonlib -Subproject 25fbbc5d4c486297e5fbdb85989bdacb1e86756 +Subproject 4d0fd6d01bb34d3d592a2bb4adaa5927a50d892 diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 4c8c99aa2..5c3fb2339 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -32,6 +32,65 @@ misuse() { update_mysociety_apt_sources +# Debian Squeeze Fixes +if [ x"$DISTRIBUTION" = x"debian" ] && [ x"$DISTVERSION" = x"squeeze" ] +then + # Add wheezy repo to get bundler + cat > /etc/apt/sources.list.d/debian-wheezy.list <<EOF +deb http://the.earth.li/debian/ wheezy main contrib non-free +EOF + + # Get bundler from wheezy repo and de-prioritise all other + # wheezy packages + cat >> /etc/apt/preferences <<EOF + +Package: bundler +Pin: release n=wheezy +Pin-Priority: 990 + +Package: * +Pin: release n=wheezy +Pin-Priority: 50 +EOF + +apt-get -qq update +fi + +# Ubuntu Precise Fixes +if [ x"$DISTRIBUTION" = x"ubuntu" ] && [ x"$DISTVERSION" = x"precise" ] +then + cat > /etc/apt/sources.list.d/ubuntu-trusty.list <<EOF +deb http://archive.ubuntu.com/ubuntu/ trusty universe +deb-src http://archive.ubuntu.com/ubuntu/ trusty universe +EOF + + cat > /etc/apt/sources.list.d/mysociety-launchpad.list <<EOF +deb http://ppa.launchpad.net/mysociety/alaveteli/ubuntu precise main +deb-src http://ppa.launchpad.net/mysociety/alaveteli/ubuntu precise main +EOF + + # Get bundler from trusty and de-prioritise all other + # trusty packages + cat >> /etc/apt/preferences <<EOF + +Package: ruby-bundler +Pin: release n=trusty +Pin-Priority: 990 + +Package: * +Pin: release n=trusty +Pin-Priority: 50 +EOF + +# Get the key for the mysociety ubuntu alaveteli repo +apt-get install -y python-software-properties +add-apt-repository -y ppa:mysociety/alaveteli + +apt-get -qq update +fi + +apt-get -y update + if [ ! "$DEVELOPMENT_INSTALL" = true ]; then install_nginx add_website_to_nginx diff --git a/script/test-vagrant-provisioning b/script/test-vagrant-provisioning new file mode 100755 index 000000000..62862f3df --- /dev/null +++ b/script/test-vagrant-provisioning @@ -0,0 +1,19 @@ +#!/bin/bash + +OS=$1 + +vagrant destroy + +ALAVETELI_VAGRANT_OS="$OS" vagrant up && + vagrant ssh -c "cd /home/vagrant/alaveteli && bundle exec rails s --daemon" && + sleep 10 && + curl -I http://10.10.10.30:3000 + +if [[ $? -ne 0 ]] +then + echo "Failed with exit code $?" + exit 1 +else + echo "Success!" + exit 0 +fi |