Skip to content

Fastest Magento 2 Docker dev environment ever for Mac and Linux

Notifications You must be signed in to change notification settings

mluex/magento2-dockergento-apache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magento 2 Dockergento

Donate

Performance Comparison

Native performance in all OS systems (Linux, Mac and Windows)

Up to 7x faster development experience on Mac and Windows compare to standard docker setups.

Dockergento speed comparison

Check out all benchmarks

Motivation

This project aims to offer native performance on all OS systems for users that want to use docker on development. That means same speed as local setups even on Mac and Windows.

Main Features

Overcome Docker for Mac and Windows performance issues

Open to read issue explanation

From docker for mac documentation: https://docs.docker.com/docker-for-mac/troubleshoot/#known-issues

There are a number of issues with the performance of directories bind-mounted with osxfs. In particular, writes of small blocks, and traversals of large directories are currently slow. Additionally, containers that perform large numbers of directory operations, such as repeated scans of large directory trees, may suffer from poor performance. Applications that behave in this way include:

  • rake
  • ember build
  • Symfony
  • Magento
  • Zend Framework
  • PHP applications that use Composer to install dependencies in a vendor folder

As a work-around for this behavior, you can put vendor or third-party library directories in Docker volumes, perform temporary file system operations outside of osxfs mounts, and use third-party tools like Unison or rsync to synchronize between container directories and bind-mounted directories. We are actively working on osxfs performance using a number of different techniques. To learn more, see the topic on Performance issues, solutions, and roadmap.

Solution:

  • Set full magento app inside a named volume magento
  • Synchronise only git repository files between host and container.
  • Everything else is not synchronised, so performance is same as in local setups.

How do you get the code that is not synchronised in your host?

Even if not synchronised, it is needed to have magento and vendor code in your host. Not only for developing but also for xdebug.

To sync that code seamlessly, magento2-dockergento-console uses docker cp automatically when you execute relevant commands like dockergento composer or dockergento start, so you do not need to care about that.

On the other hand, for those that implement modules inside vendor, we also provide a unison container that watches and syncs changes in background when you develop inside vendor.

See dockergento workflow for a better understanding about whole development process with dockergento.

Preconditions

  1. Configure your docker File Sharing settings

    • /Users/<user>/Sites

System detailed info

Mac

File Sharing Configuration

Optionally you can also apply these performance tweaks

Windows

TODO File Sharing Configuration

Linux

TODO File Sharing Configuration

Installation

  1. Install magento2-dockergento-console

  2. Setup docker in your project:

    cd <path_to_your_project>
    dockergento setup
    
  3. [Optional] If you have a multi-store magento, you need to add your website codes to the ngnix configuration as follows:

    Open info about ngnix configuration
    • config/dockergento/nginx/conf/default.conf
    # WEBSITES MAPPING
    map $http_host $MAGE_RUN_CODE {
    
    	default    base;
    	## For multi-store configuration add here your domain-website codes
    	dominio-es.lo    es;
    	dominio-ch.lo    ch;
    	dominio-de.lo    de;
    }
    

Usage

Start Application

dockergento start
dockergento composer install
sudo vim /etc/hosts
// Add -> 127.0.0.1 <your-domain>

Workflow

See detailed documentation about development workflow with dockergento

Xdebug

Grumphp

Docker Images

ChangeLog

Developers

Resources

This project has been possible thanks to the following resources:

Licence

GNU General Public License, version 3 (GPLv3)

Copyright

(c) ModestCoders

About

Fastest Magento 2 Docker dev environment ever for Mac and Linux

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%