Nginx(Pagespeed), MariaDB, PHP 7, Redis, Elasticsearch
This setsup containers for Magento 2.
- Good Docker Performance on MacOS by using http://docker-sync.io/
- Change settings under
.env
in root folder - Change PHP Versions 7.1, 7.2, 7.3 with xdebug all based on php:alpine docker images
- PHP, MariaDB, Redis containers connect via sockets
install.sh
can include your running project files with its DB Dump or Magento Sample Datainstall.sh
can create fresh Magento 2 Installinstall.sh
can create fresh Magento Install with Sample Data- A preconfigured
env.php
connects to mariadb via sockets, redis via sockets withinstall.sh
- Elastic Search container ist preconfigured per SQL insert/update with
install.sh
MacOS: Install Docker
Linux: Install Docker and Docker-compose.
git clone https://github.com/aliuosio/mage2.docker.git
Fresh Installation or your running project when located in your filesystem
cd mage2.docker
chmod +x ./install.sh
./install.sh
set absolute Path to a Shop Folder (Empty or Project) in installer use .env to change values after installation and activate on restart of containers
http://mage2.localhost/admin
User: mage2_admin
Password: mage2_admin123#T
http://mage2.localhost
OSX: on first run very slow due to docker-sync update of local shop files volume in the background.
See .docker-sync/daemon.log
for progress
OSX:
docker-sync start
docker-compose -f docker-compose.osx.yml up -d;
Linux:
docker-compose up -d
sudo sysctl vm.overcommit_memory=1;
echo never /sys/kernel/mm/transparent_hugepage/enabled;
sudo sysctl vm.max_map_count=262144
chmod +x sample-data.sh
./sample-data.sh
docker exec -it -u $USER mage2_php_<PHP_VERSION_SET> bash -l
Configured automatically with install.sh
In Magento 2 Backend stores
-Configuration
-Catalog
-Catalog
-Tab: Catalog Search
Search Engine: Elasticsearch 6.0+
Elasticsearch Server Hostname: elasticsearch
You MUST set sysctl -w vm.max_map_count=262144
on the docker host system or the elasticsearch container goes down
On OSX see link: https://stackoverflow.com/questions/41192680/update-max-map-count-for-elasticsearch-docker-container-mac-host?rq=1
Mail Client
http://mage2.localhost:8025
In Magento 2 Backend `stores` -`Configuration` -`Advanced` -`System`
-`Tab: SMTP Configuration and Settings (Gmail/Google/AWS/Office360 etc)`
Authentication method: NONE
SSL type: None
SMTP Host: mailhog
SMTP Port: 1025
- Fresh Install or use magento 2 project on your file system using
./install.sh
- Nginx uses http2
- alternative OSX docker-compose file using docker-sync for better performance
- set project directory to where ever you want (as configurable option in .env)
- set PHP-FPM minor Versions under 7 (7.0, 7.1, 7.2, 7.3) as configurable option
- http basic authentication
- Nginx uses Pagespeed Module
- setup valid SSL certificates with Let's Encrypt container
- Mailhog container
- Magerun2 netz98 magerun CLI tools for Magento 2
- Extra Composer Packages
- hirak/prestissimo composer package
- Extra Composer Packages with Magento 2 Installer
- magepal/magento2-gmailsmtpapp SMTP Module
- vpietri/adm-quickdevbar Developer Toolbar
- mage2tv/magento-cache-clean Cache Cleaner
- node / yarn is setup in PHP Container (Login into PHP Container for usage)
- both PHP GD and PHP Imagick are installed
- PHP Xdebug as configurable option (xdebug.idekey=docker)
- PHP Opcache enabled
- PHP redis enabled
- permissions set following Magento 2 Install Guide
- Docker letsencrypt certification Container
- make Webserver(Apache or Nginx) configurable in
install.sh
anddocker-entrypoint.sh
- rename config_blueprints to config and move config files to .docker/config
- exchange install.sh with extra docker container for magento 2 installation
- exchange sampledata.sh with extra docker container for magento 2 sampledata installation
- simplify letsencrypt certificate embedding in nginx container
- optimize pagespeed caching
- Nginx Header Config passes at https://securityheaders.com/
If you encounter any problems or bugs, please create an issue on GitHub.
Please Contribute by creating a fork of this repository.
Follow the instructions here: https://help.github.com/articles/fork-a-repo/