Matteo Scandolo | bf5b6a1 | 2017-02-13 11:25:07 -0800 | [diff] [blame] | 1 | Vagrant.configure("2") do |config| |
| 2 | # base image |
| 3 | config.vm.box = "ubuntu/trusty64" |
| 4 | |
| 5 | # share the folder |
| 6 | config.vm.synced_folder "../../", "/home/vagrant/cord/", create: true |
Matteo Scandolo | b03806c | 2017-03-07 16:17:53 -0800 | [diff] [blame] | 7 | config.vm.synced_folder "./cord_profile", "/home/vagrant/cord_profile/", create: true |
Matteo Scandolo | bf5b6a1 | 2017-02-13 11:25:07 -0800 | [diff] [blame] | 8 | config.vm.synced_folder ".", "/vagrant", disabled: true |
| 9 | |
| 10 | # set the frontend vm |
| 11 | config.vm.define "head-node" do |d| |
| 12 | d.vm.network "forwarded_port", guest: 9999, host: 9999 |
| 13 | d.vm.network "forwarded_port", guest: 6379, host: 6379 |
| 14 | d.vm.network "private_network", ip: "192.168.46.100" |
| 15 | d.vm.provider "virtualbox" do |vb| |
Matteo Scandolo | 4b3d768 | 2017-03-27 10:34:24 -0700 | [diff] [blame] | 16 | vb.memory = "4096" |
Matteo Scandolo | bf5b6a1 | 2017-02-13 11:25:07 -0800 | [diff] [blame] | 17 | vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] |
| 18 | vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] |
| 19 | end |
| 20 | end |
| 21 | |
| 22 | config.vm.provision "shell", privileged: false, inline: <<-SHELL |
Matteo Scandolo | 667334f | 2017-02-26 10:58:08 -0800 | [diff] [blame] | 23 | # Setup CORD tools |
Matteo Scandolo | bf5b6a1 | 2017-02-13 11:25:07 -0800 | [diff] [blame] | 24 | curl -o ~/cord-bootstrap.sh https://raw.githubusercontent.com/opencord/platform-install/master/scripts/cord-bootstrap.sh |
| 25 | bash cord-bootstrap.sh |
| 26 | ssh-keygen -t rsa -N "" -f .ssh/id_rsa |
| 27 | cp ~/.ssh/id_rsa node_key |
Matteo Scandolo | 667334f | 2017-02-26 10:58:08 -0800 | [diff] [blame] | 28 | |
| 29 | # Install apache |
| 30 | sudo apt-get update |
| 31 | sudo apt-get install -y apache2 libapache2-mod-fastcgi apache2-mpm-worker |
| 32 | sudo a2enmod proxy_http |
| 33 | sudo a2enmod headers |
| 34 | sudo a2enmod rewrite |
| 35 | sudo a2enmod proxy_wstunnel |
| 36 | |
| 37 | # Copy apache conf |
| 38 | sudo cp /home/vagrant/cord/build/platform-install/roles/head-prologue/files/cord-http.conf /etc/apache2/conf-enabled/cord-http.conf |
| 39 | |
| 40 | # Reload Apache |
| 41 | sudo service apache2 reload |
| 42 | |
| 43 | # Add hosts |
| 44 | echo "127.0.0.1 xos" | sudo tee --append /etc/hosts > /dev/null |
| 45 | echo "127.0.0.1 xos-spa-gui" | sudo tee --append /etc/hosts > /dev/null |
| 46 | echo "127.0.0.1 xos-rest-gw" | sudo tee --append /etc/hosts > /dev/null |
| 47 | echo "127.0.0.1 xos-chameleon" | sudo tee --append /etc/hosts > /dev/null |
| 48 | echo "127.0.0.1 xos-core" | sudo tee --append /etc/hosts > /dev/null |
Matteo Scandolo | bf5b6a1 | 2017-02-13 11:25:07 -0800 | [diff] [blame] | 49 | SHELL |
| 50 | |
| 51 | end |