From ba7e316a69a2c67972952ab9d5420ddf44f58a4c Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 17 Feb 2023 10:16:01 +0100 Subject: [PATCH 1/4] Prevent containers from starting if stopped manually --- env/additional/rabbitmq/docker-compose.yml | 2 +- env/docker-compose.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/env/additional/rabbitmq/docker-compose.yml b/env/additional/rabbitmq/docker-compose.yml index c062ecf..9b5e5ec 100644 --- a/env/additional/rabbitmq/docker-compose.yml +++ b/env/additional/rabbitmq/docker-compose.yml @@ -4,7 +4,7 @@ services: rabbitmq: container_name: magento2rabbitmq image: rabbitmq:3.8-management - restart: always + restart: unless-stopped ports: - "15672:15672" networks: diff --git a/env/docker-compose.yml b/env/docker-compose.yml index 27c1c7a..33c20fd 100644 --- a/env/docker-compose.yml +++ b/env/docker-compose.yml @@ -4,7 +4,7 @@ services: web: hostname: magento2.test container_name: magento2web - restart: always + restart: unless-stopped build: . environment: - PHP_IDE_CONFIG=serverName=PHPSTORM @@ -27,7 +27,7 @@ services: container_name: magento2db # MariaDB is most common in Cloud image: mariadb:10.2 - restart: always + restart: unless-stopped environment: MYSQL_DATABASE: magento MYSQL_ALLOW_EMPTY_PASSWORD: 1 From 51767b8f311aff87457149d77f61c8666f69fc21 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 17 Feb 2023 12:20:02 +0100 Subject: [PATCH 2/4] Makes the xDebug idekey option configurable from docker-compose --- env/.env.example | 1 + env/Dockerfile | 4 +++- env/docker-compose.yml | 5 ++++- env/etc/php/7.3/Dockerfile | 4 +++- env/etc/php/7.4/Dockerfile | 4 +++- env/etc/php/8.0/Dockerfile | 4 +++- env/etc/php/8.1/Dockerfile | 4 +++- 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/env/.env.example b/env/.env.example index a40ffc6..525620c 100644 --- a/env/.env.example +++ b/env/.env.example @@ -1,2 +1,3 @@ MAGENTO_CLOUD_CLI_TOKEN= COMPOSER_AUTH={"http-basic":{"repo.magento.com":{"username":"","password":""}}} +M2D_XDEBUG_IDE_KEY=PHPSTORM diff --git a/env/Dockerfile b/env/Dockerfile index b15989a..a37c8fe 100644 --- a/env/Dockerfile +++ b/env/Dockerfile @@ -83,13 +83,15 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local RUN ln -s /usr/local/bin/composer1 /usr/local/bin/composer #XDEBUG +ARG M2D_XDEBUG_IDE_KEY=PHPSTORM +ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} RUN pecl install xdebug-2.9.0 \ && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh COPY ./misc/prepare-mtf.sh /usr/local/bin/prepare-mtf.sh COPY ./misc/composer-link.sh /usr/local/bin/composer-link.sh diff --git a/env/docker-compose.yml b/env/docker-compose.yml index 33c20fd..111a252 100644 --- a/env/docker-compose.yml +++ b/env/docker-compose.yml @@ -5,7 +5,10 @@ services: hostname: magento2.test container_name: magento2web restart: unless-stopped - build: . + build: + context: . + args: + - M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} environment: - PHP_IDE_CONFIG=serverName=PHPSTORM - BLACKFIRE_CLIENT_ID diff --git a/env/etc/php/7.3/Dockerfile b/env/etc/php/7.3/Dockerfile index 99672f1..489bfba 100644 --- a/env/etc/php/7.3/Dockerfile +++ b/env/etc/php/7.3/Dockerfile @@ -78,13 +78,15 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local && apt -qy install $PHPIZE_DEPS && mkdir /${_HOME_DIRECTORY}/.composer #XDEBUG +ARG M2D_XDEBUG_IDE_KEY=PHPSTORM +ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} RUN pecl install xdebug-2.9.0 \ && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh #CODESNIFFER diff --git a/env/etc/php/7.4/Dockerfile b/env/etc/php/7.4/Dockerfile index b15989a..a37c8fe 100644 --- a/env/etc/php/7.4/Dockerfile +++ b/env/etc/php/7.4/Dockerfile @@ -83,13 +83,15 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local RUN ln -s /usr/local/bin/composer1 /usr/local/bin/composer #XDEBUG +ARG M2D_XDEBUG_IDE_KEY=PHPSTORM +ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} RUN pecl install xdebug-2.9.0 \ && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh COPY ./misc/prepare-mtf.sh /usr/local/bin/prepare-mtf.sh COPY ./misc/composer-link.sh /usr/local/bin/composer-link.sh diff --git a/env/etc/php/8.0/Dockerfile b/env/etc/php/8.0/Dockerfile index a23a670..f3376d7 100644 --- a/env/etc/php/8.0/Dockerfile +++ b/env/etc/php/8.0/Dockerfile @@ -82,13 +82,15 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local RUN ln -s /usr/local/bin/composer2 /usr/local/bin/composer #XDEBUG +ARG M2D_XDEBUG_IDE_KEY=PHPSTORM +ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} RUN pecl install xdebug-3.0.1 \ && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh COPY ./misc/composer-link.sh /usr/local/bin/composer-link.sh diff --git a/env/etc/php/8.1/Dockerfile b/env/etc/php/8.1/Dockerfile index a386150..86eb7c7 100644 --- a/env/etc/php/8.1/Dockerfile +++ b/env/etc/php/8.1/Dockerfile @@ -81,13 +81,15 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local RUN ln -s /usr/local/bin/composer2 /usr/local/bin/composer #XDEBUG +ARG M2D_XDEBUG_IDE_KEY=PHPSTORM +ENV M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} RUN pecl install xdebug \ && echo ";zend_extension=xdebug.so" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ && echo "xdebug.max_nesting_level=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ - && echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + && echo "xdebug.idekey=$M2D_XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini COPY ./misc/xdebug-php.sh /usr/local/bin/xdebug-php.sh # COMPOSER VERSION SWITCHER From aa226ae7e5ea4b7b1ff248afe132617f8f0551e4 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 17 Feb 2023 13:21:21 +0100 Subject: [PATCH 3/4] Unify base image accros php versions --- env/Dockerfile | 2 +- env/etc/php/7.3/Dockerfile | 2 +- env/etc/php/7.4/Dockerfile | 2 +- env/etc/php/8.0/Dockerfile | 2 +- env/etc/php/8.1/Dockerfile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/env/Dockerfile b/env/Dockerfile index a37c8fe..a8f1970 100644 --- a/env/Dockerfile +++ b/env/Dockerfile @@ -1,5 +1,5 @@ #PHP IMAGE -FROM php:7.4-apache-buster +FROM php:7.4-apache-bullseye #SETTING UP THE SYSTEM RUN apt-get update \ diff --git a/env/etc/php/7.3/Dockerfile b/env/etc/php/7.3/Dockerfile index 489bfba..d340549 100644 --- a/env/etc/php/7.3/Dockerfile +++ b/env/etc/php/7.3/Dockerfile @@ -1,5 +1,5 @@ #PHP IMAGE -FROM php:7.3-apache-stretch +FROM php:7.3-apache-bullseye #SETTING UP THE SYSTEM RUN apt-get update \ diff --git a/env/etc/php/7.4/Dockerfile b/env/etc/php/7.4/Dockerfile index a37c8fe..a8f1970 100644 --- a/env/etc/php/7.4/Dockerfile +++ b/env/etc/php/7.4/Dockerfile @@ -1,5 +1,5 @@ #PHP IMAGE -FROM php:7.4-apache-buster +FROM php:7.4-apache-bullseye #SETTING UP THE SYSTEM RUN apt-get update \ diff --git a/env/etc/php/8.0/Dockerfile b/env/etc/php/8.0/Dockerfile index f3376d7..b954e9b 100644 --- a/env/etc/php/8.0/Dockerfile +++ b/env/etc/php/8.0/Dockerfile @@ -1,5 +1,5 @@ #PHP IMAGE -FROM php:8.0-apache-buster +FROM php:8.0-apache-bullseye #SETTING UP THE SYSTEM RUN apt-get update \ diff --git a/env/etc/php/8.1/Dockerfile b/env/etc/php/8.1/Dockerfile index 86eb7c7..e31c9ca 100644 --- a/env/etc/php/8.1/Dockerfile +++ b/env/etc/php/8.1/Dockerfile @@ -1,5 +1,5 @@ #PHP IMAGE -FROM php:8.1-apache-buster +FROM php:8.1-apache-bullseye #SETTING UP THE SYSTEM RUN apt-get update \ From 775ab06f6548be6e9abee05270fc52291f97890b Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 17 Feb 2023 14:55:13 +0100 Subject: [PATCH 4/4] Added Opensearch --- env/.env.example | 1 + env/Makefile | 8 ++++++++ env/additional/opensearch/docker-compose.yaml | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 env/additional/opensearch/docker-compose.yaml diff --git a/env/.env.example b/env/.env.example index 525620c..06e77b1 100644 --- a/env/.env.example +++ b/env/.env.example @@ -1,3 +1,4 @@ MAGENTO_CLOUD_CLI_TOKEN= COMPOSER_AUTH={"http-basic":{"repo.magento.com":{"username":"","password":""}}} M2D_XDEBUG_IDE_KEY=PHPSTORM +M2D_OPENSEARCH_MAX_HEAP_SIZE=512m diff --git a/env/Makefile b/env/Makefile index 082932d..877b376 100644 --- a/env/Makefile +++ b/env/Makefile @@ -133,6 +133,14 @@ logs-elastic7: docker logs -f magento2elastic7 elastic7-stop: cd additional/elasticsearch7 && docker-compose stop && cd - +opensearch: + cd additional/opensearch && docker-compose up -d && cd - + # Web interface: + # http://127.0.0.1:9200 +logs-opensearch: + docker logs -f magento2opensearch +opensearch-stop: + cd additional/opensearch && docker-compose stop && cd - selenium: cd additional/selenium && docker-compose up -d && cd - # VNC open vnc://:secret@127.0.0.1:5900 diff --git a/env/additional/opensearch/docker-compose.yaml b/env/additional/opensearch/docker-compose.yaml new file mode 100644 index 0000000..b935890 --- /dev/null +++ b/env/additional/opensearch/docker-compose.yaml @@ -0,0 +1,19 @@ +version: '3' + +services: + opensearch: + image: opensearchproject/opensearch:1.2.4 + container_name: magento2opensearch + environment: + - "discovery.type=single-node" + - "plugins.security.disabled=true" + - "http.host=0.0.0.0" + - "http.port=9200" + - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx${M2D_OPENSEARCH_MAX_HEAP_SIZE:-512m}" + - "DISABLE_INSTALL_DEMO_CONFIG=true" # disable demo config see https://opensearch.org/docs/latest/opensearch/install/docker-security/ + ports: + - "9200:9200" +networks: + default: + name: env_default + external: true