mage2click / docker-magento-mutagen

Mage2click Docker-based development environment for Magento with mutagen.io sync for files on macOS
https://mage2.click
MIT License
68 stars 9 forks source link
docker docker-compose elasticsearch local-development macos magento2 mailhog mariadb mutagen nginx ngrok percona php7 php70 php71 php72 rabbitmq redis varnish xdebug

The new version of Mage2click toolset
mage2click/m2c



mage2click/docker-magento-mutagen

Mage2click Docker Configuration for Magento with mutagen.io sync for files inspired by Mark Shust's markshust/docker-magento project

Supported Magento Versions Docker Hub Pulls - Nginx Docker Hub Pulls - PHP Docker Hub Pulls - Varnish Docker Hub Pulls - Elasticsearch Docker Hub Pulls - Proxy Maintained - Yes License MIT chat #mutagen-sync in Slack

Table of contents

Docker Hub

Please see available Dockerfiles on our Docker Hub Wiki page

Usage

This configuration is intended to be used as a Docker-based development environment for Magento 2.

Folders:

Prerequisites

This setup assumes you are running Docker on a computer with at least 6GB of allocated RAM, a dual-core, and an SSD hard drive. Download & Install Docker Desktop for Mac (Community Edition).

This configuration has been tested on macOS.

Mutagen

This version of Docker-based development environment with mutagen sync is working fine even if it still under development, it requires the mutagen.io to be installed on your system. See the mutagen.io/documentation/introduction/installation or use Homebrew to install it on macOS

brew install havoc-io/mutagen/mutagen

Automated Setup

Run one of the commands below from the directory you want to install your project to. Existing projects can be imported as well.

Interactive mode

curl -s https://raw.githubusercontent.com/mage2click/docker-magento-mutagen/master/lib/setup | bash -s -- -i

The -i flag above (shorthand of --interactive) defines that setup script must be launched in interactive mode.
Simply follow the steps during setup initialisation to configure resulted Magento development environment.

One-line mode

curl -s https://raw.githubusercontent.com/mage2click/docker-magento-mutagen/master/lib/setup | bash -s -- --domain=magento2.test

The --domain=magento2.test above defines the hostname to use.
Script accepts also other parameters and flags to configure resulted Magento development environment.

Parameters:

Flags:

Usage info output

curl -s https://raw.githubusercontent.com/mage2click/docker-magento-mutagen/master/lib/setup | bash -s -- -h

The -h flag above (shorthand of --help) defines that setup script must only output usage information. This command won't start the installation process.

Custom CLI Commands

Setup and Configuration CLI Commands

Admin Panel

The admin panel URL is auto-generated by the setup script. You can find the URL by using the bin/magento info:admin command. The default username is john.smith and the default password is password123.

Database

The hostname of each service is the name of the service within the docker-compose.yml file. So for example, MySQL's (based on MariaDB:10.3 Docker image) hostname is db (not localhost) when accessing it from within a Docker container. Elasticsearch's hostname is elasticsearch.

Here's an example of how to connect to the MySQL cli tool of the Docker instance:

bin/cli mysql -h db -umagento -pmagento magento

You can use the bin/clinotty helper script to import a database. This example uses the root MySQL user, and looks for the dbdump.sql file in your local host directory:

bin/clinotty mysql -hdb -umagento -pmagento magento < dbdump.sql

Composer Authentication

Get your authentication keys for Magento Marketplace. For more information about Magento Marketplace authentication, see the DevDocs.

The setup script will prompt you to provide authentication information!

To manually configure authentication, copy src/auth.json.sample to src/auth.json. Then, update the username and password values with your Magento public and private keys, respectively. Finally, copy the file to the container by running bin/copytocontainer auth.json.

Redis

Redis is now the default cache and session storage engine, and is automatically configured & enabled when running bin/setup on new installs.

Use the following lines to enable Redis on existing installs:

Enable for Cache:

bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=0

Enable for Full Page Cache:

bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=redis --page-cache-redis-db=1

Enable for Session:

bin/magento setup:config:set --session-save=redis --session-save-redis-host=redis --session-save-redis-log-level=4 --session-save-redis-db=2

You may also monitor Redis by running: bin/redis redis-cli monitor

For more information about Redis usage with Magento, see the DevDocs.

Xdebug & PHPStorm

Please see the detailed instructions of how to configure and use it on our Wiki page Xdebug & PHPStorm

Credits

Mark Shust

Certified Magento Developer & Architect and Zend Certified Engineer, and available for consulting & development of your next project 🤓. You can read technical articles on my blog at markshust.com or contact me directly at mark@shust.com.
Mark Shust's Free Course about Setup a Magento 2 Development Environment with Docker

Nexcess

A special thanks goes out to Nexcess for hosting public archives of every version of Magento 💙. I've used their Magento hosting services in the past also (both shared and enteprise offerings) and they're great, ...highly recommended!

Willem Wigman

Implemented Varnish support with https proxy Willem Wigman

Max Uroda

Certified Magento Developer (M1CDP+ / M2CAD), WebDeveloper interested in Magento/Magento2, Docker, JS, Varnish, PWA
@u_maxx
maxuroda.pro

Dmitry Shkoliar

Zend Certified PHP Engineer, Magento2, Docker, PWA, Varnish, JS, HTML5, Mobile, iOS, Android
@shkoliar
shkoliar.com

License

MIT

Maintainers