Last night, Alan Kent posted an article to his blog. In this article, he asked for some feedback on developer environments for Magento 2. What follows is my $0.02.
Let’s start with a sad story about my position. I’ve been a pretty big proponent of Vagrant over the past two and a bit years. I’ve shown it off and recommended it to anyone who would listen. But over time, I struggled to recommend Vagrant universally.
Yes it brings a consistency to your developer environments that is highly valuable. Yes it makes it easier to set things up. But no, the time penalty that you pay for this is not trivial, and depending on who you are and what your sensibilities are, it may not be worth it for you. The glitchiness that was possible, and the terrible file syncing performance of Virtualbox took that shine away from Vagrant. Because I can’t just say “use Vagrant and your problems will go away.” Trading problems is always a harder sell.
Over the past few months, I’ve had the pleasure of trying out Docker. In a way that Vagrant never did, Docker feels like the future. I’ve been enrolled in the private beta for Mac, and it’s amazing. It’s slow, and it’s buggy, and it doesn’t work with my VPN, but it’s glorious at the same time.
It sucks right now. But like Alan, I’d be very tempted to revisit this topic in six months to a year.
Right, Max. Just make your point. What do you want Magento to do? Absolutely, 100%, Magento should have blessed development environments. We’ve invested a lot of time into building these at Redbox, and they still kind of suck in various ways.
But the correct way to do this probably isn’t to just through a Vagrantfile or a Dockerfile into the root of the project and say “that is that”.
Let me propose something here:
At which point you do your composer install thing. Alternatively:
My inspiration here is the way Docker allows different variants of its containers. Just looking at PHP, for example, there are “cli”, “cli-alpine”, “apache”, etc. They are all PHP Docker containers, but they are different variants, depending on or bundled with different vendor software.
The local development environment configuration is ancilliary to Magento, and while some level of support is good, I really do not believe that support should extend to full integration. These environments will come and go, and Magento needs to be able to adapt faster to things if they should become unsupported, or lose mindshare, whatever. If we were asked to predict how we’d be developing sites today back in 2011, I don’t think anybody would have mentioned Docker, or even Vagrant. If you were a nerd, maybe you would set up a VM. If you were conscientious, maybe you would set up a case sensitive partition on your Mac. If you were normal, then you probably used MAMP. We couldn’t have predicted what today looks like from there, and we can’t predict what the next five years hold for local development environments, either.
In the short term, release an endorsed Vagrant set up. I like some variation of the fake demo above. There are some issues to work out. Like, you have to pass the –no-install flag because you might not have PHP installed on your host.
In the long term, who knows what could happen. This time next year, we might all be talking about Otto.