Cookie Consent by Free Privacy Policy Generator Update cookies preferences

Magento 2 development on Gitpod

This article looks at a practical example of how we use Gitpod for our Adobe Commerce / Magento 2 development environments

I've been using Gitpod for Magento 2 development for 6 months now and it's really awesome.  As our agency Develo has grown the pain of wasting time setting up local development environments has multiplied and become a constant headache. 

All of our projects have at least 3 developers setup to work on it, some of the developers have a computer for home working and one at the office, so this cost for local setup is not trivial and it just lowers productivity which sucks for everyone involved. 


Looking to learn Gitpod with Magento? Checkout or course here 

Gitpod Magento course


10 reasons Why Gitpod is awesome

1. No local setup, including all of the time wasted and problems faced by developers setting up and keeping up-to-date projects locally.

2. No more switching node, npm, php versions between projects, No more databases running locally, different mysql versions or any inconsistencies between machines.

3. No heavy applications or services running on your local computer, keep your computer responsive at all times. (Well it won't help with your 100 open Chrome Tab fetish). Even the fastest M1 MacBook can be slowed by running multiple di:compile, indexer:reindex or importing or exporting databases locally.

4. Do you need to run `composer install` or `npm install` while tethering on a 4G connection? no problem!

5. Need to remotely help a colleague on their computer? You can take over their development environment in a single click.  No need to try to take remote control of their machine, as frustrating as that is!

6. Code reviews in an instant, take over a fully working separate instance of the site, dedicated to that branch only and see the code in action. 

7. Want to mess around? Do it, break the site or server environment, throw it away and boot a new one up instantly.

I could easily add 8,9 and 10 but I'll just leave it there for now, you get the point. 


We already have Docker?

Yes Docker and other local virtualisation/container managers do help with lots of the problems stated above, but they don't fix some of the core local dev issues, not everyone has super fast computers, and OS or container software version discrepancies will always cause issues at some point when you least expect it. 

Gitpod for Magento 2 

First off I'd like to say thanks to Askdjura and his work on starting the following repo, this was the inspiration for how we developed our build, you can checkout his Kitcken sink example on Github https://github.com/nemke82/magento2gitpod


His Gitpod example was great for testing out the idea, but we needed some changes to achieve a more practical development workflow. 


The ideal situation 

- A single click in Github from any context such as branch or Pull Request you work directly on that code only. 

- A fully working version build of the Magento store, with up to date database and images.

- There should be no files marked as changed in git

- Up and ready to start working on your tasks without any other input required.

- It's ready quickly, no lengthly downloads or build time.

And this is exactly what we've managed to achieve and it's awesome to use!


How Gitpod works

Gitpod is a cloud development environment platform https://www.gitpod.io . A completely isolated cloud server is setup on demand, they're not small 4-8 GB systems either, you get 64GB, fast CPU servers that don't struggle to run Magento 2. 

Each instance is given a unique URL and under HTTPS, you can easily have any ports on the server open as unique URL, either Private for you or Public where you can share the URL with anyone. 

Starting and stopping Instances

Gitpod workspaces can be stopped and started at any time, a workspace will be stopped if idle for more than an hour, or it can be extended to 3 hours idle as needed. 

Having an instance stop is not the end of the world, here are some rough estimates on start up time, from opening an instance to seeing the Magento site start in the browser. 


Start up times

- First time anyone has built a specific project : 15 mins

- Starting a project from a prebuilt image :  5 mins

- Opening a project that has been started and is idle : 10 seconds


As you can see it's very quick to get started, and the majority of the project starts are 5mins or less. 

Leon Paul


I'll be releasing a video guide, further tips & updates to this post over the rest of June, Sign up to the mailing list to be informed when that happens. ->


Ready to try it out?

1. Install the gitpod browser extension helper here 

2. Click the Gitpod button in our Github repo below, this will install Magento 2.4.3-p2.

Luma


If you enjoyed this article, read our other Learn articles to see more from our Magento developers or browse the site to see what else we do with Adobe Commerce, PunchOut Catalog and more.

Open an issue on our Github repo if you have a question, and enjoy!


...
Luke

share:

Ready to start your next project?

See how we can help you accelerate your business