The primary function of the Vagrantfile is to describe the type of machine required for a project so for this assignment VM will be created with image ubuntu/bionic64.
Script install.sh has all dependencies to bootstrap the VM
-
Copy the golang application code to app.go in local path
ex. /Users/p-jain/Documents/mywork/vagrant
-
Set the source path in vagrant file
ex. config.vm.synced_folder "/Users/p-jain/Documents/mywork/vagrant", "/home/vagrant/workspace/src"
-
Go to the path where vagrant file is available locally and execute
cd /Users/p-jain/Documents/mywork/vagrant vagrant up
-
VM with application will be provisioned in the virtualbox
-
Login to VM using command
vagrant ssh
-
Find the IP address of VM and send curl request to application
p-jain@C02D1049MD6T vagrant % curl http://172.28.128.19:8080/this/is/piyush Hello, you've requested: /this/is/piyush