diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..82c421a --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,23 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box_url = "https://atlas.hashicorp.com/ARTACK/boxes/debian-jessie" + config.vm.box = "ARTACK/debian-jessie" + + config.vm.provider "virtualbox" do |vbox,override| + vbox.customize ["modifyvm", :id, "--memory", 1024] + vbox.customize ["modifyvm", :id, "--cpus", 1] + override.vm.synced_folder ".", "/opt/demoinstance", :id => "vagrant-root", owner: "root", group: "root", :mount_options => ["dmode=777", "fmode=777"] + end + + config.vm.usable_port_range = (2200..2299) + config.vm.network "forwarded_port", guest: 8080, host: 2280, auto_correct: true + config.vm.network "forwarded_port", guest: 8081, host: 2281, auto_correct: true + + config.vm.define :master do |master| + master.vm.provision "shell" do |sh| + sh.path = "ressources/vagrant_setup.sh" + end + end +end diff --git a/ressources/vagrant_setup.sh b/ressources/vagrant_setup.sh new file mode 100644 index 0000000..3beb588 --- /dev/null +++ b/ressources/vagrant_setup.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +sudo apt-get install -y nginx python-pip supervisor python-dev libldap2-dev libsasl2-dev libmysqlclient-dev screen nodejs npm +(cd /opt/demoinstance/backend && sudo python setup.py install) +sudo cp /opt/demoinstance/ressources/supervisor_dev/*.conf /etc/supervisor/conf.d/ +cp /opt/demoinstance/ressources/dev_demoinstance /opt/demoinstance/dev_demoinstance +cp /opt/demoinstance/ressources/dev_demoinstance.py /opt/demoinstance/dev_demoinstance.py +sudo /etc/init.d/nginx stop +sudo /etc/init.d/supervisor stop +sudo rm -f /var/run/supervisor.sock +sudo rm -f /etc/nginx/sites-enabled/default +sudo cp /opt/demoinstance/ressources/nginx/nginx-server /etc/nginx/sites-enabled/default +sudo cp -R /opt/demoinstance/config /etc/demoinstance +sudo ln -s /usr/bin/nodejs /usr/bin/node +screen -S log -d -m sudo /usr/bin/supervisord -c /etc/supervisor/supervisord.conf +