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.
- Pre-requirements
- Installation
- Usage
- Quick Start
- How to install a magento
- How to deploy magento dumps/backups
- How to use xDebug
- How to use Blackfire
- Pre-requirements
- Usage
- How to run PHPStorm inside container
- Todo List
- Contributing
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 Keyscp 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/
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
- 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/
- Put dumps to src folder on your host machine
- Login to container
make web
- Run
m2install.sh
- Login to container
The container already includes PHP xDebug extension. The xDebug extension is disabled by default because it is dramatically decrease performance.
- Login to your container
make web
- Run command
xdebug-php.sh 1
- Run IDE (PHPStorm) and press button Start Listening for PHPDebug Connection
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.
Blackfire provides you a free account "Hack" which allows you to run profiles on your development environment.
- Create account and login here: https://blackfire.io/login
- Install Browser Extension https://blackfire.io/docs/integrations/chrome
- Go to the page https://blackfire.io/docs/integrations/docker
- Define these environment variables from this page on the host system (OSX)
- You can save them permanently by putting them into ~/.bash_profile file
- Recreate containers by using command
make up
- 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
- Install
Run the following command inside env directory
make phpstorm
- Fork this repository.
- Create your feature branch:
git checkout -b my-new-feature
. - Commit your changes:
git commit -am 'Add some feature'
. - Push to the branch:
git push origin my-new-feature
. - Submit a pull request.
Special thanks to @snosov and @tshabatyn who share their ideas and inspired to build this project.