Skip to content

Instantly share code, notes, and snippets.

@ydaniv
Last active August 29, 2015 14:08
Show Gist options
  • Save ydaniv/73ec2ba94065e02a2e3f to your computer and use it in GitHub Desktop.
Save ydaniv/73ec2ba94065e02a2e3f to your computer and use it in GitHub Desktop.
Openbudgets Vagrantfile
#!/bin/sh
# Create the virtual environment
mkvirtualenv openbudgets
# Link central project code directory to its virtual environment
setvirtualenvproject /home/vagrant/envs/openbudgets /home/vagrant/openbudgets
# Move to the root of central project code directory
cdproject
# Install Openbudgets' deps.
pip install -r requirements.txt
# Bootstrap the project
fab e:e=vagrant local.environ.ensure_settings
# Switch to postgres user and create the vagrant user in PG
sudo su - postgres
fab e:e=vagrant local.db.createuser
exit
# Bootstrap project
fab e:e=vagrant local.bootstrap:initial=yes
#!/bin/sh
# Install all OS deps.
sudo apt-get update
sudo apt-get install -q -y build-essential libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip git-core libpq-dev python-dev python-pip postgresql postgresql-contrib postgresql-server-dev-all redis-server
# Install virtualenv and ~wrapper
sudo pip install virtualenv virtualenvwrapper
mkdir envs
# virtualenvwrapper config + setting the CENTRAL_ENV env variable to vagrant
export PYTHONIOENCODING=utf-8
export WORKON_HOME="/home/vagrant/envs"
export PROJECT_HOME="/home/vagrant"
/usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUAL_ENV_BASE="/home/vagrant/envs"
Vagrant.configure("2") do |config|
box = "ubuntu/precise32"
config.vm.box = box
config.vm.synced_folder ".", "/home/vagrant/openbudgets"
config.vm.network "forwarded_port", guest: 8000, host: 8080
config.vm.network "private_network", type: "dhcp"
# fix an annoying stdin error
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
config.vm.provision "shell",
path: "init.sh"
#config.vm.provision "shell",
# path: "/home/vagrant/.profile", privileged: false
#config.vm.provision "shell",
# path: "bootstrap.sh", privileged: false
#config.vm.provision "shell",
# inline: "python manage.py runserver 0.0.0.0:8000", privileged: false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment