From 5ccb540ae228371d7a511b52ea81a115e98994e0 Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Mon, 6 Oct 2014 21:17:40 -0300 Subject: [PATCH] Added new shell provisioners --- Vagrantfile | 4 ++++ vagrant/provision.sh | 18 ++++++++++++++++++ vagrant/ubuntu.sh | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 0 deletions(-) create mode 100644 vagrant/provision.sh create mode 100644 vagrant/ubuntu.sh diff --git a/Vagrantfile b/Vagrantfile index 23fd86a..4a78ce6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -24,11 +24,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| if distro == "precise64" colab.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box" + config.vm.provision "shell", path: "vagrant/ubuntu.sh" elsif distro == "trusty64" colab.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" + config.vm.provision "shell", path: "vagrant/ubuntu.sh" elsif distro == "centos6.5" colab.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box" + config.vm.provision "shell", path: "vagrant/centos.sh" end + config.vm.provision "shell", privileged: false, keep_color: true, path: "vagrant/provision.sh" colab.vm.network :forwarded_port, guest: 8000, host: 8000 # Colab (runserver) colab.vm.network :forwarded_port, guest: 5280, host: 5280 # BOSH server diff --git a/vagrant/provision.sh b/vagrant/provision.sh new file mode 100644 index 0000000..d876d4d --- /dev/null +++ b/vagrant/provision.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +source /usr/local/bin/virtualenvwrapper.sh + +if [ ! -d /home/vagrant/.virtualenvs/colab ]; then + mkvirtualenv colab +fi + +workon colab + +pip install -r /vagrant/requirements.txt +pip install -e /vagrant + +if [ ! -f /etc/colab/settings.yaml ]; then + colab-init-config > /etc/colab/settings.yaml +fi + +colab-admin migrate diff --git a/vagrant/ubuntu.sh b/vagrant/ubuntu.sh new file mode 100644 index 0000000..43b828d --- /dev/null +++ b/vagrant/ubuntu.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +UBUNTU=$(lsb_release -sc) + +if [[ $UBUNTU == 'precise' ]] +then + postgresql_pkg='postgresql-9.1' +elif [[ $UBUNTU == 'trusty' ]] +then + postgresql_pkg='postgresql-9.3' +fi + + +### Install dependencies +apt-get update + +apt-get install curl git unzip mercurial build-essential libev-dev gettext libxml2-dev libxslt1-dev libssl-dev libffi-dev libjpeg-dev zlib1g-dev libfreetype6-dev libpq-dev python-dev $postgresql_pkg -y + + +### Install Virtualenvwrapper +which pip2.7 > /dev/null || + curl -s -L https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | + python2.7 + +if [ ! -L /etc/bash_completion.d/virtualenvwrapper.sh ] +then + pip install virtualenvwrapper + ln -s /usr/local/bin/virtualenvwrapper.sh /etc/bash_completion.d/virtualenvwrapper.sh +fi + +### Create conf directory +mkdir -p /etc/colab +chown vagrant:vagrant /etc/colab + +### Create colab user in PostgreSQL +echo "CREATE USER colab WITH PASSWORD 'colab';" | sudo -u postgres -i psql 2> /dev/null || echo + +#i## Create colab DB in PostgreSQL +sudo -u postgres -i createdb --owner=colab colab 2> /dev/null | echo -- libgit2 0.21.2