Manage Dev with Vagrant
We looked at how to go about installing and getting up and about with a basic MEAN stack application. It required us to install required mongodb, Node etc. in your local system.
Hope fully It went well. This set up works fine for teams with one or two developers.
Typically programs used to develop your application evolve and change over time. New features are added and often times old are deprecated. This change in behavior if unchecked can lead to unexpected and inconsistent bugs. – Remember the old adage – “It works on my system”. Inconsistent bugs are hallmarks of package version dependent errors.
Most frameworks have some sort of dependency and package version management control to ensure this is reduced as best. Typically, the packages required by a project are housed in a location local to that project so that it doesn’t mess with other packages or versions required by other project.
But remember the programs we installed on the system? – Node and Mongodb? what about them?
And do you have to go about the process of getting started with MEAN every time for every developer working on the project for each project?
Seems like an ideal case for some automation.
For the purpose of integrity, any program update is to be tested before accepted. Some times a new version is simply not compatible with your code. You may be stuck with the versions currently installed. You certainly cant have that for any new projects. They’d be stuck with that version as well.
We need someway of isolating the complete development system local, global packages and all. – would be nice to be able to share that so we don’t have to start anew with each developer or a project.
Sound like a virtual system. Which is what Vagrant is.
Its a repackaged virtual box implementation for the express purpose of software virtual environment. It lets you create a virtual box for each of your projects. The idea being you open one you want to work on, work on it, when you are done and want to work on another one, close this one and open another one.
What happens in a box stays in the box.
To get started, get Vagrant here.
Most frameworks – yes including MEAN, Laravel, Phalcon, come with out of the box support for Vagrant. Vagrant calls each of such virtual boxes a .. box.
There have loads of pre-configured boxes for most tech stacks. Browse them here.
When you do have vagrant up and running and its time to select the box, try to match the dev box to what your production server technologies. Trusty seems to be the commonly used Ubuntu server installation. And always 64 bit.