Why vagrant is still fruitful for developers
“This article is an upgraded version of my last article written around 18 months back. Can See the Why Vagrant and how it works”
Why vagrant is still fruitful for developers. We have much advance docker available?
Today we are leaving in the world of containers , which is independent deployable unit. Which is a bundle of code and infrastructure documentation into it. As it runs it will prepare itself and get it running. And because of the docker we are also moving in the world of micro services which gives us the flexibility to choose the best for whatever its built for. It means if Java is good for writing backend code then use Java where more security is preferred and use node where fast latency required and streaming required. Fare enough !!
The scenario we have mentioned above is really good from application perspective but from developers perspective just think for couple of scenarios
Scenario 1:
From a developer perspective most of us are from not begin our career with microservices (even someone started s/he should know the environment from closer). So we love to be into the environment while we are doing development. For example we are good with Cent OS and someone has given a windows machine. So s/he may not like the environment its really hard to change from one machine/dev environment to another (because it’s a requirement because of microservices)
Scenario 2:
I spent around four hours, when I was in the mid of the setup, I found that I have made some mistake in my first step (some configuration was not enabled ) . Now it was required to clean all the installation (which obviously will again take time, ensure nothing left and then start again).
So the problem is with time and effort made during environment switching. E.g.,:
- Time to install the softwares
- Time to uninstall the softwares, In case of any issue
- Clear/flush all the changes
- The same work to be done on each machine of every developer
- Each developer needs to start with same environment
How vagrant can help developer into this space
As per the definition from Vagrant
“Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the “works on my machine” excuse a relic of the past.”
Vagrant installation
2. Install vagrant from here.
Once you are installed both softwares you are done.
Using vagrantfile
2. Download any vagrant file (github or any place) and use it with some commands. and keep it up on any folder. From where you need to spin up a machine. Go to CMD of that folder and run the command
- vagrant up : to install and configure all the softwares on new machine
- vagrant ssh: to go inside the machine
- vagrant reload: to restart the vagrant machine
- vagrant halt: to shut down the running machine
Using vagrant plugin
• To install vagrant-scp plugin :
vagrant plugin install vagrant-scp
Here its notable that this plugin will get installed through normal command line. Not after vagrant ssh command line.
• To see which all vagrant machine are running on your host machine
vagrant global-status (you will get name)
vagrant scp [vm_name]:
vagrant scp [vm_name]:
For example:
vagrant scp kubeadm-setup-master.sh master:/home/vagrant
Chandra Shekhar
Latest posts by Chandra Shekhar (see all)
- Best practices for micro service design - January 23, 2022
- Spring Boot - January 23, 2022
- Java - January 23, 2022
Recent Comments