|
@@ -3,6 +3,7 @@
|
|
|
<div align="center">
|
|
|
<p>Mark Shust's Docker Configuration for Magento</p>
|
|
|
<img src="https://img.shields.io/badge/magento-2.X-brightgreen.svg?logo=magento&longCache=true&style=flat-square" alt="Supported Magento Versions" />
|
|
|
+ <img src="https://img.shields.io/badge/apple%20silicon%20support-coming%20soon-yellow" alt="Apple Silicon Support" />
|
|
|
<a href="https://hub.docker.com/r/markoshust/magento-nginx/" target="_blank"><img src="https://img.shields.io/docker/pulls/markoshust/magento-nginx.svg?label=nginx%20docker%20pulls" alt="Docker Hub Pulls - Nginx" /></a>
|
|
|
<a href="https://hub.docker.com/r/markoshust/magento-php/" target="_blank"><img src="https://img.shields.io/docker/pulls/markoshust/magento-php.svg?label=php%20docker%20pulls" alt="Docker Hub Pulls - PHP" /></a>
|
|
|
<a href="https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity" target="_blank"><img src="https://img.shields.io/badge/maintained%3F-yes-brightgreen.svg?style=flat-square" alt="Maintained - Yes" /></a>
|
|
@@ -11,8 +12,8 @@
|
|
|
|
|
|
## Table of contents
|
|
|
|
|
|
-- [Free Course](#free-course)
|
|
|
- [Docker Hub](#docker-hub)
|
|
|
+- [Free Course](#free-course)
|
|
|
- [Usage](#usage)
|
|
|
- [Prerequisites](#prerequisites)
|
|
|
- [Setup](#setup)
|
|
@@ -22,61 +23,6 @@
|
|
|
- [Credits](#credits)
|
|
|
- [License](#license)
|
|
|
|
|
|
-## Free Course
|
|
|
-
|
|
|
-This course is sponsored by <a href="https://m.academy" target="_blank">M.academy</a>. Level up your Magento 2 skills with a collection of resources including lessons, courses & more.
|
|
|
-
|
|
|
-<a href="https://m.academy" target="_blank"><img src="https://raw.githubusercontent.com/markshust/docker-magento/master/docs/macademy-logo.png" alt="M.academy"></a>
|
|
|
-
|
|
|
-A free screencast course is available, which details the basic usage of this project:
|
|
|
-
|
|
|
-<a href="https://m.academy/courses/setup-magento-2-development-environment-docker" target="_blank">
|
|
|
-<img src="https://raw.githubusercontent.com/markshust/docker-magento/master/docs/course.png" alt="Course image"><br />
|
|
|
-<br />
|
|
|
-Setup a Magento 2 Development Environment with Docker
|
|
|
-</a>
|
|
|
-
|
|
|
-### Course Curriculm
|
|
|
-
|
|
|
-#### Project Setup
|
|
|
-
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9205849" target="_blank">Setup Docker for Mac & configure preferences</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9273365" target="_blank">Setup global Composer auth credentials</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/8974570" target="_blank">Automated setup for new installs</a>
|
|
|
-
|
|
|
-#### Helper Scripts
|
|
|
-
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064258" target="_blank">Run CLI commands within containers</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9331008" target="_blank">Stop, start & restart containers</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064269" target="_blank">Run binaries within containers</a>
|
|
|
-
|
|
|
-#### Docker Filesystem & Volumes
|
|
|
-
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064334" target="_blank">Understand volumes & host bind mounts</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064338" target="_blank">Manage files & folders on containers</a>
|
|
|
-
|
|
|
-#### Customize Server Configuration
|
|
|
-
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064349" target="_blank">Customize the Nginx configuration</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064356" target="_blank">Quickly switch PHP versions</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064350" target="_blank">Install extensions & packages</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064477" target="_blank">Run additional services as containers</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/14780970" target="_blank">Configure multi-store instances</a>
|
|
|
-
|
|
|
-#### PHPStorm & Xdebug
|
|
|
-
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9748834" target="_blank">Setup PHPStorm for a Magento Docker project</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9763893" target="_blank">Generate XML URNs for a Magento Docker project</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064478" target="_blank">Install Xdebug browser plugin</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064482" target="_blank">Enable, disable, & check Xdebug</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064615" target="_blank">Configure PHPStorm for Xdebug</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064617" target="_blank">Trigger Xdebug breakpoints with PHPStorm</a>
|
|
|
-
|
|
|
-#### Manual Setup (Optional)
|
|
|
-
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9064259" target="_blank">Manual setup for new Magento installs</a>
|
|
|
-- <a href="https://courses.m.academy/courses/setup-magento-2-development-environment-docker/lectures/9283467" target="_blank">Manual setup for an existing Magento instance</a>
|
|
|
-
|
|
|
## Docker Hub
|
|
|
|
|
|
View Dockerfiles:
|
|
@@ -92,14 +38,22 @@ View Dockerfiles:
|
|
|
- 8.0 (available for alpha testing)
|
|
|
- [`8.0-fpm-develop`](https://github.com/markshust/docker-magento/tree/master/images/php/8.0)
|
|
|
- 7.4
|
|
|
- - [`7.4-fpm`, `7.4-fpm-5`](https://github.com/markshust/docker-magento/tree/master/images/php/7.4)
|
|
|
+ - [`7.4-fpm`, `7.4-fpm-9`](https://github.com/markshust/docker-magento/tree/master/images/php/7.4)
|
|
|
+ - [`7.4-fpm-8`](https://github.com/markshust/docker-magento/tree/39.0.2/images/php/7.4)
|
|
|
+ - [`7.4-fpm-7`](https://github.com/markshust/docker-magento/tree/39.0.0/images/php/7.4)
|
|
|
+ - [`7.4-fpm-6`](https://github.com/markshust/docker-magento/tree/38.0.0/images/php/7.4)
|
|
|
+ - [`7.4-fpm-5`](https://github.com/markshust/docker-magento/tree/37.0.2/images/php/7.4)
|
|
|
- [`7.4-fpm-4`](https://github.com/markshust/docker-magento/tree/36.0.2/images/php/7.4)
|
|
|
- [`7.4-fpm-3`](https://github.com/markshust/docker-magento/tree/36.0.1/images/php/7.4)
|
|
|
- [`7.4-fpm-2`](https://github.com/markshust/docker-magento/tree/34.2.0/images/php/7.4)
|
|
|
- [`7.4-fpm-1`](https://github.com/markshust/docker-magento/tree/34.1.0/images/php/7.4)
|
|
|
- [`7.4-fpm-0`](https://github.com/markshust/docker-magento/tree/33.0.0/images/php/7.4)
|
|
|
- 7.3
|
|
|
- - [`7.3-fpm`, `7.3-fpm-12`](https://github.com/markshust/docker-magento/tree/master/images/php/7.3)
|
|
|
+ - [`7.3-fpm`, `7.3-fpm-16`](https://github.com/markshust/docker-magento/tree/master/images/php/7.3)
|
|
|
+ - [`7.3-fpm-15`](https://github.com/markshust/docker-magento/tree/39.0.2/images/php/7.3)
|
|
|
+ - [`7.3-fpm-14`](https://github.com/markshust/docker-magento/tree/39.0.0/images/php/7.3)
|
|
|
+ - [`7.3-fpm-13`](https://github.com/markshust/docker-magento/tree/38.0.0/images/php/7.3)
|
|
|
+ - [`7.3-fpm-12`](https://github.com/markshust/docker-magento/tree/37.0.2/images/php/7.3)
|
|
|
- [`7.3-fpm-11`](https://github.com/markshust/docker-magento/tree/36.0.2/images/php/7.3)
|
|
|
- [`7.3-fpm-10`](https://github.com/markshust/docker-magento/tree/36.0.1/images/php/7.3)
|
|
|
- [`7.3-fpm-9`](https://github.com/markshust/docker-magento/tree/34.2.0/images/php/7.3)
|
|
@@ -114,11 +68,63 @@ View Dockerfiles:
|
|
|
- [`7.3-fpm-0`](https://github.com/markshust/docker-magento/tree/24.2.0/images/php/7.3)
|
|
|
- [markoshust/magento-elasticsearch (Docker Hub)](https://hub.docker.com/r/markoshust/magento-elasticsearch/)
|
|
|
- 7
|
|
|
+ - [`7.9`, `7.9.3-0`](https://github.com/markshust/docker-magento/tree/master/images/elasticsearch/7.9)
|
|
|
- [`7.7`, `7.7.1-0`](https://github.com/markshust/docker-magento/tree/master/images/elasticsearch/7.7)
|
|
|
- [`7.6`, `7.6.2-2`](https://github.com/markshust/docker-magento/tree/35.0.0/images/elasticsearch/7.6)
|
|
|
- [`7.6.2-1`](https://github.com/markshust/docker-magento/tree/32.0.0/images/elasticsearch/7.6)
|
|
|
- [`7.6.2-0`](https://github.com/markshust/docker-magento/tree/31.0.2/images/elasticsearch/7.6)
|
|
|
|
|
|
+## Free Course
|
|
|
+
|
|
|
+This course is sponsored by <a href="https://m.academy" target="_blank">M.academy</a>, the simplest way to learn Magento.
|
|
|
+
|
|
|
+<a href="https://m.academy" target="_blank"><img src="https://raw.githubusercontent.com/markshust/docker-magento/master/docs/macademy-logo.png" alt="M.academy"></a>
|
|
|
+
|
|
|
+A free screencast course is available, which details the basic usage of this project: <a href="https://m.academy/courses/set-up-magento-2-development-environment-docker" target="_blank">
|
|
|
+Set Up a Magento 2 Development Environment with Docker
|
|
|
+</a>
|
|
|
+
|
|
|
+### Course Curriculm
|
|
|
+
|
|
|
+#### Project Setup
|
|
|
+
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9205849" target="_blank">Setup Docker for Mac & configure preferences</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9273365" target="_blank">Setup global Composer auth credentials</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/8974570" target="_blank">Automated setup for new installs</a>
|
|
|
+
|
|
|
+#### Helper Scripts
|
|
|
+
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064258" target="_blank">Run CLI commands within containers</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9331008" target="_blank">Stop, start & restart containers</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064269" target="_blank">Run binaries within containers</a>
|
|
|
+
|
|
|
+#### Docker Filesystem & Volumes
|
|
|
+
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064334" target="_blank">Understand volumes & host bind mounts</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064338" target="_blank">Manage files & folders on containers</a>
|
|
|
+
|
|
|
+#### Customize Server Configuration
|
|
|
+
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064349" target="_blank">Customize the Nginx configuration</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064356" target="_blank">Quickly switch PHP versions</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064350" target="_blank">Install extensions & packages</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064477" target="_blank">Run additional services as containers</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/14780970" target="_blank">Configure multi-store instances</a>
|
|
|
+
|
|
|
+#### PHPStorm & Xdebug
|
|
|
+
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9748834" target="_blank">Setup PHPStorm for a Magento Docker project</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9763893" target="_blank">Generate XML URNs for a Magento Docker project</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064478" target="_blank">Install Xdebug browser plugin</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064482" target="_blank">Enable, disable, & check Xdebug</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064615" target="_blank">Configure PHPStorm for Xdebug</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064617" target="_blank">Trigger Xdebug breakpoints with PHPStorm</a>
|
|
|
+
|
|
|
+#### Manual Setup (Optional)
|
|
|
+
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9064259" target="_blank">Manual setup for new Magento installs</a>
|
|
|
+- <a href="https://courses.m.academy/courses/set-up-magento-2-development-environment-docker/lectures/9283467" target="_blank">Manual setup for an existing Magento instance</a>
|
|
|
+
|
|
|
## Usage
|
|
|
|
|
|
This configuration is intended to be used as a Docker-based development environment for Magento 2.
|
|
@@ -132,7 +138,7 @@ Folders:
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
-This setup assumes you are running Docker on a computer with at least 4GB of allocated RAM, a dual-core, and an SSD hard drive. [Download & Install Docker Desktop](https://www.docker.com/products/docker-desktop).
|
|
|
+This setup assumes you are running Docker on a computer with at least 6GB of RAM allocated to Docker, a dual-core, and an SSD hard drive. [Download & Install Docker Desktop](https://www.docker.com/products/docker-desktop).
|
|
|
|
|
|
This configuration has been tested on Mac & Linux. Windows is supported through the use of Docker on WSL.
|
|
|
|
|
@@ -143,10 +149,10 @@ This configuration has been tested on Mac & Linux. Windows is supported through
|
|
|
Run this automated one-liner from the directory you want to install your project.
|
|
|
|
|
|
```bash
|
|
|
-curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.2
|
|
|
+curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.3
|
|
|
```
|
|
|
|
|
|
-The `magento.test` above defines the hostname to use, and the `2.4.2` defines the Magento version to install. Note that since we need a write to `/etc/hosts` for DNS resolution, you will be prompted for your system password during setup.
|
|
|
+The `magento.test` above defines the hostname to use, and the `2.4.3` defines the Magento version to install. Note that since we need a write to `/etc/hosts` for DNS resolution, you will be prompted for your system password during setup.
|
|
|
|
|
|
After the one-liner above completes running, you should be able to access your site at `https://magento.test`.
|
|
|
|
|
@@ -170,7 +176,7 @@ Same result as the one-liner above. Just replace `magento.test` references with
|
|
|
curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
|
|
|
|
|
|
# Download the version of Magento you want to use with:
|
|
|
-bin/download 2.4.2
|
|
|
+bin/download 2.4.3
|
|
|
|
|
|
# or for Magento core development:
|
|
|
# docker-compose -f docker-compose.yml up -d
|
|
@@ -242,8 +248,7 @@ It is recommended to keep your root docker config files in one repository, and y
|
|
|
- `bin/copytocontainer`: Copy folders or files from host to container. Ex. `bin/copytocontainer --all`
|
|
|
- `bin/dev-urn-catalog-generate`: Generate URN's for PHPStorm and remap paths to local host. Restart PHPStorm after running this command.
|
|
|
- `bin/devconsole`: Alias for `bin/n98-magerun2 dev:console`
|
|
|
-- `bin/devtools-cli-check`: Check & install the CLI devtools if missing from system.
|
|
|
-- `bin/download`: Download specific Magento version from Composer to `/var/www/html` directory within the container. Ex. `bin/download 2.4.2 community`
|
|
|
+- `bin/download`: Download specific Magento version from Composer to `/var/www/html` directory within the container. Ex. `bin/download 2.4.3 community`
|
|
|
- `bin/fixowns`: This will fix filesystem ownerships within the container.
|
|
|
- `bin/fixperms`: This will fix filesystem permissions within the container.
|
|
|
- `bin/grunt`: Run the grunt binary. Ex. `bin/grunt exec`
|
|
@@ -304,15 +309,24 @@ You also can use `bin/mysqldump` to export the database. The file will appear in
|
|
|
bin/mysqldump > backups/magento.sql
|
|
|
```
|
|
|
|
|
|
+> Getting an "Access denied, you need (at least one of) the SUPER privilege(s) for this operation." message when running one of the above lines? Try running it as root with:
|
|
|
+> ```
|
|
|
+> bin/clinotty mysql -hdb -uroot -pmagento magento < src/backup.sql
|
|
|
+> ```
|
|
|
+> You can also remove the DEFINER lines from the MySQL backup file with:
|
|
|
+> ```
|
|
|
+> sed 's/\sDEFINER=`[^`]*`@`[^`]*`//g' -i src/backup.sql
|
|
|
+> ```
|
|
|
+
|
|
|
### Composer Authentication
|
|
|
|
|
|
First setup Magento Marketplace authentication (details in the [DevDocs](http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html)).
|
|
|
|
|
|
Copy `src/auth.json.sample` to `src/auth.json`. Then, update the username and password values with your Magento public and private keys, respectively. Finally, copy the file to the container by running `bin/copytocontainer auth.json`.
|
|
|
|
|
|
-### Email / Mailhog
|
|
|
+### Email / Mailcatcher
|
|
|
|
|
|
-View emails sent locally through Mailhog by visiting [http://{yourdomain}:8025](http://{yourdomain}:8025)
|
|
|
+View emails sent locally through Mailcatcher by visiting [http://{yourdomain}:1080](http://{yourdomain}:1080). During development, it's easiest to test emails using a third-party module such as [https://github.com/mageplaza/magento-2-smtp](Mageplaza's SMTP module). Set the mailserver host to `mailcatcher` and port to `1080`.
|
|
|
|
|
|
### Redis
|
|
|
|
|
@@ -379,7 +393,11 @@ Otherwise, this project now automatically sets up Xdebug support with VS Code. I
|
|
|
|
|
|
Running Docker on Linux should be pretty straight-forward. Note that you need to run some [post install commands](https://docs.docker.com/install/linux/linux-postinstall/) as well as [installing Docker Compose](https://docs.docker.com/compose/install/). These steps are taken care of automatically with Docker Desktop, but not on Linux.
|
|
|
|
|
|
-Be sure to see the "Linux only" documentation in the [docker-compose.dev.yml](https://github.com/markshust/docker-magento/blob/master/compose/docker-compose.dev.yml#L30) file. The `extra_hosts` param is required to be defined on Linux for proper DNS resolution.
|
|
|
+The `host.docker.internal` hostname is [hard-coded in the php.ini file](https://github.com/markshust/docker-magento/blob/master/images/php/7.4/conf/php.ini#L8), but this hostname does not exist on Linux. To make this hostname resolve, uncomment the `extra_hosts` param in the `docker-compose.dev.yml` file, and replace `IP` with result of:
|
|
|
+
|
|
|
+```
|
|
|
+docker run --rm alpine ip route | awk 'NR==1 {print $3}'
|
|
|
+```
|
|
|
|
|
|
You may also have to increase a virtual memory map count on the host system. It is required by [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html).
|
|
|
|
|
@@ -389,7 +407,7 @@ Add following line to `/etc/sysctl.conf`:
|
|
|
vm.max_map_count=262144
|
|
|
```
|
|
|
|
|
|
-To enable Xdebug on linux, you'll also need to open port 9001 on the firewall with:
|
|
|
+To enable Xdebug on Linux, you'll also need to open port 9001 on the firewall by running:
|
|
|
|
|
|
```
|
|
|
sudo iptables -A INPUT -p tcp --dport 9001 -j ACCEPT
|
|
@@ -415,7 +433,7 @@ Finally, restart the containers with `bin/restart`. After doing so, everything i
|
|
|
|
|
|
### M.academy
|
|
|
|
|
|
-This course is sponsored by <a href="https://m.academy" target="_blank">M.academy</a>, which offers lessons and courses 100% dedicated to Magento 2.
|
|
|
+This course is sponsored by <a href="https://m.academy" target="_blank">M.academy</a>, the simplest way to learn Magento.
|
|
|
|
|
|
<a href="https://m.academy" target="_blank"><img src="https://raw.githubusercontent.com/markshust/docker-magento/master/docs/macademy-logo.png" alt="M.academy"></a>
|
|
|
|