Photo by Headway on Unsplash

Vagrant for WebDevelopment

Today I’m going to talk about the workflow in the web development, and why is this a very, but very important topic.

First, of everything, let's talk about what is the “workflow” for web development. It’s about how to manage the different stakeholders of the project in the best possible way. I mean, we have a client, a project manager, a quality revisor, etc. And the most important of all, we have many developers.

Let’s put some unbreakable rules. Rules that exist for one or multiple reasons, I will try to explain some of them in each rule.

  • Do not work everything in the same environment.
    • Some projects, just have a domestic server, and access to it via LAN, everyone accesses to it!. It means, different developers, doing different things, a project manager occasionally checking if the website is going well. Never do that! I will explain what could happen if you do that!.
    • A server for the client. In some cases, the client comes with a cheap server that you access via Cpanel and start to modify “little” things there. And as if this were not enough, multiple developers, come and start to edit different little things…
  • Use a code versioning.
    • It could be: Git, TFS, or anything else that set a record of all the important change of the project, and at the same time, allow you to go back into that changes. The command + Z (Ctrl + Z) is not enough for go back!!
  • Work with issues:
    • An issue is something that requires some work on it, it could be a simple css correction, a functionality in the theme or a complex feature in the entire project. If you are working with code versioning, it's a good idea, to separate each version of the code, or commits, according to the issue that you are trying to resolve. The project manager will thank you for this…
  • Work with branches!
    • There is a different focus on it, and it depends. I mean, it could be a branch for the developer, a branch for the environment, or a branch for an issue. It will depend on how much criticism is the change or the functionality that you want to add to your main project. A branch could have a lot of commits, and import all that into your “master” could be dangerous, so if you separate that into a branch will be easy to administrate.  
  • Share the same language!
    • And I am not talking about the programming language. I am talking about all the idea of how the development is done. Who will create the new project, who will create a new issue, who will create a branch and who will merge it? Is more than a simple organization, everybody has to know how everything is done, not to do it itself, but for understanding the mechanic of the game.

Vagrant for web development,

Yes, the title of my post is Vagrant for web development.

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.

Obviously you can manage all the rules for development without Vagrant. But if you come from the world of a pc shared with Xampp and Dreamweaver, it will be difficult to “update” all your team into the new wave of all this.

Just to give you an idea, If you are working with Drupal and want to have everything ready for being a “pro” developer, you need to:

  1. Forget about XAMPP/WAMPP/AcquiaDevDesktop etc…
  2. Learn more about the “console”. If you are on windows, install gitbash or something to enter some commands. Yes, the cmd also work, but the documentation is more focus on Linux command line.
  3. Install and set the path for:
    • PHP
    • MySQL
    • drush
    • drupal console
    • git
    • sass or composer
    • and more… trust me, more…

And make some configurations for the virtual host.

Setup all that for all your developers, with different windows, Linux or Mac version, will be complicated, and that is if you are working with Drupal now think about angular or ionic. How many things do you need to set up!!.

With Vagrant you can create different boxes, for example, one for your Drupal development with drush, another one for your WordPress development with wp-cli ready. Imagine, in one project have PHP 7 version, and in other one have 5.6 version. And all that things can easily change just but sending a vagrantfile to the current developer.

Once the developer receives the vagrantfile and install the virtual machine, the party starts.

$ vagrant up

$ vagrant ssh

Once inside, all the git, server and any package configuration will be ready. Don't waste time setting up a machine, really, use vagrant!!.

But vagrant is just a tool. The really hard part is making your team follow the workflow and have an organized code. Not just for your internal development in the agency, but also if you want to work with some international brands and be compatible with them.

Good luck!...


And what about Docker??