Last active
December 28, 2015 02:08
-
-
Save arubdesu/a932d7d9adcb312ea8c4 to your computer and use it in GitHub Desktop.
For working on madebygraham Django webapps, a vagrantfile and script to run inside the resulting vm (as sudo) to set up a dev env (no nginx, no postgresql, no wsgi). Expects a unpacked download of the crypt-server docker repo in the shared folder(which is the same as the vagrantfile's working dir by default), checks out current master
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
#!/bin/bash | |
set -x | |
# Run from /vagrant dir inside vm (as sudo) to set up dev env (no nginx, no postgresql, no wsgi) | |
APP_DIR="/vagrant/crypt" | |
git clone https://github.com/grahamgilbert/crypt-server.git $APP_DIR | |
pip install -r $APP_DIR/setup/requirements.txt | |
# move docker ADD'd files/dirs into place | |
cp /vagrant/crypt-server-master/settings.py $APP_DIR/fvserver/ | |
cp /vagrant/crypt-server-master/settings_import.py $APP_DIR/fvserver/ | |
cp -R /vagrant/crypt-server-master/django/management/ $APP_DIR/server/management/ | |
# perform original run.sh tasks | |
cd $APP_DIR | |
python generate_keyczart.py | |
python manage.py syncdb --noinput | |
python manage.py migrate server | |
python manage.py migrate --noinput | |
python manage.py collectstatic --noinput | |
python manage.py update_admin_user --username=admin --password=password | |
# chown -R vagrant:vagrant $APP_DIR | |
chmod go+x $APP_DIR |
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 : | |
| |
Vagrant.configure(2) do |config| | |
config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" | |
config.vm.network "forwarded_port", guest: 8000, host: 8000 | |
# note: if rolling back snapshots w/ 1.8, this may cause a lenghty re-provision | |
config.vm.provision "shell", inline: <<-SHELL | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common && \ | |
sudo apt-get -y update && \ | |
sudo add-apt-repository -y ppa:nginx/stable && \ | |
sudo apt-get -y install \ | |
git \ | |
python-setuptools \ | |
nginx \ | |
postgresql \ | |
postgresql-contrib \ | |
libpq-dev \ | |
python-dev \ | |
supervisor \ | |
nano \ | |
libffi-dev && \ | |
sudo apt-get clean && \ | |
sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
# install common python-related tools | |
sudo easy_install pip | |
sudo pip install psycopg2==2.5.3 && \ | |
sudo pip install gunicorn && \ | |
sudo pip install setproctitle | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment