diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile new file mode 100644 index 00000000..6e463cf5 --- /dev/null +++ b/vagrant/Vagrantfile @@ -0,0 +1,24 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # All Vagrant configuration is done here. The most common configuration + # options are documented and commented below. For a complete reference, + # please see the online documentation at vagrantup.com. + + config.vm.box = "ubuntu/precise32" + + # Note: if it complains about guest extension versions, you can manually install them + # because each VirtualBox installation has the capability of mounting an ISO virtual + # CD to install its guest extension from. + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. + config.vm.network :forwarded_port, guest: 3306, host: 3306 + + config.vm.provision :shell, :path => "bootstrap.sh" + +end \ No newline at end of file diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh new file mode 100755 index 00000000..68ad5d39 --- /dev/null +++ b/vagrant/bootstrap.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +sudo apt-get update + +sudo apt-get clean + +sudo apt-get -y install libtool +sudo apt-get -y install python-dev libyaml-dev libffi-dev +sudo apt-get -y install python-pip + +cd /vagrant/ + +sudo pip install --upgrade pip + +# Pip moved location after upgrade from 1.0 +sudo ln -s /usr/local/bin/pip /usr/bin/pip 2>/dev/null + +sudo apt-get -y install libmysqlclient-dev + +sudo pip install --allow-external mysql-connector-python mysql-connector-python +sudo pip install --allow-external python-openfire python-openfire==0.2.3-beta +sudo pip install https://github.com/eve-val/evelink/zipball/master +sudo pip install --allow-external libffi-dev libffi-dev + +export MYSQL_ROOT_PASS=poitot + +sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASS" +sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASS" +sudo apt-get -y install mysql-server-5.5 + +#check it's up +sudo mysqladmin status -p$MYSQL_ROOT_PASS + +echo 'Creating databases and allianceauth user' +sudo mysqladmin -p$MYSQL_ROOT_PASS create alliance_auth +sudo mysqladmin -p$MYSQL_ROOT_PASS create alliance_forum +sudo mysqladmin -p$MYSQL_ROOT_PASS create alliance_mumble + +sudo mysql -u root -p$MYSQL_ROOT_PASS -e "CREATE USER 'allianceauth'@'localhost' IDENTIFIED BY 'allianceauth'" +sudo mysql -u root -p$MYSQL_ROOT_PASS -e "GRANT ALL PRIVILEGES ON * . * TO 'allianceauth'@'localhost'"; + +sudo mysqladmin -p$MYSQL_ROOT_PASS flush-privileges + +sudo apt-get -y install rabbitmq-server + +sudo pip install -r requirements.txt + +chmod +x *.sh + +echo '--------' +echo 'Almost there!' +echo 'Next steps:\n' +echo '1. Adjust mysql root password if you feel so inclined.' +echo '2. Adjust all the stuff in ./alliance_auth/settings.py.' +echo '3. Run sudo python manage.py syncdb to set up the database tables' +echo "4. run cd /vagrant/; ./startup.sh to start, and ./shutdown.sh to stop." +echo '--------' diff --git a/vagrant/shutdown.sh b/vagrant/shutdown.sh new file mode 100755 index 00000000..4743ed09 --- /dev/null +++ b/vagrant/shutdown.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +ps ww | grep 'manage.py' | grep -v grep | awk '{print $1}' | xargs kill diff --git a/vagrant/startup.sh b/vagrant/startup.sh new file mode 100755 index 00000000..54999021 --- /dev/null +++ b/vagrant/startup.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# TODO route log output to file. +python manage.py syncdb + +python manage.py shell < run_alliance_corp_update.py + +python manage.py celeryd --verbosity=2 --loglevel=DEBUG & +python manage.py celerybeat --verbosity=2 --loglevel=DEBUG & + +python manage.py runserver &