All Articles

Mage2click Magento automated setup and development environment

List of contents

Ever wondered on ways of automation for easy setup of Magento local development environment? Here I will proudly highlight our project, Mage2click Magento Docker Mutagen development environment and toolset with mutagen.io sync for files. This project is directly intended to make life easier when performing Magento installation and development on MacOS systems.

Mage2click Docker Magento Mutagen

Besides of easy and configurable setup of Magento environment, it provides a rich toolset for further development and debugging. If talking in short, it includes out of the box tools like Xdebug for debugging, MailHog for catching local emails, Ngrok for sharing local environment to the internet, n98-magerun handy tools to work with Magento from the command line and much, much more.

The environment includes Redis for caching and optionally can use Varnish, Elasticsearch, and RabbitMQ of different versions of your choice.

Prerequisites

As the project is Docker-based, of course, it requires running Docker on your system. Download & Install Docker Desktop for Mac (Community Edition).

Also, it is required to have installed the mutagen.io, read the installation instructions. If you are using Homebrew, installation is as easy as running the command below.

brew install havoc-io/mutagen/mutagen

Installation

Simply create a directory where you would like to initialize the project and use one of the commands below. I would suggest using the interactive installation mode of our project. It’s like a simple questionnaire to gather information about the desired environment and based on that data perform the installation process.

Start interactive setup

curl -sL setup.m2c.run | bash -s -- -i

 
Another option is to use command like above but with specifying extra parameters to configure desired setup and skip questionnaire of interactive mode. To get more information about parameters, use command below.

Command usage information

curl -sL setup.m2c.run | bash -s

Usage

After setup is complete, all Magento source files will be located in src subdirectory of the project root. You dont need to connect into Docker containers to perform bin/magento command calls, this command can be called directly from your host machine in the project root directory!

To get an admin url, simply run bin/magento info:admin. Admin username and password are john.smith and password123 respectively.

In case if you getting unusual slow page loads, check Magento cache status by using the command bin/magento cache:status and enable cache if needed.

It’s a good practice to run bin/stop command to stop the project’s Docker containers before switching to another Docker project. It helps to avoid getting an error about unavailable ports. To get the stopped project back to active state use bin/start command.

What about with actual development process? You can open the project directory with your favorite IDE. Write some code, for example in src/app/code directory and all your code changes will be automatically synced to Docker container in real-time with lightning speed, thanks to mutagen.io sync service.

Tips and tricks

If you are using Phpstorm for developing, check the command bin/dev-urn-catalog-generate, you might find it useful. It will Generate URN’s and remap paths to your local machine. Restart PHPStorm after running this command.

With bin/setup/n98-magerun2 command you can install n98-magerun2 and use all its features with help of shorthand command bin/mr.

Needed to share your project over the web or check how it works on a real mobile device? Use bin/setup/share command to install needed dependencies. Then you can use bin/share command to share your Magento instance over the internet with the help of Ngrok secure tunnels.

Xdebug debugging is a must with Magento development. Run bin/setup/xdebug to configure xdebug on your project and after that, you can use bin/xdebug enable and bin/xdebug disable to enable and disable debugging. For more information on how to configure xdebug, please visit our project’s wiki.

For detailed information about all commands and usage, check the project’s GitHub.

Future plans

We are actively working on the project to make it better and more useful. PR’s are welcomed, stars helping the project to shine ☺. Keep an eye on the project for getting updates.

Thank you for reading!