diff --git a/README.md b/README.md index 1a3449f..47f9bab 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ TL;DR: set the database url appropriately in winchester.yaml ./build.sh +Using Vagrant for fast local provisioning: + + * Install [Vagrant](https://www.vagrantup.com/downloads.html) + * Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) + * git clone https://github.com/StackTach/sandbox.git + * cd sandbox/vagrant + * vagrant up + * vagrant ssh + * cd stacktach-sandbox + * sudo ./build.sh + + Note: + This uses sandbox defaults including the use of the Winchester + pipeline. + Tweaks: You can create a `local.sh` to override the defaults: diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile new file mode 100644 index 0000000..9ecd1cc --- /dev/null +++ b/vagrant/Vagrantfile @@ -0,0 +1,7 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = "ubuntu/trusty64" + config.vm.provision "shell", path: "bootstrap.sh" +end diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh new file mode 100644 index 0000000..583de61 --- /dev/null +++ b/vagrant/bootstrap.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +debconf-set-selections <<< 'mysql-server mysql-server/root_password password ROOTPASSWORD' +debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password ROOTPASSWORD' + +sudo apt-get update +sudo apt-get install -y python-dev ipython mysql-server mysql-client libmysqlclient-dev git vim rabbitmq-server python-pip librabbitmq1 + +pip install virtualenv + +if [ ! -f /var/log/dbinstalled ]; +then + echo "CREATE USER 'winchester'@'localhost' IDENTIFIED BY 'testpasswd'" | mysql -uroot -pROOTPASSWORD + echo "CREATE DATABASE winchester" | mysql -uroot -pROOTPASSWORD + echo "GRANT ALL ON winchester.* TO 'winchester'@'localhost'" | mysql -uroot -pROOTPASSWORD + echo "flush privileges" | mysql -uroot -pROOTPASSWORD + touch /var/log/dbinstalled + if [ -f /vagrant/data/initial.sql ]; + then + mysql -uroot -pROOTPASSWORD internal < /vagrant/data/initial.sql + fi +fi + +git clone https://github.com/stackforge/stacktach-sandbox.git