Vagrant.configure("2") do |config|
config.vm.define "app" do |app| ## this will create first machine named 'app'
app.vm.box = "ubuntu/bionic64" # creating a virtual machine ubuntu
app.vm.network "private_network", ip: "192.168.10.100" # add private network
app.vm.synced_folder ".", "/home/vagrant/app" # change it to your home location ## now let's sync our app folder from localhost and sync it to VM
app.vm.provision "shell", path: "provision.sh", privileged: false ## config provision file
# provide path for your provision.sh
end
config.vm.define "db" do |db| ## this will create second machine called 'db'
db.vm.box = "ubuntu/bionic64"
db.vm.network "private_network", ip: "192.168.10.150"
end
end
## Automate download of dependencies
## update & upgrade
sudo apt-get update -y
sudo apt-get upgrade -y
## Install nginx
sudo apt-get install nginx -y
sudo systemctl enable ngninx # to enable nginx
sudo systemctl start nginx # to start nginx
## Download nodejs version 6 or above
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - # to navigate the web link to download nodejs version 6 or above
## Install nodejs
sudo apt-get install nodejs -y
## Install pm2
sudo npm install pm2 -g