DEV Community

John Alcher
John Alcher

Posted on

What am I missing out if I'm not using a VM/Container for my development setup?

Originally asked at Laracasts


What up peeps.

For the past few weeks, I've dabbled and played around with Docker and Homestead (a prepackaged Vagrant box with Laravel goodies) just to see what's in store. But still, I can't see how much I'm gaining for the effort when my current setup (locally installed PHP7.2+Postgres+Redis etc. on a Linux box which is pretty much identical to my production setup) already works. Can someone fill me in? Maybe I'm looking at it the wrong way.

Thanks for your input!

Top comments (9)

Collapse
 
rrampage profile image
Raunak Ramakrishnan • Edited

VMs and Containers are useful if:

  • it is difficult to recreate an environment similar to the production environment (e.g old versions of Windows / reliance on very finicky dependencies)
  • you need multiple conflicting versions of dependencies e.g software that relies on a version of glibc different from one in your system.
  • Your production environment runs a completely different OS compared to your laptop/dev machine

If you can recreate development environment easily without a VM, it is totally fine. In such cases, installing from a script or using Chef/Puppet/Ansible playbooks are also valid alternatives.

Collapse
 
dmfay profile image
Dian Fay

This is basically it; using something like Vagrant, docker-compose, or minikube for your local environment just because tends to have a pretty miserable effort:reward ratio.

Collapse
 
david_j_eddy profile image
David J Eddy

"...pretty much identical to my production..." So it is not 100% parity w/ the production machine. Wait until that one OS package changes and you up date locally, spent a month building a new feature that relies on that new OS package version but production will not be updated until next quarter and YOU have to spend weekend re-writing the feature.

"Works on my machine" ... guess you machine is production now, seriously. You work machine is not the 8 year old Thinkpad with the broken keyboard 'cause you fancy Macbook Pro now has to host that feature that only runs on your machine.

Your operations people will also greatly appreciate the effort of doing your due diligence in ensure the application install/operation/load/shutdown/etc will indeed operate as expected.

Going back to the item of environmental parity. Given the levels of abstraction required to execute even the simplest web application removing fear uncertainty and doubt (FUD) as much as possible pays off in the longer term.

Now, if your project is a small side hustle, class project, non PII proof of concept; then yes, parity is overkill. But that one time you spend all weekend stuck figuring out why a feature does not work, only to find out it is some low level OS package minor version change or slightly different API (see sed on OSX vs Ubuntu) you will come to value parity.

Hope this helps out and is not to ranty. I've been bit by this issue to many times.

Collapse
 
alchermd profile image
John Alcher

I appreciate your thoughts on this, it really gave me a new perspective on the issue.

And yeah, I agree that removing uncertainty is a good payoff for the effort. I personally haven't experienced an OS package disparity messing up my production setup, so I guess getting environment parity is a good way to make sure I never experience it at all.

Collapse
 
david_j_eddy profile image
David J Eddy

Glad I could provide a different perspective. Life everything else in life 'there is not perfect answers, only trade-offs', so I will not pretend to be dogmatic about solution options.

I hesitate to agree with "..never experience it at all.". Nothing in life (or computing) is assured.

If you are so included, feel free to message me any time.

Thread Thread
 
alchermd profile image
John Alcher

I hesitate to agree with "..never experience it at all.". Nothing in life (or computing) is assured.

Wait a second, do you mean that even if I build two identical images there's still a chance for disparity? Or you're just giving me advice and I misunderstood it lol.

Thread Thread
 
david_j_eddy profile image
David J Eddy

General life advice. :)

Collapse
 
thejoezack profile image
Joe Zack

What if you want to need an older version of redis for another project? Or a newer version of postgres? Or you want to experiment with clustering strategies?

Not only is it nice to stay in tune with prod, but it's also really flexible to develop with. You can change your entire architecture via text files, and that's pretty tough to beat!

It's also really great for experimentation. You can spin up the ELK stack with a single file and pay no attention to which version of Java or Ruby are required. In fact, you don't even need to know they are required which really lowers the "barrier to innovation".

Collapse
 
matthewbdaly profile image
Matthew Daly

I use Lando these days, and the advantages over installing the dependencies locally are:

  • Easy to change versions of dependencies, so if different projects need different versions you only need to amend the config file
  • Faster than a Vagrant VM as it's Docker-based, and easier to set up a new project
  • Preset recipes for several frameworks and applications
  • Allows you to ensure other developers working on the same project are using the same setup, eliminating "It works on my machine" issues