From d35642f032772c9a681b6e0b061787229ea70fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neven=20Kaji=C4=87?= Date: Wed, 5 Jul 2023 10:21:56 +0200 Subject: [PATCH 1/6] bin/docker-start initial commit --- compose/bin/docker-start | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 compose/bin/docker-start diff --git a/compose/bin/docker-start b/compose/bin/docker-start new file mode 100644 index 000000000..b049a1bf3 --- /dev/null +++ b/compose/bin/docker-start @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# https://stackoverflow.com/a/48843074 +# Open Docker, only if is not running +if (! docker stats --no-stream &> /dev/null ); then + # On Mac OS this would be the terminal command to launch Docker + open /Applications/Docker.app + #Wait until Docker daemon is running and has completed initialisation + while (! docker stats --no-stream &> /dev/null ); do + # Docker takes a few seconds to initialize + echo "* Waiting for Docker to launch..." + sleep 2 + done +fi From d636066d17a39f1bd9253573ee16bc99c333a8fb Mon Sep 17 00:00:00 2001 From: Mark Shust Date: Fri, 31 Jan 2025 18:22:10 -0500 Subject: [PATCH 2/6] 50.0.0 (#1286) --- .github/workflows/build-php-8-1.yml | 2 +- .github/workflows/build-php-8-2.yml | 2 +- .github/workflows/build-php-8-3.yml | 2 +- CHANGELOG.md | 11 +++++++++++ README.md | 6 +++--- compose/compose.dev.yaml | 4 ++-- compose/compose.yaml | 4 ++-- images/php/8.1/Dockerfile | 4 ++-- images/php/8.1/conf/php.ini | 3 +++ images/php/8.2/Dockerfile | 13 ++----------- images/php/8.2/conf/php.ini | 3 +++ images/php/8.3/Dockerfile | 4 ++-- images/php/8.3/conf/php.ini | 3 +++ images/php/8.4/Dockerfile | 14 +++++++------- images/php/8.4/conf/php.ini | 3 +++ 15 files changed, 46 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-php-8-1.yml b/.github/workflows/build-php-8-1.yml index 61e67cbce..0371e32bf 100644 --- a/.github/workflows/build-php-8-1.yml +++ b/.github/workflows/build-php-8-1.yml @@ -33,4 +33,4 @@ jobs: push: true tags: | markoshust/magento-php:8.1-fpm - markoshust/magento-php:8.1-fpm-6 + markoshust/magento-php:8.1-fpm-7 diff --git a/.github/workflows/build-php-8-2.yml b/.github/workflows/build-php-8-2.yml index 8a8068b2a..3331db835 100644 --- a/.github/workflows/build-php-8-2.yml +++ b/.github/workflows/build-php-8-2.yml @@ -33,4 +33,4 @@ jobs: push: true tags: | markoshust/magento-php:8.2-fpm - markoshust/magento-php:8.2-fpm-5 + markoshust/magento-php:8.2-fpm-6 diff --git a/.github/workflows/build-php-8-3.yml b/.github/workflows/build-php-8-3.yml index 5e8a41dd5..53b183fa9 100644 --- a/.github/workflows/build-php-8-3.yml +++ b/.github/workflows/build-php-8-3.yml @@ -33,4 +33,4 @@ jobs: push: true tags: | markoshust/magento-php:8.3-fpm - markoshust/magento-php:8.3-fpm-3 + markoshust/magento-php:8.3-fpm-4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 53208ed85..3d651e378 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [50.0.0] - 2024-01-31 + +### Added +- Added `generated` and `var` folders as mounted directories in `compose.dev.yaml` for easier debugging [PR #1284](https://github.com/markshust/docker-magento/pull/1284) +- Added options to `php.ini` to allow for automatic Xdebug profiling [PR #1284](https://github.com/markshust/docker-magento/pull/1284) + +### Updated +- Mailcatcher tagged to version 0.10.0 [PR #912](https://github.com/markshust/docker-magento/pull/912) +- Xdebug to version 3.4.1 [PR #1285](https://github.com/markshust/docker-magento/pull/1285) +- Swoole to version 6.0.0 [PR #1285](https://github.com/markshust/docker-magento/pull/1285) + ## [49.0.0] - 2024-01-15 ### Updated diff --git a/README.md b/README.md index 210c3b68e..208230403 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,9 @@ View Dockerfiles for the latest tags: - [`1.22`, `1.22-0`](images/nginx/1.22) - [`1.24`, `1.24-0`](images/nginx/1.24) - [markoshust/magento-php (Docker Hub)](https://hub.docker.com/r/markoshust/magento-php/) - - [`8.1-fpm`, `8.1-fpm-6`](images/php/8.1) - - [`8.2-fpm`, `8.2-fpm-5`](images/php/8.2) - - [`8.3-fpm`, `8.3-fpm-3`](images/php/8.3) + - [`8.1-fpm`, `8.1-fpm-7`](images/php/8.1) + - [`8.2-fpm`, `8.2-fpm-6`](images/php/8.2) + - [`8.3-fpm`, `8.3-fpm-4`](images/php/8.3) - [`8.4-fpm-dev`](images/php/8.4) - [markoshust/magento-opensearch (Docker Hub)](https://hub.docker.com/r/markoshust/magento-opensearch/) - [`1.2`, `1.2-0`](images/opensearch/1.2) diff --git a/compose/compose.dev.yaml b/compose/compose.dev.yaml index 641fc7b56..6d89d37d4 100644 --- a/compose/compose.dev.yaml +++ b/compose/compose.dev.yaml @@ -12,11 +12,11 @@ services: - ./src/dev/tools/grunt/configs:/var/www/html/dev/tools/grunt/configs:cached - ./src/nginx.conf.sample:/var/www/html/nginx.conf:cached - ./src/package.json.sample:/var/www/html/package.json:cached + - ./src/generated:/var/www/html/generated:cached + - ./src/var:/var/www/html/var:cached #- ./src/auth.json:/var/www/html/auth.json:cached #- ./src/m2-hotfixes:/var/www/html/m2-hotfixes:cached #- ./src/patches:/var/www/html/patches:cached - #- ./src/var/log:/var/www/html/var/log:cached - #- ./src/var/report:/var/www/html/var/report:cached phpfpm: volumes: *appvolumes diff --git a/compose/compose.yaml b/compose/compose.yaml index d8ac2cd9e..5f5c8501a 100644 --- a/compose/compose.yaml +++ b/compose/compose.yaml @@ -1,7 +1,7 @@ ## Mark Shust's Docker Configuration for Magento ## (https://github.com/markshust/docker-magento) ## -## Version 49.0.0 +## Version 50.0.0 ## To use SSH, see https://github.com/markshust/docker-magento#ssh ## Linux users, see https://github.com/markshust/docker-magento#linux @@ -30,7 +30,7 @@ services: #- "host.docker.internal:host-gateway" phpfpm: - image: markoshust/magento-php:8.3-fpm-3 + image: markoshust/magento-php:8.3-fpm-4 volumes: *appvolumes env_file: env/phpfpm.env #extra_hosts: *appextrahosts diff --git a/images/php/8.1/Dockerfile b/images/php/8.1/Dockerfile index e2e428620..ec5e62cee 100644 --- a/images/php/8.1/Dockerfile +++ b/images/php/8.1/Dockerfile @@ -44,8 +44,8 @@ RUN apt-get update && apt-get install -y \ RUN pecl channel-update pecl.php.net && pecl install \ redis-6.1.0 \ ssh2-1.4.1 \ - swoole-5.1.5 \ - xdebug-3.3.2 \ + swoole-6.0.0 \ + xdebug-3.4.1 \ && pecl clear-cache \ && rm -rf /tmp/pear diff --git a/images/php/8.1/conf/php.ini b/images/php/8.1/conf/php.ini index 608c5ff8e..3bfeaec4e 100644 --- a/images/php/8.1/conf/php.ini +++ b/images/php/8.1/conf/php.ini @@ -7,6 +7,9 @@ date.timezone = UTC xdebug.mode = off xdebug.client_host = host.docker.internal xdebug.idekey = PHPSTORM +xdebug.start_with_request = trigger +xdebug.output_dir = /var/www/html/var/profile +xdebug.profiler_output_name = cachegrind.out.%t.%p upload_max_filesize = 100M post_max_size = 100M diff --git a/images/php/8.2/Dockerfile b/images/php/8.2/Dockerfile index 7139aa7a2..d3c621659 100644 --- a/images/php/8.2/Dockerfile +++ b/images/php/8.2/Dockerfile @@ -41,20 +41,11 @@ RUN apt-get update && apt-get install -y \ zlib1g-dev \ && rm -rf /var/lib/apt/lists/* -#RUN pecl channel-update pecl.php.net && pecl install \ -# imagick-3.7.0 \ -# redis-6.0.2 \ -# ssh2-1.3.1 \ -# swoole-5.1.1 \ -# xdebug-3.2.2 \ -# && pecl clear-cache \ -# && rm -rf /tmp/pear - RUN pecl channel-update pecl.php.net && pecl install \ redis-6.1.0 \ ssh2-1.4.1 \ - swoole-5.1.5 \ - xdebug-3.3.2 \ + swoole-6.0.0 \ + xdebug-3.4.1 \ && pecl clear-cache \ && rm -rf /tmp/pear diff --git a/images/php/8.2/conf/php.ini b/images/php/8.2/conf/php.ini index 608c5ff8e..3bfeaec4e 100644 --- a/images/php/8.2/conf/php.ini +++ b/images/php/8.2/conf/php.ini @@ -7,6 +7,9 @@ date.timezone = UTC xdebug.mode = off xdebug.client_host = host.docker.internal xdebug.idekey = PHPSTORM +xdebug.start_with_request = trigger +xdebug.output_dir = /var/www/html/var/profile +xdebug.profiler_output_name = cachegrind.out.%t.%p upload_max_filesize = 100M post_max_size = 100M diff --git a/images/php/8.3/Dockerfile b/images/php/8.3/Dockerfile index 18563c399..a0df8c85e 100644 --- a/images/php/8.3/Dockerfile +++ b/images/php/8.3/Dockerfile @@ -44,8 +44,8 @@ RUN apt-get update && apt-get install -y \ RUN pecl channel-update pecl.php.net && pecl install \ redis-6.1.0 \ ssh2-1.4.1 \ - swoole-5.1.5 \ - xdebug-3.3.2 \ + swoole-6.0.0 \ + xdebug-3.4.1 \ && pecl clear-cache \ && rm -rf /tmp/pear diff --git a/images/php/8.3/conf/php.ini b/images/php/8.3/conf/php.ini index 608c5ff8e..3bfeaec4e 100644 --- a/images/php/8.3/conf/php.ini +++ b/images/php/8.3/conf/php.ini @@ -7,6 +7,9 @@ date.timezone = UTC xdebug.mode = off xdebug.client_host = host.docker.internal xdebug.idekey = PHPSTORM +xdebug.start_with_request = trigger +xdebug.output_dir = /var/www/html/var/profile +xdebug.profiler_output_name = cachegrind.out.%t.%p upload_max_filesize = 100M post_max_size = 100M diff --git a/images/php/8.4/Dockerfile b/images/php/8.4/Dockerfile index a38cf4401..d56c7999e 100644 --- a/images/php/8.4/Dockerfile +++ b/images/php/8.4/Dockerfile @@ -41,13 +41,13 @@ RUN apt-get update && apt-get install -y \ zlib1g-dev \ && rm -rf /var/lib/apt/lists/* -RUN pecl channel-update pecl.php.net \ - && pecl install redis-6.1.0 \ - && pecl install ssh2-1.4.1 \ - && pecl install swoole-6.0.0RC1 \ - && pecl install xdebug-3.4.0beta1 \ - && pecl clear-cache \ - && rm -rf /tmp/pear +RUN pecl channel-update pecl.php.net && pecl install \ + redis-6.1.0 \ + ssh2-1.4.1 \ + swoole-6.0.0 \ + xdebug-3.4.1 \ + && pecl clear-cache \ + && rm -rf /tmp/pear RUN imagick_branch="28f27044e435a2b203e32675e942eb8de620ee58" \ && curl -L https://github.com/Imagick/imagick/archive/$imagick_branch.zip -o imagick.zip \ diff --git a/images/php/8.4/conf/php.ini b/images/php/8.4/conf/php.ini index 608c5ff8e..3bfeaec4e 100644 --- a/images/php/8.4/conf/php.ini +++ b/images/php/8.4/conf/php.ini @@ -7,6 +7,9 @@ date.timezone = UTC xdebug.mode = off xdebug.client_host = host.docker.internal xdebug.idekey = PHPSTORM +xdebug.start_with_request = trigger +xdebug.output_dir = /var/www/html/var/profile +xdebug.profiler_output_name = cachegrind.out.%t.%p upload_max_filesize = 100M post_max_size = 100M From dc0819c2ddb0adecce52f324d9806421944f262e Mon Sep 17 00:00:00 2001 From: Dan Church Date: Tue, 25 Mar 2025 13:09:18 -0500 Subject: [PATCH 3/6] Add SSL CA integration support for Firefox Developer Edition (#830) Co-authored-by: Mark Shust --- compose/bin/setup-ssl-ca | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/compose/bin/setup-ssl-ca b/compose/bin/setup-ssl-ca index 91f48120f..5df39cb08 100755 --- a/compose/bin/setup-ssl-ca +++ b/compose/bin/setup-ssl-ca @@ -8,32 +8,38 @@ echo "System password requested to install certificate authority on host..." if [ "$(uname)" == "Darwin" ]; then sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain rootCA.pem + echo "{\"policies\": {\"Certificates\": {\"ImportEnterpriseRoots\": true}}}" | sudo tee policies.json + FIREFOX_FOUND=0 ### Check if Firefox is installed - FFoxBin="/Applications/Firefox.app/Contents/MacOS/firefox-bin" - if [ -f "$FFoxBin" ]; then - echo "{\"policies\": {\"Certificates\": {\"ImportEnterpriseRoots\": true}}}" | sudo tee policies.json + for FFoxAppDir in \ + '/Applications/Firefox.app' \ + '/Applications/Firefox Developer Edition.app' \ + ; do - ### Check if distribution directory exists - DistDirectory="/Applications/Firefox.app/Contents/Resources/distribution" - if [ ! -d "$DistDirectory" ]; then + FFoxBin=$FFoxAppDir/Contents/MacOS/firefox-bin + if [[ -f $FFoxBin ]]; then + printf 'Firefox compatible found at: %s\n' "$FFoxAppDir" >&2 + FIREFOX_FOUND=1 + + ### Copy the newly created policies.json to the Certificates directory + DistDirectory=$FFoxAppDir/Contents/Resources/distribution sudo mkdir -p "$DistDirectory" - fi - ### Move the newly created policies.json to the Certificates directory - sudo mv policies.json "$DistDirectory"/policies.json + sudo cp policies.json "$DistDirectory"/policies.json - ### Check if Certificates directory exists - CertDirectory="/Library/Application Support/Mozilla/Certificates" - if [ ! -d "$CertDirectory" ]; then - sudo mkdir -p "$CertDirectory" fi + done - ### Move the newly created .pem to the Certificates directory - sudo mv rootCA.pem "$CertDirectory"/rootCA.pem - else - sudo rm rootCA.pem + if [[ $FIREFOX_FOUND -ne 0 ]]; then + ### Copy the newly created .pem to the Certificates directory + CertDirectory='/Library/Application Support/Mozilla/Certificates' + printf 'Installing CA certificate to: %s\n' "$CertDirectory" >&2 + sudo mkdir -p "$CertDirectory" + sudo cp rootCA.pem "$CertDirectory"/rootCA.pem fi + rm -f policies.json rootCA.pem + else ### Requirement: apt install libnss3-tools From f5036f2b61454654edd13c974b799c88aeec1a3b Mon Sep 17 00:00:00 2001 From: Mark Shust Date: Tue, 25 Mar 2025 14:29:51 -0400 Subject: [PATCH 4/6] Add Orbstack --- compose/bin/docker-start | 57 +++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/compose/bin/docker-start b/compose/bin/docker-start index b049a1bf3..4038ed526 100644 --- a/compose/bin/docker-start +++ b/compose/bin/docker-start @@ -1,14 +1,53 @@ #!/usr/bin/env bash -# https://stackoverflow.com/a/48843074 -# Open Docker, only if is not running -if (! docker stats --no-stream &> /dev/null ); then - # On Mac OS this would be the terminal command to launch Docker +# Function to check if Docker daemon is running +docker_running() { + docker stats --no-stream &> /dev/null + return $? +} + +# Check if OrbStack is installed and not running +if [ -d "/Applications/OrbStack.app" ]; then + echo "* OrbStack is installed" + + if (! docker_running); then + echo "* Starting OrbStack..." + open /Applications/OrbStack.app + + # Wait until Docker daemon is running via OrbStack + while (! docker_running); do + echo "* Waiting for OrbStack to initialize Docker..." + sleep 2 + done + + echo "* Docker is now running via OrbStack" + exit 0 + else + echo "* Docker is already running (possibly via OrbStack)" + exit 0 + fi +fi + +# Check if Docker Desktop is installed +if [ -d "/Applications/Docker.app" ]; then + echo "* Docker Desktop is installed" + + # Check if Docker is running + if (! docker_running); then + echo "* Starting Docker Desktop..." open /Applications/Docker.app - #Wait until Docker daemon is running and has completed initialisation - while (! docker stats --no-stream &> /dev/null ); do - # Docker takes a few seconds to initialize - echo "* Waiting for Docker to launch..." - sleep 2 + + # Wait until Docker daemon is running + while (! docker_running); do + echo "* Waiting for Docker Desktop to initialize..." + sleep 2 done + + echo "* Docker Desktop is now running" + else + echo "* Docker is already running" + fi +else + echo "* Docker Desktop is not installed. Please install Docker Desktop or OrbStack." + exit 1 fi From e58bdd56c91ab28e37317e68232b6f463c25870c Mon Sep 17 00:00:00 2001 From: Mark Shust Date: Tue, 25 Mar 2025 14:32:54 -0400 Subject: [PATCH 5/6] Add to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 208230403..6b7c9fce9 100644 --- a/README.md +++ b/README.md @@ -321,6 +321,7 @@ It is recommended to keep your root docker config files in one repository, and y - `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/docker-compose`: Support V1 (`docker-compose`) and V2 (`docker compose`) docker compose command, and use custom configuration files, such as `compose.yml` and `compose.dev.yml` +- `bin/docker-start`: Start the Docker application (either Orbstack or Docker Desktop) - `bin/docker-stats`: Display container name and container ID, status for CPU, memory usage(in MiB and %), and memory limit of currently-running Docker containers. - `bin/download`: Download specific Magento version from Composer to the container, with optional arguments of the type ("community" [default], "enterprise", or "mageos") and version ([default] is defined in `bin/download`). Ex. `bin/download mageos` or `bin/download enterprise 2.4.7-p3` - `bin/ece-patches`: Run the Cloud Patches CLI. Ex: `bin/ece-tools apply` From 49e770340269c38f20ba376600a9b130ba0d0bed Mon Sep 17 00:00:00 2001 From: Mark Shust Date: Tue, 25 Mar 2025 14:44:03 -0400 Subject: [PATCH 6/6] Add bin/docker-start to Makefile --- compose/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/compose/Makefile b/compose/Makefile index bce726963..3f8d5289e 100644 --- a/compose/Makefile +++ b/compose/Makefile @@ -39,6 +39,7 @@ help: @echo "$(call format,dev-urn-catalog-generate,'Generate URNs for PHPStorm and remap paths to local host.')" @echo "$(call format,devconsole,'Alias for n98-magerun2 dev:console.')" @echo "$(call format,docker-compose,'Support V1 (`docker-compose`) and V2 (`docker compose`) docker compose command, and use custom configuration files.')" + @echo "$(call format,docker-start,'Start the Docker application (either Orbstack or Docker Desktop)" @echo "$(call format,docker-stats,'Display status for CPU$(comma) memory usage$(comma) and memory limit of currently-running Docker containers.')" @echo "$(call format,download,'Download & extract specific Magento version to the src directory.')" @echo "$(call format,ece-patches,'Run the Cloud Patches CLI.')"