Skip to content

Commit

Permalink
Merge pull request #48 from glo47154/feature/rc-2.1.0
Browse files Browse the repository at this point in the history
Features:

- Prevent containers from starting if stopped manually.
- Makes the xDebug idekey option configurable from docker-compose via M2D_XDEBUG_IDE_KEY variable.
- Unify base image accros php versions. Now all PHP containers are based on apache-bullseye.
- Added OpenSearch 1.2.4. Max heap size can be configured with the M2D_OPENSEARCH_MAX_HEAP_SIZE variable.
  • Loading branch information
glo47154 authored Feb 17, 2023
2 parents 2d0d3fb + 775ab06 commit ad065c1
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 14 deletions.
2 changes: 2 additions & 0 deletions env/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +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
6 changes: 4 additions & 2 deletions env/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions env/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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://:[email protected]:5900
Expand Down
19 changes: 19 additions & 0 deletions env/additional/opensearch/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion env/additional/rabbitmq/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
rabbitmq:
container_name: magento2rabbitmq
image: rabbitmq:3.8-management
restart: always
restart: unless-stopped
ports:
- "15672:15672"
networks:
Expand Down
9 changes: 6 additions & 3 deletions env/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ services:
web:
hostname: magento2.test
container_name: magento2web
restart: always
build: .
restart: unless-stopped
build:
context: .
args:
- M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM}
environment:
- PHP_IDE_CONFIG=serverName=PHPSTORM
- BLACKFIRE_CLIENT_ID
Expand All @@ -27,7 +30,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
Expand Down
6 changes: 4 additions & 2 deletions env/etc/php/7.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions env/etc/php/7.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions env/etc/php/8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions env/etc/php/8.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ad065c1

Please sign in to comment.