Add Vagrant support for easy local testing

* Add simple Vagrantfile to provision an Ubuntu 14.04 VM with the bootstrap.sh script
* Update README with instructions for use

Change-Id: I94cd69742aeffab4c01a27510c25f381151bfefe
This commit is contained in:
Levi Blackstone 2015-02-17 15:13:49 -06:00
parent d9abe7ceae
commit 0833226b93
3 changed files with 46 additions and 0 deletions

View File

@ -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:

7
vagrant/Vagrantfile vendored Normal file
View File

@ -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

24
vagrant/bootstrap.sh Normal file
View File

@ -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