I am currently trying to understand the concept of Vargrant and Git in regards to completely adopting a new paradigm in workflow.
At the moment I run 4 WordPress websites on digitalocean. I develop using the more traditional (shameful) workflow: ftp. In fact, I often find myself testing new features on production VM with out a fool proof way to undo.
I understand the benefits of Vagrant, I am confused, though, on how it fits into a legitimate workflow.
This is my limited understanding:
I spin a local Vagrant Box, develop my app, use git to push to my production server.
I don’t understand:
If I change configuration files, install additional software on my local Box it doesn’t reflect in production VM automatically. I have to make note of changes that I make on this end and repeat on the other end. I am sure I am not fully exploiting the powers of vagrant and git.
Is it possible to duplicate your exact production Virtual Machine on to your local computer and actually sync the two with git? How would you describe a birds eye view for a minimum functioning workflow using Vagrant and git to achieve optimal productivity?
The answer is called configuration management. To have a local development machine that is the same as your production machine means you have to be able reproduce the configuration of the machine. Vagrant comes with good support for the two common tools Chef and Puppet (but with som small hacks it should be possible to use any others). This means all your configuration of the vagrant machine should be done through instructions with your configuration management tool, and then the same instructions can be run against your production machines. It may sound like a lot of work but there are lots of readymade well-written recipes for common software that just needs a bit of tweaking for your taste.
You know you have a reproducible development environment if you can do a vagrant destroy followed by a vagrant up and end up with the same configuration. This is the first step to be able to reproduce it onto your production environment.
This won’t really answer your question, but I would take a look at Bedrock for WordPress development using Git, Vagrant, and Capistrano.
I think their docs offer a good explanation of each tool and how to best incorporate them all into your workflow.