Skip to content

Latest commit

 

History

History
119 lines (98 loc) · 5.08 KB

README.md

File metadata and controls

119 lines (98 loc) · 5.08 KB

Magento2 Docker Environment

An Ideal Magento2 Development Environment OSX Centric. Key features of the project:

  • Simple Apache PHP container based on original images.
  • Ideal to work with multiple projects same time
  • Multi-project setup with clean host names. Based on external xip.io wildcard DNS server.
  • Provides real-time file synchronization by Mutagen
  • Includes PHPStorm container which can be rendered by X.ORG port for OSX
  • Includes great set of tools with zero configuration like Blackfire, XDebug.
  • Includes external services: ElasticSearch 2.x - 6.x, Redis, MailCatcher, RabbitMQ.
  • Provides Make tool as a wrapper. Simplify managing containers and support bash completion to hightlight commands.

Contents

Pre-requirements

Installation

You can download archive of this project on Release Page.

  • Clone or Download the repository git clone [email protected]:yvoronoy/magento2docker.git
  • Copy or create env/etc/composer/auth.json and put your Access Keys
    • cp env/etc/composer/auth.json.example env/etc/composer/auth.json
    • Edit env/etc/composer/auth.json and put your credentials Access Keys
  • Update your gitconfig if needed
    • cp env/etc/git/gitconfig.example env/etc/git/gitconfig
  • (Optional) Copy your private ssh keys, configs to have access to resources from inside container
    • cp ~/.ssh/id_rsa env/etc/ssh/
    • cp ~/.ssh/config env/etc/ssh/

Usage

Quick Start

Commands should be executed from env directory. Run make command to run environment.

# Build and mount containers
make dev

# Login on web server container
make web

How to install a magento inside container

  • Login to container make web
  • Create a directory e.g: magento2
  • Inside the magento2 directory run m2install.sh -s composer -v 2.3.3
  • Open browser and go to http://magento2.127.0.0.1.xip.io/

How to deploy dumps (backups) inside container

  • Put dumps to src folder on your host machine
    • Login to container make web
    • Run m2install.sh

How to Enable xDebug

The container already includes PHP xDebug extension. The xDebug extension is disabled by default because it is dramatically decrease performance.

Usage

  • Login to your container make web
  • Run command xdebug-php.sh 1
  • Run IDE (PHPStorm) and press button Start Listening for PHPDebug Connection

How to start using Blackfire

Blackfire Profiler is a PHP profiler and automated performance testing tool. It enables you to investigate performance issues in very simple way, just install a browser extension and press the button. You will get granular performance report to measure CPU, IO, Memory, Network, etc. Profiling with Blackfire is on-demand. This means that Blackfire adds no overhead for your end users, which makes it safe to use in production.

Get your Blackfire credentials

Blackfire provides you a free account "Hack" which allows you to run profiles on your development environment.

How to run PHPStorm inside container

Pre-requirements

  • Install and setup XQuartz
    • Install brew cask install xquartz
    • Open open -a XQuartz and go to X11 Preferences
      • Goto Security tab and check Allow connections from network clients
      • Restart computer

Usage

Run the following command inside env directory

make phpstorm

Todo List

Contributing

  1. Fork this repository.
  2. Create your feature branch: git checkout -b my-new-feature.
  3. Commit your changes: git commit -am 'Add some feature'.
  4. Push to the branch: git push origin my-new-feature.
  5. Submit a pull request.

Credits

Special thanks to @snosov and @tshabatyn who share their ideas and inspired to build this project.