I’m really trying to use best-practices for dependencies management in my web apps but stuff happens. Some problems arise in production only anyways. I want to minimize this as much as possible.
I was thinking that If I can test new deployments in a virtual machine with the latest production snapshot this can solve this problem to a certain degree can’t it?
Either read only or a copy to be fiddled with.
One company I worked for had every box Dev/Test/Prod had the same base image.
Now us developers tend to get freaky and install our own custom tools etc (and I have never met a dev who did not customize their environment), but that was OK at this company: The build tools would build and deploy the code on your box in the same way that the code would have deployed in production (so that any custom tools you installed would not be accessible (by default)).
The build tools auto detected all dependencies and deployed them with your application (into the same directory (or symbolic links in your application directory)) and set up the path appropriately. The build system could also depoly to another dev’s desktop or test or prod in the exact same way with only a few extra parameters.
Another company I worked for did use virtual machines.
I did not find that environment as comfortable. The problem was that though theoretically the virtual machine was an exact replica of the prod environment that just made things harder to diagnose when things went wrong.