# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.define "web" do |web|
    web.vm.box = "ubuntu/wily64"
    web.vm.network "private_network", ip: "192.168.50.4"
    web.vm.provision :shell, inline: <<installphp
        add-apt-repository -y ppa:ondrej/php >/dev/null
        apt-get -qq update 2>/dev/null
        apt-get -qq install php7.0-cli php7.0-sqlite3 php7.0-zip 2>/dev/null >/dev/null;
        start-stop-daemon -bS --quiet --make-pidfile --pidfile /var/run/zerooo.pid --startas /bin/bash -- -c "exec php -S 0:8888 -t /vagrant/public/ /vagrant/public/index.php > /var/log/zerooo.log 2>&1";
installphp
    web.vm.network "forwarded_port", guest: 8888, host: 8888
  end

  config.vm.define "vpn" do |vpn|
    vpn.vm.box = "ubuntu/wily64"
    vpn.vm.network "private_network", ip: "192.168.50.8"
    vpn.vm.synced_folder "../zer.ooo-server", "/server"
    vpn.vm.network "forwarded_port", guest: 7864, host: 7864
    vpn.vm.provision :shell, inline: <<installnode
        bash /server/main.sh all "http://192.168.50.4:8888";
installnode
  end

end
