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

dockergento-apache

This repository is a fork of ModestCoder's awesome Dockergento project. Dockergento is a plug and play Magento 2 dev environment with Docker and claims to have the fastest performance ever on Mac and Linux.

This fork is almost identical to Dockergento. Only the nginx web server is replaced here with an Apache 2 web server so that people whose Magento shop should be deployed on Apache can also use this tool. Furthermore, the web server used here already contains a self-signed SSL certificate for local development.

All credits go to ModestCoders: https://github.com/ModestCoders/magento2-dockergento

Most of the following paragraphs and instructions are a 1:1 copy from the original project and contain only minor changes.

Performance Comparison

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

Dockergento speed comparison

Check out all benchmarks

Learn more about how that is achieved


What is dockergento?

Dockergento is just a bash script ready to use in Linux and Mac to be able to use docker with best native performance.

While performance might no be a problem for Linux, using this tool is the only way you can overcome performance issues on Mac. Dockergento allows you to have different configuration for each system while using the same workflow. So your whole team can work the same way no matter which computer they are using. It just works!

Supported Systems

  • Mac
  • Linux

Video Tutorials

If you do not like reading and prefer watching videos. Check out all video tutorials here:


Installation

You only need 3 things on your local machine: git, docker and dockergento

Install Docker

Follow the installation steps for your system.

Mac
  1. Install Docker on Mac

  2. Configure File Sharing settings for the folder that contains your projects

    File Sharing Configuration

  3. Optionally you can also apply these performance tweaks

Linux
  1. Install docker

  2. Configure permissions

Install dockergento console

  1. Clone this repo

    git clone https://github.com/mluex/magento2-dockergento-apache.git
    
  2. Add dockergento-apache bin into your $PATH

    sudo ln -s $(pwd)/magento2-dockergento-apache/bin/dockergento-apache /usr/local/bin/
    

    Since dockergento-apache is quite long and you have to type it often, you can also assign an alias here. Example:

    sudo ln -s $(pwd)/magento2-dockergento-apache/bin/dockergento-apache /usr/local/bin/MY-ALIAS
    

    You just have to make sure that you use your alias for all following commands.

  3. Open a new terminal tab/window and check that dockergento-apache works

    which dockergento-apache
    dockergento-apache
    

Project Setup

Depending the type of project, you can use one of the following setups:

Dockerize existing project

cd <your_project>
dockergento-apache setup

New project

mkdir <new_project_name> && cd <new_project_name>
dockergento-apache setup
dockergento-apache create-project

Magento 2 github for contribution

Disclaimer: Performance on Mac is slower here due to the huge amount of files in app (~20.000 files)

Workaround to improve performance on Mac
  1. Remove these lines on docker-compose.dev.mac.yml

        - ./app:/var/www/html/app:delegated
        - ./dev:/var/www/html/dev:delegated
        - ./generated:/var/www/html/generated:delegated
        - ./pub:/var/www/html/pub:delegated
        - ./var:/var/www/html/var:delegated
    
  2. Sync app using unison container. Add this in docker-compose.dev.mac.yml

    unison:
      volumes:
        - ./app:/sync/app
    
  3. Mirror not synced folders before executing composer the first time

    dockergento-apache start
    dockergento-apache mirror-host app dev generated pub var
    
  4. If you are editing code in app, you need to start unison watcher to sync files between host and container.

    dockergento-apache watch app/code/Magento/<module_name>
    
git clone https://github.com/magento/magento2.git
cd magento2
dockergento-apache setup

Usage

Start Application

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

Open http://<your-domain> in the browser 🎉�

Workflow

See detailed documentation about development workflow with dockergento


More Documentation

Troubleshooting


Developers

Donations 🙏

ModestCoders worked very hard to implement this tool. If you find it useful and want to invite them for a beer, just click on the donation button. Thanks! 🍺

Donate

Resources

This project has been possible thanks to the following resources:

Licence

Copyright

(c) ModestCoders

Exchange of the web server: (c) mluex

About

Fastest Magento 2 Docker dev environment ever for Mac and Linux

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%