Created
January 25, 2016 20:57
-
-
Save vandorjw/4875e76d3dcd0ea1d8e0 to your computer and use it in GitHub Desktop.
Vagrantfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # All Vagrant configuration is done below. The "2" in Vagrant.configure | |
| # configures the configuration version (we support older styles for | |
| # backwards compatibility). Please don't change it unless you know what | |
| # you're doing. | |
| Vagrant.configure(2) do |config| | |
| config.vm.box = "ubuntu/trusty64" | |
| config.vm.box_check_update = true | |
| config.vm.network "forwarded_port", guest: 8080, host: 8080 | |
| config.vm.synced_folder ".", "/home/vagrant/source/" | |
| config.vm.provider "virtualbox" do |vb| | |
| vb.gui = false | |
| vb.memory = "512" | |
| end | |
| $SERVER_SETUP = <<-SCRIPT | |
| export DEBIAN_FRONTEND=noninteractive | |
| apt-get update | |
| apt-get install -y git | |
| apt-get install -y build-essential | |
| apt-get install -y libreadline6-dev | |
| apt-get install -y libyaml-dev | |
| apt-get install -y libsqlite3-dev | |
| apt-get install -y sqlite3 | |
| apt-get install -y autoconf | |
| apt-get install -y libgdbm-dev | |
| apt-get install -y libncurses5-dev | |
| apt-get install -y automake | |
| apt-get install -y libtool | |
| apt-get install -y bison | |
| apt-get install -y libffi-dev | |
| apt-get install -y postgresql-client | |
| apt-get install -y postgresql-contrib | |
| apt-get install -y virtualenvwrapper | |
| apt-get build-dep -y psycopg2 | |
| apt-get build-dep -y pillow | |
| apt-get build-dep -y python-lxml | |
| SCRIPT | |
| $VIRTUALENV_SETUP = <<-SCRIPT | |
| virtualenv ~/virtualenv | |
| source ~/virtualenv/bin/activate | |
| pip install -r /home/vagrant/source/requirements.txt | |
| SCRIPT | |
| $DATABASE_SETUP = <<-SCRIPT | |
| sudo -u postgres psql -c "CREATE ROLE vagrant WITH LOGIN SUPERUSER PASSWORD 'vagrant';" | |
| sudo -u postgres psql -c "CREATE DATABASE vagrant WITH OWNER vagrant;" | |
| sudo -u postgres psql -c "CREATE ROLE dev_db WITH LOGIN SUPERUSER PASSWORD 'dev_db';" | |
| sudo -u postgres psql -c "CREATE DATABASE dev_db WITH OWNER dev_db;" | |
| SCRIPT | |
| config.vm.provision "shell", inline: $SERVER_SETUP, privileged: true | |
| config.vm.provision "shell", inline: $VIRTUALENV_SETUP, privileged: false | |
| config.vm.provision "shell", inline: $DATABASE_SETUP, privileged: false | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment