A few months back someone pointed me at cloud based PHP development environments. This was a new one for me. Really? Develop PHP applications in a web browser? Zero installation required? Are you serious?
Well, after a few great technical discussions with the folks at Codeanywhere.com over the last few months, I am happy to say I am pretty impressed with how much you can achieve.
Development in the Cloud?
How do these cloud based development environments work? In the case of Codeanywhere.com, basically, you have a web browser that connects to a VM instance in the cloud. All your source code sits in the VM, not on your local computer. Inside the browser window you can run ssh, a browser based text editor, etc. So it really is zero software that needs installing on your local machine.
One of the things I thought as particularly cool was Codeanywhere.com also has an iPad application. That is, I can do serious application development just using my iPad. It was surprisingly good with an iPad Pro + smart keyboard. Another fun aspect was trying out other iPad apps like “Working Copy”, a git client for the iPad, which allows editing offline – but I will leave that for a possible future post.
Obviously cloud based solutions such as Codeanywhere.com (there are a number of others out there as well) need a network connection. This means you want a reliable network connection if this becomes your main development environment, but that is becoming less of an issue these days.
Magento 2 and Codeanywhere.com
When I first talked to Codeanywhere, they did not have Magento 2 on their list of predefined environments. I spun up a generic container, did some development in it, asked a few questions, all pretty straightforward. Basically I got it going using their generic technology – just needed a script to install all the relevant extra parts. I got introduced to their CEO around then, and bang – he came back a day later with a new working Magento 2 environment with the right versions of PHP, MySQL, and so on. Impressive! This is available on their site today. (And they have free offerings you can explore.)
For example, if you spin up an account and create a “Magento 2” container, you can connect to it via a web browser and it will take you through the Magento installation wizard. They have a version of Magento preinstalled with database server ready. Just accept the defaults for the database connection settings and when prompted enter your email address, account name, and password. You can start playing with Magento 2 using this instance directly. It’s pretty simple to get it going.
Here is a summary of the steps I took if you want to give it a try yourself.
- Pick a plan. There are free trial periods available. If you like it, I would suggest checking out the paid tiers which have more resources available. The free tiers are certainly enough to kick the tires.
- I decided to create a new project and not use the “default” project. Select “New Project” from the menu. I creatively picked “magento2” as my project name.
- In the Connection Wizard that comes up, I used the default choice of “Container”. Type in a name for the container (I picked “m2”), select “Magento 2” from the list of available stacks (you can type “magento” in the search box to find it more easily). Click “Create”.
- Over in the left side bar you should now see a project “magento2” with a container “m2” being spun up ready for use.
- To connect via a web browser, on the “info” page it will list a URL to your site. In my case it was something like http://preview.zirtlsgn9r6ytu8687ojemi.box.codeanywhere.com. Clicking on the link brings up the Magento 2 setup wizard.
Pretty darn easy.
The Complete Integration Story
So why have I not been talking about Codeanywhere.com more until now? There is the whole sequence of tooling that needed to be cleaned up. I am posting this now as I think we have that sequence pretty well sorted out. We now have
- The recommended way to manage your project in GIT (I blogged recently on this).
- Several low end production hosting solutions available. A few (such as http://cloud.godaddy.com/) use the Bitnami Magento 2 image, where the latest version includes PHP 7 by default (and they are still looking to improve it further). So not only can you do low end sites cheaply, they are fast as well.
- Magento Marketplace is almost up for purchasing extensions for your store. Once up, knocking up a small store will be even easier. Grab a prebuilt hosting solution, add a few extensions, and away you go! (Okay, some tweaking may be required to polish it up, which is where Codeanywhere.com can be useful.)
The final step was I wanted to use the Codeanywhere.com environment for developing my GoDaddy account. I did this by spinning up a public hosted site on GoDaddy cloud, saving the code it into a local git repository, pulling it over to Codeanywhere.com (replacing the default Magento 2 installation Codeanywhere.com provided), making changes (including shortly making purchases from the Marketplace), and pushing the code back to production. Sweet!
Have a look at https://github.com/alankent/docker-bitnami-development for my Codeanywhere.com installation instructions. It is still an experiment, and things may break occasionally. I am not providing production support. Also be aware that running the installation instructions will delete the current ‘magento’ directory and all of its contents! (I tried saving a backup, but the bottom end free tier ran out of disk space, so currently I just delete it all and replace with the code checked out from the GoDaddy cloud server.) After that, it’s one command (m2-pull) to download the source code from your Bitnami based cloud server (such as used by GoDaddy) to the Codeanwhere.com container, and one command (m2-push) after local edits to push the changes back again. I hide all the git commands in these scripts, which may or may not be a good long term solution. Look for a future post coming soon exploring the Docker development environment aspect of this GitHub project.
Codeanywhere.com is not as powerful as a full local development environment. I am not going to stop using PHP Storm for all development. But it is definitely a useful tool and pretty easy to use. It can be used in combination with other environments (just use the same git repository). I do think it may be of interest to lower end development shops that just want to spin up a site pretty quickly. E.g. buy an extension, try it out in a development environment, and then deploy to production. And all of this without the hassle of installing a web server, PHP, or other such tools on your laptop.
I think it is also an interesting technology for developers using PHP Storm or similar as their primary development platform. When traveling, I like leaving my heavier laptop at home. With Codeanywhere.com I can check out the same code base on my iPad and actually fix bugs and commit code back to the project. You can use it for serious development even if you resort back to PHP Storm or similar for better debugging tools.
Codeanywhere.com is another useful development tool. It looks interesting for developers who do not want hassle of installing local software. I think it could be particularly interesting for lower end developers who focus on assembling sites from existing extensions on the Magento Marketplace. And it could be another useful tool in the toolbox even for developers who are used to more sophisticated desktop development environments. For example, I can now use my iPad Pro for Magento 2 development! Kinda neat!
Disclaimer: This post represents personal experiences, not official opinions of my employer. And as above, this is still experimental and subject to change.