From 9c98414c8580d557eb3e03439e50ee5a3be71ad3 Mon Sep 17 00:00:00 2001 From: Shaun Duncan Date: Thu, 20 Feb 2014 11:34:04 -0500 Subject: [PATCH] Initial Vagrantfile --- .gitignore | 2 ++ Vagrantfile | 28 +++++++++++++++ scripts/provision.sh | 82 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 Vagrantfile create mode 100644 scripts/provision.sh diff --git a/.gitignore b/.gitignore index f5ba5480..956ba27b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ cmd/drone/drone cmd/droned/droned deb/drone/usr/local/bin/drone deb/drone/usr/local/bin/droned + +.vagrant diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 00000000..72d10963 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,28 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # Drone supports 12.04 64bit and 13.04 64bit + config.vm.box = "precise64" + config.vm.box_url = "http://files.vagrantup.com/precise64.box" + + # Forward keys from SSH agent rather than copypasta + config.ssh.forward_agent = true + + # FIXME: Maybe this is enough + config.vm.provider "virtualbox" do |v| + v.customize ["modifyvm", :id, "--memory", "1024"] + end + + # Drone by default runs on port 80. Forward from host to guest + config.vm.network :forwarded_port, guest: 80, host: 8080 + config.vm.network :private_network, ip: "192.168.56.101" + + # system-level initial setup + config.vm.provision "shell" do |s| + s.path = "scripts/provision.sh" + end +end diff --git a/scripts/provision.sh b/scripts/provision.sh new file mode 100644 index 00000000..186d616f --- /dev/null +++ b/scripts/provision.sh @@ -0,0 +1,82 @@ +#!/bin/sh +set -e + +# Ensure that agent forwarding is set up properly. +if [ "$SSH_AUTH_SOCK" ]; then + echo "SSH_AUTH_SOCK is set; you are successfully agent-forwarding. These keys are loaded:" + if [ -z "$1" ]; then + ssh-add -l + else + echo "Not attempting to list keys because windows ssh-agent communication is broken..." + fi +else + echo "No SSH_AUTH_SOCK was found in the environment!" + exit 3 +fi + +# apt-get update. +if [ -e /root/package-list-updated ]; then + echo "Skipping package cache update. To force, remove /root/package-list-updated and re-provision." +else + echo "Updating package cache." + sudo apt-get update -qq + touch /root/package-list-updated +fi + +echo "Installing Packages..." +export DEBIAN_FRONTEND=noninteractive +( sed -e 's/#.*$//' | xargs sudo apt-get install -qqy --force-yes ) <<-EOF + git + + # Stuff required by medley + python-software-properties # TODO why do we need this? + build-essential # needed to compile parts of packages + curl # many scripts expect this to fetch urls. + python-dev # for compiling python modules + python-imaging # Useful if you do not want to compile PIL + python-pip # for installing things + python-psycopg2 # python postgresql library + python-setuptools # for installing/making packages + python-unittest2 # standard unit testing library + python-virtualenv # for partioning python projects + pv # "pipe viewer", for nice progressbars in med + exuberant-ctags # required by 'med tags' + + # geospatial libraries + libgdal1-dev + libgdal1-1.7.0 + libgeos-3.2.2 + libgeos-c1 + libgeos-dev + + python-lxml # TODO why do we need this? + libxml2 # TODO why do we need this? + libxml2-dev # TODO why do we need this? + libxslt1-dev # TODO why do we need this? + + postgresql-9.0 # our database. + postgresql-contrib-9.0 # django wants this + postgresql-server-dev-9.0 # TODO why do we need this? + + # postgresql-9.0-postgis is not available in standard repos, so we install + # my custom package later. + #postgresql-9.0-postgis # utilize geo stuff in postgres + + + # Development helpers that I'm asserting don't need to be installed by + # default for everyone using this thing, they can just install them when + # they need them. + # ack-grep # adreyer thinks you should have it + # ipython # adreyer thinks you should have it + # bpython # nksmith thinks you should have it + # memcached # django can work around not having this + # proj # TODO apt says it is transitional. wtf is it for? + # pyflakes # adreyer thinks you should have it + # pylint # adreyer thinks you should have it + # python-pycryptopp # adreyer thinks you should have it + # virtualenvwrapper # convenience tool + # rabbitmq-server # adreyer thinks you should have it + # vim # adreyer thinks you should have it + + openjdk-7-jre-headless # needed to run solr +EOF