From 079c79e4685559359cdf5d0a79bb6addc1bd279e Mon Sep 17 00:00:00 2001 From: Mark Shust Date: Thu, 25 Apr 2024 12:18:34 -0400 Subject: [PATCH 1/5] Release 47.0.0 (#1138) Co-authored-by: Michael Lehmkuhl Co-authored-by: Jenyamba Co-authored-by: Tu Van Co-authored-by: Cid Lopes --- CHANGELOG.md | 14 +++++++++++++ compose/bin/download | 5 +++++ compose/bin/setup-ssl | 3 ++- compose/compose.dev-linux.yaml | 2 -- compose/compose.dev-ssh.yaml | 2 -- compose/compose.dev.yaml | 2 -- compose/compose.healthcheck.yaml | 2 -- compose/compose.yaml | 20 ++++++++++--------- compose/env/elasticsearch.env | 3 --- compose/env/opensearch.env | 4 ---- .../etc/install-config-mysql.php.2.4.dist | 6 ++++-- lib/template | 6 ++++++ 12 files changed, 42 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0ab25bdd..659c9eae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,20 @@ 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). +## [47.0.0] - 2024-04-25 + +### Added +- Check to ensure directory does not already exist in project directory [PR #1127](https://github.com/markshust/docker-magento/pull/1127). + +### Updated +- Remove obsolete version directive from docker compose files [PR #1125](https://github.com/markshust/docker-magento/pull/1125). +- Predefined version from 2.4.6-p4 to 2.4.7 [PR #1128](https://github.com/markshust/docker-magento/pull/1128). +- Integration testing configuration to use OpenSearch [PR #1131](https://github.com/markshust/docker-magento/pull/1131). + +### Fixed +- SSL cert generation when domain has a port included [PR #1136](https://github.com/markshust/docker-magento/pull/1136). +- OpenSearch container fails to start due to memory heap size configuration [PR #1137](https://github.com/markshust/docker-magento/pull/1137). + ## [46.1.1] - 2024-04-16 ### Fixed diff --git a/compose/bin/download b/compose/bin/download index 452fcba85..9ae09b959 100755 --- a/compose/bin/download +++ b/compose/bin/download @@ -10,6 +10,11 @@ NC='\033[0m' # No Color bin/stop +if [ -d "./bin" ]; then + echo "Error: The current directory is not empty. Please remove all contents within this directory and try again." + exit 1 +fi + bin/start --no-dev [ $? != 0 ] && echo "Failed to start Docker services" && exit diff --git a/compose/bin/setup-ssl b/compose/bin/setup-ssl index 405552735..9d8f29e3c 100755 --- a/compose/bin/setup-ssl +++ b/compose/bin/setup-ssl @@ -7,7 +7,8 @@ if ! bin/docker-compose exec -T -u root app cat /root/.local/share/mkcert/rootCA fi # Generate the certificate for the specified domain -bin/docker-compose exec -T -u root app mkcert -key-file nginx.key -cert-file nginx.crt "$@" +DOMAIN_WITHOUT_PORT=$(echo "$@" | cut -d ':' -f1) +bin/docker-compose exec -T -u root app mkcert -key-file nginx.key -cert-file nginx.crt "$DOMAIN_WITHOUT_PORT" echo "Moving key and cert to /etc/nginx/certs/..." bin/docker-compose exec -T -u root app chown app:app nginx.key nginx.crt bin/docker-compose exec -T -u root app mv nginx.key nginx.crt /etc/nginx/certs/ diff --git a/compose/compose.dev-linux.yaml b/compose/compose.dev-linux.yaml index 8df350fa0..fae7d78cb 100644 --- a/compose/compose.dev-linux.yaml +++ b/compose/compose.dev-linux.yaml @@ -1,5 +1,3 @@ -version: "3" - services: app: volumes: &appvolumes diff --git a/compose/compose.dev-ssh.yaml b/compose/compose.dev-ssh.yaml index 6744b8a54..c05c72234 100644 --- a/compose/compose.dev-ssh.yaml +++ b/compose/compose.dev-ssh.yaml @@ -1,5 +1,3 @@ -version: "3" - services: app: volumes: &appvolumes diff --git a/compose/compose.dev.yaml b/compose/compose.dev.yaml index 44d2d5114..641fc7b56 100644 --- a/compose/compose.dev.yaml +++ b/compose/compose.dev.yaml @@ -1,5 +1,3 @@ -version: "3" - services: app: volumes: &appvolumes diff --git a/compose/compose.healthcheck.yaml b/compose/compose.healthcheck.yaml index e18245944..b53891ca7 100644 --- a/compose/compose.healthcheck.yaml +++ b/compose/compose.healthcheck.yaml @@ -1,5 +1,3 @@ -version: "3" - services: app: healthcheck: diff --git a/compose/compose.yaml b/compose/compose.yaml index 2059562e9..c0e987cb0 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 46.1.1 +## Version 47.0.0 ## To use SSH, see https://github.com/markshust/docker-magento#ssh ## Linux users, see https://github.com/markshust/docker-magento#linux @@ -10,8 +10,6 @@ ## 172.17.0.1 in this file with the result of: ## docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}' -version: "3" - services: app: image: markoshust/magento-nginx:1.24-0 @@ -80,8 +78,10 @@ services: ## More info at https://github.com/markshust/docker-magento/issues/488 - "cluster.routing.allocation.disk.threshold_enabled=false" - "index.blocks.read_only_allow_delete" - ## Uncomment the following line to increase the virtual memory map count - # - "max_map_count=262144" + ## Uncomment to set custom heap size to avoid memory errors + #- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g" + ## Uncomment to increase the virtual memory map count + #- "max_map_count=262144" ## If you wish to use Elasticsearch, comment out opensearch image above and ## uncomment this block. Do the same in the composer.healthcheck.yaml file. @@ -100,8 +100,10 @@ services: # ## More info at https://github.com/markshust/docker-magento/issues/488 # - "cluster.routing.allocation.disk.threshold_enabled=false" # - "index.blocks.read_only_allow_delete" - # ## Uncomment the following line to increase the virtual memory map count - # - "max_map_count=262144" + # ## Uncomment to set custom heap size to avoid memory errors + # #- "ES_JAVA_OPTS=-Xms1g -Xmx1g" + # ## Uncomment to increase the virtual memory map count + # #- "max_map_count=262144" rabbitmq: image: markoshust/magento-rabbitmq:3.12-0 @@ -116,14 +118,14 @@ services: image: sj26/mailcatcher ports: - "1080:1080" - + ## Cloudflare tunnel support, uncomment to enable #tunnel: # container_name: cloudflared-tunnel # image: cloudflare/cloudflared:latest # command: tunnel run # env_file: env/cloudflare.env - + ## Blackfire support, uncomment to enable #blackfire: # image: blackfire/blackfire:2 diff --git a/compose/env/elasticsearch.env b/compose/env/elasticsearch.env index acc1712ee..5856225ce 100644 --- a/compose/env/elasticsearch.env +++ b/compose/env/elasticsearch.env @@ -1,5 +1,2 @@ ES_HOST=elasticsearch ES_PORT=9200 - -## Set custom heap size to avoid memory errors -ES_JAVA_OPTS="-Xms1g -Xmx1g" diff --git a/compose/env/opensearch.env b/compose/env/opensearch.env index 9ae75b55b..2a5680329 100644 --- a/compose/env/opensearch.env +++ b/compose/env/opensearch.env @@ -1,9 +1,5 @@ OPENSEARCH_HOST=opensearch OPENSEARCH_PORT=9200 -OPENSEARCH_HEALTHCHECK_TIMEOUT=100 - -## Set custom heap size to avoid memory errors -OPENSEARCH_JAVA_OPTS="-Xms1g -Xmx1g" # Prevent security patch conflicts with core M2 code DISABLE_SECURITY_PLUGIN=true diff --git a/compose/template/dev/tests/integration/etc/install-config-mysql.php.2.4.dist b/compose/template/dev/tests/integration/etc/install-config-mysql.php.2.4.dist index 68acd8359..29ae77348 100644 --- a/compose/template/dev/tests/integration/etc/install-config-mysql.php.2.4.dist +++ b/compose/template/dev/tests/integration/etc/install-config-mysql.php.2.4.dist @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + return [ 'db-host' => 'db', 'db-user' => 'magento', @@ -10,8 +11,8 @@ return [ 'db-name' => 'magento_integration_tests', 'db-prefix' => '', 'backend-frontname' => 'backend', - 'search-engine' => 'elasticsearch7', - 'elasticsearch-host' => 'elasticsearch', + 'search-engine' => 'opensearch', + 'opensearch-host' => 'opensearch', 'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, 'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, 'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, @@ -21,4 +22,5 @@ return [ 'amqp-port' => '5672', 'amqp-user' => 'magento', 'amqp-password' => 'magento', + 'consumers-wait-for-messages' => '0', ]; diff --git a/lib/template b/lib/template index 3ef44a660..8f3a4833e 100755 --- a/lib/template +++ b/lib/template @@ -3,6 +3,12 @@ git init -qqq git remote add origin https://github.com/markshust/docker-magento git fetch origin -qqq git checkout origin/master -- compose + +if [ -d "./bin" ]; then + echo "Error: The current directory is not empty. Please remove all contents within this directory and try again." + exit 1 +fi + mv compose/* ./ mv compose/.gitignore ./ mv compose/.vscode ./ From 334f51991924087e1f8ff6e02f6972f02f2c3772 Mon Sep 17 00:00:00 2001 From: bdn Date: Wed, 15 May 2024 15:10:05 +0200 Subject: [PATCH 2/5] commands for unit test simple execution added --- compose/bin/test/unit | 24 ++++++++++++++++++++++++ compose/bin/test/unit-coverage | 24 ++++++++++++++++++++++++ compose/bin/test/unit-xdebug | 24 ++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100755 compose/bin/test/unit create mode 100755 compose/bin/test/unit-coverage create mode 100755 compose/bin/test/unit-xdebug diff --git a/compose/bin/test/unit b/compose/bin/test/unit new file mode 100755 index 000000000..02850b0c5 --- /dev/null +++ b/compose/bin/test/unit @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +display_help() { + echo -e "Description: + Run unit tests + +Usage: + bin/test/unit + +Arguments: + Specify a path to your test or folder with tests Ex: bin/test/unit app/code/Vendor/Module + +Options: + -h, --help Display help message" +} + + +if [[ $1 == "-h" || $1 == "--help" ]]; then + display_help +elif [[ -z $1 ]]; then + echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)" +else + bin/php vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist /var/www/html/$1 +fi \ No newline at end of file diff --git a/compose/bin/test/unit-coverage b/compose/bin/test/unit-coverage new file mode 100755 index 000000000..b3cfa052a --- /dev/null +++ b/compose/bin/test/unit-coverage @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +display_help() { + echo -e "Description: + Generate unit tests coverage report in folder: dev/tests/unit/report + +Usage: + bin/test/unit + +Arguments: + Specify a path to your test or folder with tests Ex: bin/test/unit app/code/Vendor/Module + +Options: + -h, --help Display help message" +} + +if [[ $1 == "-h" || $1 == "--help" ]]; then + display_help +elif [[ -z $1 ]]; then + echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)" +else + bin/php -d xdebug.mode=coverage vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist --coverage-html ./dev/tests/unit/report /var/www/html/$1 + echo -e "Report path: dev/tests/unit/report" +fi \ No newline at end of file diff --git a/compose/bin/test/unit-xdebug b/compose/bin/test/unit-xdebug new file mode 100755 index 000000000..03fac445d --- /dev/null +++ b/compose/bin/test/unit-xdebug @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +display_help() { + echo -e "Description: + Run unit tests with xdebug (you need to turn on xdebug in IDE as usual) + +Usage: + bin/test/unit + +Arguments: + Specify a path to your test or folder with tests Ex: bin/test/unit app/code/Vendor/Module + +Options: + -h, --help Display help message" +} + + +if [[ $1 == "-h" || $1 == "--help" ]]; then + display_help +elif [[ -z $1 ]]; then + echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)" +else + bin/php -d xdebug.start_with_request=yes vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist /var/www/html/$1 +fi \ No newline at end of file From 7b8fbb6f4e63bdef65deb399439adc3eb45e41dd Mon Sep 17 00:00:00 2001 From: bdn Date: Wed, 15 May 2024 15:19:22 +0200 Subject: [PATCH 3/5] help message changes --- compose/bin/test/unit-coverage | 4 ++-- compose/bin/test/unit-xdebug | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compose/bin/test/unit-coverage b/compose/bin/test/unit-coverage index b3cfa052a..85a8033bb 100755 --- a/compose/bin/test/unit-coverage +++ b/compose/bin/test/unit-coverage @@ -5,10 +5,10 @@ display_help() { Generate unit tests coverage report in folder: dev/tests/unit/report Usage: - bin/test/unit + bin/test/unit-coverage Arguments: - Specify a path to your test or folder with tests Ex: bin/test/unit app/code/Vendor/Module + Specify a path to your test or folder with tests Ex: bin/test/unit-coverage app/code/Vendor/Module Options: -h, --help Display help message" diff --git a/compose/bin/test/unit-xdebug b/compose/bin/test/unit-xdebug index 03fac445d..c5d6a379c 100755 --- a/compose/bin/test/unit-xdebug +++ b/compose/bin/test/unit-xdebug @@ -5,10 +5,10 @@ display_help() { Run unit tests with xdebug (you need to turn on xdebug in IDE as usual) Usage: - bin/test/unit + bin/test/unit-xdebug Arguments: - Specify a path to your test or folder with tests Ex: bin/test/unit app/code/Vendor/Module + Specify a path to your test or folder with tests Ex: bin/test/unit-xdebug app/code/Vendor/Module Options: -h, --help Display help message" From 2462bbce3b2890ae74d9bd781232c61480ae4dac Mon Sep 17 00:00:00 2001 From: bdn Date: Wed, 15 May 2024 15:24:46 +0200 Subject: [PATCH 4/5] fixed "Double quote to prevent globbing and word splitting." --- compose/bin/test/unit | 2 +- compose/bin/test/unit-coverage | 2 +- compose/bin/test/unit-xdebug | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compose/bin/test/unit b/compose/bin/test/unit index 02850b0c5..3eea02382 100755 --- a/compose/bin/test/unit +++ b/compose/bin/test/unit @@ -20,5 +20,5 @@ if [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ -z $1 ]]; then echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)" else - bin/php vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist /var/www/html/$1 + bin/php vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist /var/www/html/"$1" fi \ No newline at end of file diff --git a/compose/bin/test/unit-coverage b/compose/bin/test/unit-coverage index 85a8033bb..544d581f3 100755 --- a/compose/bin/test/unit-coverage +++ b/compose/bin/test/unit-coverage @@ -19,6 +19,6 @@ if [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ -z $1 ]]; then echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)" else - bin/php -d xdebug.mode=coverage vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist --coverage-html ./dev/tests/unit/report /var/www/html/$1 + bin/php -d xdebug.mode=coverage vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist --coverage-html ./dev/tests/unit/report /var/www/html/"$1" echo -e "Report path: dev/tests/unit/report" fi \ No newline at end of file diff --git a/compose/bin/test/unit-xdebug b/compose/bin/test/unit-xdebug index c5d6a379c..873ec9620 100755 --- a/compose/bin/test/unit-xdebug +++ b/compose/bin/test/unit-xdebug @@ -20,5 +20,5 @@ if [[ $1 == "-h" || $1 == "--help" ]]; then elif [[ -z $1 ]]; then echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)" else - bin/php -d xdebug.start_with_request=yes vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist /var/www/html/$1 + bin/php -d xdebug.start_with_request=yes vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist /var/www/html/"$1" fi \ No newline at end of file From 724559794cda76f93579d0e0dd449ebad63ca12a Mon Sep 17 00:00:00 2001 From: Mark Shust Date: Wed, 13 Nov 2024 15:24:04 -0500 Subject: [PATCH 5/5] Added bin/test commands to README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index eed46f803..e59e280c7 100644 --- a/README.md +++ b/README.md @@ -347,6 +347,9 @@ It is recommended to keep your root docker config files in one repository, and y - `bin/status`: Check the container status. - `bin/stop`: Stop all project containers. - `bin/stopall`: Stop all docker running containers +- `bin/test/unit`: Run unit tests for a specific path. Ex. `bin/test/unit my-dir` +- `bin/test/unit-coverage`: Generate unit tests coverage reports, saved to the folder `dev/tests/unit/report`. Ex. `bin/test/unit-coverage my-dir` +- `bin/test/unit-xdebug`: Run unit tests with Xdebug. Ex. `bin/test/unit-xdebug my-dir` - `bin/update`: Update your project to the most recent version of `docker-magento`. - `bin/xdebug`: Disable or enable Xdebug. Accepts argument `disable`, `enable`, or `status`. Ex. `bin/xdebug enable`