“Magento DevBox” is the name for a new Magento 2 development environment under development. It is being built by Magento as a standard way to develop Magento 2 sites for developers on a local development machine (a laptop or desktop). It is built upon Docker, but should not be confused with other Docker projects intended for production usage. Docker was a convenient technology to simplify the installation of a range of services that are frequently used with Magento 2 development.
There are a number of other great community solutions out there, each with different pros and cons. If you are using one of these environments there may not be a strong reason to consider Magento DevBox instead. Magento DevBox is not “magic” – it just follows our own installation guidelines. Magento DevBox will however become the default answer from Magento for “how do I get going with Magento 2 development?”
Why Magento DevBox?
Why are we putting together Magento DevBox? As the sophistication of Magento has increased (compared to Magento 1), the number of technologies needed has also increased. We have not found an existing MAMP or WAMP like installation with the right set of tools to make local installation of such tools easy.
Another benefit of Docker containerization is it is easier to have multiple development environments installed with different versions of services (e.g. different versions of PHP and MySQL when Magento 2 changes the supported versions sometime in the future). You just start and stop the environment for the project you are working on (to reduce memory consumption). This is trickier to configure when services are installed natively.
We have also heard the having a standardized environment from Magento can improve efficiency within the community. Developers trained on a standard environment can more quickly move between projects when the same set of tools and practices are followed.
What is Magento DevBox?
Magento DevBox is a pre-made development environment for Magento 2 built using Docker. It supports a range of Magento 2 releases (CE, EE, and ECE – Enterprise Cloud Edition – although ECE is not fully available yet), including the option to load sample data (useful for testing). As well as the core web server and MySQL instance, configuration options include developing with local Redis (data cache), Varnish (page cache), Elastic search (search technology), and RabbitMQ (message queue) instances.
How does it Work?
Magento DevBox is currently built using Docker 1.12 based on their promise of lightweight containers and native file sharing.
With Magento DevBox, project source files are left on the native host file system (Mac or Windows), allowing native IDEs to access the files directly. This provides the most responsive development environment of all the variations we have tested. This also allows the DevBox environment to be destroyed and recreated at any time, without risk of loss of code.
To create a new Magento DevBox environment, an online web form is provided which asks a number of questions about what tools you want to use (e.g. do you want Redis installed). The final result is a ZIP file with all configuration settings preconfigured. You download and extract this ZIP on your local file system. This includes getting the Magento 2 code base (for new projects) and automatic injection of download keys streamlining the download experience.
There have been some bumps however. The new file sharing approach introduced in Docker 1.12 has performance issues on Mac. This has been worked around within the Docker containers for now by use of Unison to synchronize files between the mounted directory and the web server directory. This is generally transparent to developers and will be removed if Docker improves the native file system performance. The main negative is additional startup time for the initial file system sync to complete.
Windows encountered different issues in that the Docker native file system support does not support “inotify” events, plus issues with file permissions when new files are created. Inotify support is very useful for tools such as Grunt and Gulp. Currently Windows leverages Unify again, but this time synchronizing between the native Windows file system and the container. This was the best option found so far from a wide range of tested options.
Usage documentation will be released with Magento DevBox.
Who Should Try Magento DevBox?
We are interested in a range of developers trying out Magento DevBox from experts to developers completely new to Magento. The goal is to simplify development for all developers. The defaults are intended to be suitable for new developers, with more options available for experts.
One particular note is inclusion of Varnish. A very common problem that has become apparent is developers are not testing sufficiently with Varnish in place, resulting in issues only being detected at the end of a project when rolled to production. Developers are therefore encouraged to perform local development with Varnish enabled. One useful piece of feedback is whether Varnish should be enabled by default for all development as a base expectation.
Magento DevBox is going to launch as a public beta shortly. The goal is to collect wider community feedback before it becomes “official”.
One of the interesting future areas of exploration is we are also prototyping creation of training environments based on Magento DevBox. The goal is to have the same development environment available, but preloaded with a database and exercise files as a starting point for tutorials.