Created a Vagrantfile

Install instructions:

- clone repo
- (ensure you have VirtualBox and Vagrant)
- run configure.sh

This will create a VM, install all the software. Once vm is provisioned
it will then bundle install and configure your database

To start the service you can then run:

vagrant ssh -c 'cd /vagrant; rails s'
This commit is contained in:
Gord Tanner 2015-01-22 17:53:18 -05:00
parent b2fce96974
commit 5592c4710a
3 changed files with 56 additions and 0 deletions

2
.gitignore vendored
View file

@ -19,3 +19,5 @@ log/*.log
tmp
.DS_Store
.vagrant

38
Vagrantfile vendored Normal file
View file

@ -0,0 +1,38 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
# install base req's
sudo apt-get update
sudo apt-get install git curl -y
# rvm and ruby
su - vagrant -c 'curl -sSL https://rvm.io/mpapis.asc | gpg --import -'
su - vagrant -c 'curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.3'
# install some other deps
sudo apt-get install nodejs -y
sudo apt-get install postgresql -y
sudo apt-get install libpq-dev -y
sudo apt-get install redis-server -y
# Install node
ln -fs /usr/bin/nodejs /usr/bin/node
# set the postgres password
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '3112';"
SCRIPT
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "trusty64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.network "private_network", ip: "10.0.1.11"
config.vm.synced_folder ".", "/vagrant", :nfs => true
config.vm.provision "shell", inline: $script
end

16
configure.sh Executable file
View file

@ -0,0 +1,16 @@
# Make sure we've got NFS handy.
if [ $(uname) == 'Linux' ] && [ ! -e /etc/init.d/nfs-kernel-server ]; then
sudo apt-get install -y nfs-common nfs-kernel-server rpcbind
fi
# Vagrant up
vagrant up
# Bundle!
vagrant ssh --command "cd /vagrant; bundle install";
# copy the db config
vagrant ssh --command "cd /vagrant; cp config/database.yml.default config/database.yml";
# Rake all the things
vagrant ssh --command "cd /vagrant; rake db:create; rake db:schema:load; rake db:fixtures:load"