├── .env.dist ├── .github └── workflows │ ├── dockerimage.yml │ └── unit.yml ├── .gitignore ├── LICENSE ├── README.md ├── build ├── build.sh ├── elasticsearch ├── jmeter │ ├── Dockerfile │ ├── bootstrap.sh │ └── xfce4-session.xml ├── nodejs ├── php │ ├── alpine │ ├── apache │ └── fpm ├── pmm_client └── tideways ├── bundles ├── metrics.yml ├── minimal.yml ├── performance.yml └── typical.yml ├── etc ├── apache │ ├── apache2.conf │ ├── httpd.conf │ └── virtual_host.conf ├── mongo │ └── xhgui.js ├── mysql │ └── my.cnf ├── nginx │ ├── fetch_env.js │ ├── nginx.conf │ ├── server.crt │ └── server.key ├── nodejs │ ├── Gruntfile.js │ └── package.json ├── php │ ├── Memory.php │ ├── allow_symlinks.patch │ ├── append.ini │ ├── blackfire.ini │ ├── config.json │ ├── fpm_sock.conf │ ├── newrelic.ini │ ├── php-fpm.conf │ ├── php.ini │ ├── profiler.php │ ├── spx.ini │ ├── tests │ │ ├── acceptance │ │ │ └── .env │ │ ├── api-functional │ │ │ ├── install-config-mysql.php │ │ │ ├── phpunit_graphql.xml │ │ │ ├── phpunit_rest.xml │ │ │ └── phpunit_soap.xml │ │ ├── functional │ │ │ ├── config.xml │ │ │ └── phpunit.xml │ │ ├── integration │ │ │ └── install-config-mysql.php │ │ └── setup-integration │ │ │ ├── install-config-mysql.php │ │ │ └── phpunit.xml │ ├── tideways.ini │ ├── tideways_xhprof.ini │ ├── tools │ │ ├── inventory │ │ ├── layout_debugger │ │ ├── link_edition │ │ ├── magento │ │ ├── magento2_debug │ │ ├── packages │ │ ├── page_builder │ │ ├── prepare_tests │ │ ├── reinstall │ │ └── sample_data │ ├── xdebug.ini │ └── xhprof.ini ├── phpstorm │ ├── .name │ ├── deployment.xml │ ├── magento.iml │ ├── magento2plugin.xml │ ├── modules.xml │ ├── php-test-framework.xml │ ├── php.xml │ ├── remote-mappings.xml │ ├── tools │ │ └── tools_magento.xml │ └── webServers.xml ├── prometheus │ └── prometheus.yml ├── redis │ └── sentinel.conf └── varnish │ ├── nginx.conf │ └── varnish.vcl ├── install.sh └── services ├── apache-fcgi.yml ├── apache-mod.yml ├── blackfire.yml ├── cadvisor.yml ├── elastic.yml ├── elasticsearch-hq.yml ├── jmeter.yml ├── mail.yml ├── memcached.yml ├── mftf.yml ├── mongodb.yml ├── mtf.yml ├── mysql.yml ├── newrelic.yml ├── nginx.yml ├── nodejs.yml ├── php.yml ├── phpmyadmin.yml ├── pmm.yml ├── rabbit.yml ├── redis-stat.yml ├── redis.yml ├── solr.yml ├── tideways.yml ├── varnish.yml └── xhgui.yml /.env.dist: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=magento 2 | WEB_PORT=80 3 | WEBS_PORT=443 4 | DB_PORT=3306 5 | SSH_PORT=222 6 | VARNISH_PORT=8080 7 | REDIS_PORT=6379 8 | MONGO_PORT=27017 9 | ELASTIC_PORT=9200 10 | MFTF_PORT=5900 11 | MAIL_PORT=8025 12 | RABBIT_PORT=15672 13 | XHGUI_PORT=8142 14 | ELASTIC_HQ_PORT=5000 15 | TIDEWAYS_APIKEY=key 16 | MAGENTO_PATH=../ 17 | FILE_SYNC=delegated 18 | BLACKFIRE_SERVER_ID=server_id 19 | BLACKFIRE_SERVER_TOKEN=server_token 20 | BLACKFIRE_CLIENT_ID=client_id 21 | BLACKFIRE_CLIENT_TOKEN=client_token 22 | -------------------------------------------------------------------------------- /.github/workflows/dockerimage.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | branches: 6 | - v2.0 7 | 8 | jobs: 9 | 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@master 17 | with: 18 | fetch-depth: 2 19 | - name: Setup Docker 20 | uses: docker-practice/actions-setup-docker@master 21 | - name: Build and test 22 | env: 23 | TYPE: fpm 24 | VER: 7.3 25 | MAGE: 2.3 26 | run: | 27 | docker build -f ./php/$TYPE -t duhon/php:$VER-$TYPE --compress --squash --force-rm --pull . 28 | docker run --rm --name test duhon/php:$VER-$TYPE bash -c 'git clone -b '$MAGE' --depth=1 --single-branch https://github.com/magento/magento2.git /var/www/magento2ce && composer update && php -v && php -m && php -d memory_limit=-1 /var/www/magento2ce/vendor/bin/phpunit -c /var/www/magento2ce/dev/tests/unit/phpunit.xml.dist' 29 | working-directory: ./build 30 | -------------------------------------------------------------------------------- /.github/workflows/unit.yml: -------------------------------------------------------------------------------- 1 | name: unit 2 | on: [push, pull_request] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-latest 6 | timeout-minutes: 5 7 | steps: 8 | - name: Prepare 9 | run: | 10 | set -x 11 | mkdir -p /home/runner/work/www 12 | sudo chown -R $USER:root /home/runner/work/www 13 | chmod -R g+s /home/runner/work/www 14 | - name: make magento2 15 | working-directory: /home/runner/work 16 | run: | 17 | set -x 18 | git clone -b 2.4-develop --single-branch https://github.com/magento/magento2.git www/magento2ce 19 | - uses: actions/checkout@master 20 | with: 21 | fetch-depth: 1 22 | - name: make magento-docker 23 | working-directory: /home/runner/work 24 | run: | 25 | set -x 26 | cp -r magento-docker/magento-docker www/magento-docker 27 | sudo chown -R $USER:root /home/runner/work/www 28 | chmod -R g+s /home/runner/work/www 29 | ls -la www/magento-docker 30 | - name: Create config 31 | working-directory: /home/runner/work/www/magento-docker 32 | run: | 33 | set -x 34 | cp bundles/minimal.yml docker-compose.yml 35 | cp .env.dist .env 36 | sed -i 's/3306/33061/' .env 37 | - name: Set up env 38 | working-directory: /home/runner/work/www/magento-docker 39 | run: | 40 | set -x 41 | docker-compose up -d 42 | docker-compose exec -T app composer install 43 | docker ps -a 44 | - name: Test 45 | working-directory: /home/runner/work/www/magento-docker 46 | run: | 47 | set -x 48 | docker-compose exec -T app magento reinstall 49 | docker-compose exec -T app bin/magento dev:tests:run unit 50 | - name: Tear down env 51 | working-directory: /home/runner/work/www/magento-docker 52 | run: | 53 | set -x 54 | docker-compose down 55 | 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | .idea 3 | docker-compose.yml -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Lugovyi, Andrii 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # magento-docker 2 | 3 | `magento-docker` is Docker environment for easy to setup, configure, debug Magento2 instance with varnish, elasticsearch, redis, rabbit and mftf tests. 4 | 5 | ### Requirements 6 | 7 | * [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) 8 | * [Docker](https://docs.docker.com/) 9 | * [Docker Compose](https://docs.docker.com/compose/install/) 10 | * Ensure you do not have `dnsmasq` installed/enabled locally (will be auto-installed if you've use Valet+ to install Magento) 11 | 12 | ### How to install 13 | 1. Add `magento.test` to `/etc/hosts`: `127.0.0.1 magento.test`. 14 | 2. Create your project directory: 15 | * `cd ~/` 16 | * `mkdir www` 17 | * `cd www` 18 | * `chown -R $USER:root .` 19 | * `chmod g+s .` 20 | 3. Clone `magento-docker` into you project directory: `git clone git@github.com:duhon/magento-docker.git`) 21 | 4. Clone `magento` repository into your project directory under `magento2ce` directory name: `git clone git@github.com:magento/magento2.git magento2ce` 22 | Now your project directory `~/www` has 2 folders: `magento-docker` & `magento2ce`. 23 | 5. `cp magento-docker/bundles/typical.yml magento-docker/docker-compose.yml` 24 | In `docker-compose.yml` you can choose what containers and what extensions you really need. 25 | 6. `cp magento-docker/.env.dist magento-docker/.env` 26 | In `.env` file environment variables are declared. Here you can change your `MAGENTO_PATH` into your project correct path or change your service containers ports together with `COMPOSE_PROJECT_NAME`. 27 | 7. Enter your `magento-docker` repository: `cd ~/www/magento-docker`. 28 | 8. Run `docker-compose up`. As a result all containers should be up. You can check if containers are up by running: `docker-compose ps`. 29 | 9. Check in browser if your magento host is up and running. Enter `http://magento.test:80` in browser. `80` is a default port but you can change it in `.env` file. 30 | 10. Install magento: `docker-compose exec app magento reinstall`. If you want to install ee/b2b versions run `docker-compose exec app magento reinstall `. 31 | 11. Magento installed. 32 | 33 | ## Scenarios 34 | 35 | ### 1. Enter container 36 | * Run `docker-compose exec app bash`. 37 | 38 | ### 2. Relaunch container 39 | * Run `docker-compose scale =0 && docker-compose scale =1`. For example: `docker-compose scale app=0 && docker-compose scale app=1`. 40 | 41 | ### 3. Run tests 42 | 43 | 1. `docker-compose exec app magento prepare_tests` 44 | 2. `docker-compose exec app bin/magento dev:tests:run (unit, integration)` 45 | 3. `docker-compose exec app bash` 46 | 4. `cd dev/tests/acceptance/ and vendor/bin/codecept run (mftf)` 47 | 5. `cd dev/tests/functional/ and vendor/bin/phpunit run (mtf)` 48 | 6. `vnc://localhost:5900 pass:secret (mftf or mtf)` 49 | 50 | ### 4. Enable/disable Xdebug 51 | 52 | * To enable xdebug, uncomment `xdebug.ini` line of `app` container in `docker-compose.yml` and run `docker-compose scale app=0 && docker-compose scale app=1`. 53 | :warning: Enabled Xdebug may slow your environment. 54 | 55 | ### 5. Magento (Re)-Installation 56 | 57 | * `docker-compose exec app magento reinstall (ee|b2b)` 58 | 59 | ### 6. Optimization host 60 | 61 | 1. Redis optimization 62 | ``` 63 | docker run -it --rm --privileged ubuntu /bin/bash 64 | echo never | tee /sys/kernel/mm/transparent_hugepage/enabled 65 | echo never | tee /sys/kernel/mm/transparent_hugepage/defrag 66 | ``` 67 | 2. Optimization for MacOS 68 | * https://gist.github.com/tombigel/d503800a282fcadbee14b537735d202c 69 | * https://markshust.com/2018/01/30/performance-tuning-docker-mac/ 70 | 71 | ### FAQ 72 | 1. If docker containers do not go up, check errors in console, run `docker-compose down`, fix issue and run `docker-compose up` again. 73 | 2. If `Overwrite the existing configuration for db-ssl-verify?[Y/n]` prompts in console, type `Y`. 74 | 3. If magento installation fails, run `docker-compose exec app magento reinstall` 75 | 4. If there is 404 error on /admin page, clean cache by running `bin/magento cache:clean` command inside `app` container. 76 | 77 | ### TODO list 78 | https://github.com/duhon/magento-docker/projects 79 | -------------------------------------------------------------------------------- /build/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | type=${1:-'fpm'} 4 | ver=${2:-'7.4'} 5 | mage=${3:-'2.4.2'} 6 | docker build -f ./php/${type} -t duhon/php:${ver}-${type}-${mage} --compress --force-rm --pull . 7 | docker run --rm --name test -it duhon/php:${ver}-${type} bash -c 'git clone -b '${mage}' --depth=1 --single-branch https://github.com/magento/magento2.git /var/www/magento2ce && composer update && php -v && php -m && php -d memory_limit=-1 /var/www/magento2ce/vendor/bin/phpunit -c /var/www/magento2ce/dev/tests/unit/phpunit.xml.dist' 8 | echo "docker push duhon/php:${ver}-${type}-${mage}" 9 | 10 | #todo: check hash for files nginx.conf.sample, php/tests/* 11 | 12 | #cd ~/www 13 | #shopt -s dotglob 14 | #zip -r0 ../data.zip * 15 | #docker run --rm -v ~/www/data.zip:/src/data.zip -v www:/data busybox unzip /src/data.zip -d /data 16 | #docker run --rm -v www:/var/www/magento2ce busybox ls -la /var/www/magento2ce/ 17 | -------------------------------------------------------------------------------- /build/elasticsearch: -------------------------------------------------------------------------------- 1 | FROM elasticsearch:5.2 2 | 3 | RUN elasticsearch-plugin install analysis-icu 4 | RUN elasticsearch-plugin install analysis-phonetic -------------------------------------------------------------------------------- /build/jmeter/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:alpine 2 | 3 | ENV JMETER_VERSION 3.1 4 | ENV VNC_SERVER_PASSWORD secret 5 | ENV JMETER_HOME /home/alpine/jmeter/apache-jmeter-$JMETER_VERSION/ 6 | ENV PATH $JMETER_HOME/bin:$PATH 7 | ENV DISPLAY :99 8 | ENV RESOLUTION 1024x768x24 9 | 10 | RUN apk add --no-cache wget tar openssl sudo xvfb x11vnc xfce4 faenza-icon-theme bash unzip \ 11 | && adduser -h /home/alpine -s /bin/bash -S -D alpine && echo -e "alpine\nalpine" | passwd alpine \ 12 | && echo 'alpine ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers 13 | 14 | USER alpine 15 | WORKDIR /home/alpine 16 | 17 | RUN mkdir -p /home/alpine/.vnc && x11vnc -storepasswd $VNC_SERVER_PASSWORD /home/alpine/.vnc/passwd 18 | 19 | # Installing jmeter 20 | RUN mkdir /home/alpine/jmeter \ 21 | && cd /home/alpine/jmeter/ \ 22 | && wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz \ 23 | && tar -xzf apache-jmeter-$JMETER_VERSION.tgz \ 24 | && rm apache-jmeter-$JMETER_VERSION.tgz 25 | 26 | RUN wget -qO- -O $JMETER_HOME/lib/ext/jmeter-plugins-manager.jar https://jmeter-plugins.org/get/ 27 | RUN wget -qO- -O tmp.zip http://jmeter-plugins.org/downloads/file/JMeterPlugins-Standard-1.2.1.zip && unzip -n tmp.zip -d $JMETER_HOME && rm tmp.zip 28 | RUN wget -qO- -O tmp.zip http://jmeter-plugins.org/downloads/file/JMeterPlugins-Extras-1.3.0.zip && unzip -n tmp.zip -d $JMETER_HOME && rm tmp.zip 29 | RUN wget -qO- -O tmp.zip http://jmeter-plugins.org/downloads/file/JMeterPlugins-ExtrasLibs-1.3.0.zip && unzip -n tmp.zip -d $JMETER_HOME && rm tmp.zip 30 | RUN wget -qO- -O tmp.zip http://jmeter-plugins.org/files/packages/blazemeter-debugger-0.4.zip && unzip -n tmp.zip -d $JMETER_HOME && rm tmp.zip 31 | RUN wget -qO- -O tmp.zip http://jmeter-plugins.org/files/packages/jpgc-json-2.6.zip && unzip -n tmp.zip -d $JMETER_HOME && rm tmp.zip 32 | RUN chmod -R 777 $JMETER_HOME 33 | 34 | COPY xfce4-session.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml 35 | 36 | WORKDIR $JMETER_HOME 37 | COPY bootstrap.sh /bootstrap.sh 38 | EXPOSE 5900 39 | 40 | CMD [ "/bin/bash", "/bootstrap.sh" ] 41 | -------------------------------------------------------------------------------- /build/jmeter/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | nohup /usr/bin/Xvfb :99 -screen 0 $RESOLUTION -ac +extension GLX +render -noreset > /dev/null 2>&1 & 4 | nohup startxfce4 > /dev/null 2>&1 & 5 | nohup x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :99 -forever -bg -rfbauth /home/alpine/.vnc/passwd -users alpine -rfbport 5900 > /dev/null 2>&1 & 6 | jmeter 7 | -------------------------------------------------------------------------------- /build/jmeter/xfce4-session.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /build/nodejs: -------------------------------------------------------------------------------- 1 | FROM library/node 2 | 3 | RUN npm install -g bower grunt-cli && \ 4 | echo '{ "allow_root": true }' > /root/.bowerrc 5 | 6 | WORKDIR /data 7 | 8 | CMD ["bash"] -------------------------------------------------------------------------------- /build/php/alpine: -------------------------------------------------------------------------------- 1 | FROM php:7.3-fpm-alpine 2 | 3 | RUN apk add --no-cache \ 4 | shadow \ 5 | grep \ 6 | libmcrypt \ 7 | libsodium \ 8 | unzip \ 9 | git \ 10 | bash \ 11 | mysql-client \ 12 | openssh-server \ 13 | libzip \ 14 | libxslt \ 15 | gnu-libiconv \ 16 | icu-dev \ 17 | freetype \ 18 | libwebp \ 19 | libpng \ 20 | libxml2 \ 21 | libjpeg-turbo 22 | RUN apk add --no-cache --virtual .build-deps \ 23 | $PHPIZE_DEPS \ 24 | libzip-dev \ 25 | libxslt-dev \ 26 | icu-dev \ 27 | freetype-dev \ 28 | libwebp-dev \ 29 | libpng-dev \ 30 | libxml2-dev \ 31 | libjpeg-turbo-dev 32 | ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php 33 | RUN git clone -b 'v4.1.7' --depth=1 --single-branch https://github.com/tideways/php-xhprof-extension.git /usr/src/php/ext/tideways \ 34 | && docker-php-ext-configure gd --with-freetype-dir --with-png-dir --with-jpeg-dir --with-webp-dir \ 35 | && docker-php-ext-install -j$(nproc) pcntl gd opcache bcmath soap intl zip xsl pdo_mysql tideways sockets \ 36 | && pecl install -f xdebug apcu msgpack \ 37 | && docker-php-ext-enable apcu msgpack 38 | 39 | ADD https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 /usr/local/bin/yq 40 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ 41 | && ln -sf /usr/local/bin/magento2/magento /usr/local/bin/magento \ 42 | && usermod -aG root www-data \ 43 | && chmod +x /usr/local/bin/yq 44 | RUN echo 'root:root' | chpasswd \ 45 | && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \ 46 | && apk del .build-deps && rm -rf /tmp/* && rm -rf /usr/src/ 47 | 48 | WORKDIR /var/www/magento2ce 49 | 50 | EXPOSE 9000 51 | CMD ["php-fpm", "-R"] 52 | -------------------------------------------------------------------------------- /build/php/apache: -------------------------------------------------------------------------------- 1 | ARG MIN_PHP_VERSION=7.4 2 | ARG BLACKFIRE_PHP_VERSION=74 3 | ARG NEWRELIC_PHP_VERSION=20190902 4 | 5 | FROM busybox AS source_blackfire 6 | ARG BLACKFIRE_PHP_VERSION 7 | ADD https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$BLACKFIRE_PHP_VERSION blackfire-probe.tar.gz 8 | RUN tar xzvf blackfire-probe.tar.gz -C /tmp/ \ 9 | && mv /tmp/blackfire-*.so /blackfire.so 10 | 11 | FROM busybox AS source_newrelic 12 | ARG NEWRELIC_PHP_VERSION 13 | ADD https://download.newrelic.com/php_agent/archive/9.9.0.260/newrelic-php5-9.9.0.260-linux.tar.gz newrelic.tar.gz 14 | RUN tar xzvf newrelic.tar.gz -C /tmp/ \ 15 | && mv /tmp/newrelic-php5-9.9.0.260-linux/agent/x64/newrelic-$NEWRELIC_PHP_VERSION.so /newrelic.so 16 | 17 | FROM alpine/git AS source_git 18 | RUN git clone -b 'master' --depth=1 https://github.com/NoiseByNorthwest/php-spx.git \ 19 | && mv * / 20 | 21 | FROM php:$MIN_PHP_VERSION AS source_php_ext 22 | COPY --from=source_git php-spx /usr/src/php/ext/spx 23 | RUN apt-get update \ 24 | && apt-get install -y --no-install-recommends \ 25 | libfreetype6-dev \ 26 | libjpeg62-turbo-dev \ 27 | libmcrypt-dev \ 28 | libsodium-dev \ 29 | libicu-dev \ 30 | libxslt-dev \ 31 | gnupg \ 32 | libssl-dev \ 33 | libgringotts-dev \ 34 | libzip-dev \ 35 | zlib1g-dev \ 36 | && rm -r /var/lib/apt/lists/* \ 37 | && docker-php-ext-configure gd --with-freetype --with-jpeg \ 38 | && docker-php-ext-install -j$(nproc) pcntl gd opcache bcmath soap intl zip xsl pdo_mysql sockets spx\ 39 | && pecl install -f xdebug xhprof apcu msgpack libsodium runkit7 \ 40 | && mv $(php-config --extension-dir)/*.so / 41 | 42 | FROM php:$MIN_PHP_VERSION-apache-buster 43 | ARG MIN_PHP_VERSION 44 | COPY --from=source_blackfire blackfire.so /tmp/ext/ 45 | COPY --from=source_newrelic newrelic.so /tmp/ext/ 46 | COPY --from=duhon/tideways /usr/lib/tideways/tideways-php-$MIN_PHP_VERSION.so /tmp/ext/tideways.so 47 | COPY --from=source_php_ext *.so /tmp/ext/ 48 | COPY --from=source_php_ext /usr/local/share/misc/php-spx/assets/web-ui /usr/local/share/misc/php-spx/assets/web-ui 49 | ADD https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 /usr/local/bin/mhsendmail 50 | ADD https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 /usr/local/bin/yq 51 | COPY --from=composer:2 /usr/bin/composer /usr/local/bin/ 52 | COPY --from=duhon/tideways /usr/bin/tideways /usr/local/bin/ 53 | COPY --from=blackfire/blackfire /usr/local/bin/blackfire /usr/local/bin/ 54 | 55 | RUN apt-get update \ 56 | && apt-get install -y --no-install-recommends \ 57 | vim \ 58 | git \ 59 | wget \ 60 | default-mysql-client \ 61 | openssh-server \ 62 | iputils-ping \ 63 | unzip \ 64 | libzip4 \ 65 | libxslt1.1 \ 66 | libpng16-16 \ 67 | libjpeg62-turbo \ 68 | libfreetype6 \ 69 | libapr1-dev \ 70 | libaprutil1-dev \ 71 | libaprutil1-ldap \ 72 | libgdbm-dev \ 73 | apache2-dev \ 74 | libperl-dev \ 75 | cpanminus \ 76 | && rm -r /var/lib/apt/lists/* \ 77 | && mv /tmp/ext/* $(php-config --extension-dir)/ \ 78 | #todo make this (mod_perl2) at another layer 79 | && cpanm -v -f mod_perl2 Apache2::Imager::Resize \ 80 | && docker-php-ext-enable apcu bcmath gd intl msgpack opcache pcntl pdo_mysql soap sockets xsl zip \ 81 | && echo 'alias ll="ls -lA"' >>/root/.bashrc \ 82 | && usermod -a -G root www-data \ 83 | && chmod +x /usr/local/bin/* \ 84 | && ln -sf /usr/local/bin/magento2/magento /usr/local/bin/magento \ 85 | && echo 'root:root' | chpasswd \ 86 | && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config 87 | 88 | WORKDIR /var/www/magento2ce 89 | 90 | EXPOSE 80 91 | CMD ["apache2-foreground"] 92 | -------------------------------------------------------------------------------- /build/php/fpm: -------------------------------------------------------------------------------- 1 | ARG MIN_PHP_VERSION=7.4 2 | ARG BLACKFIRE_PHP_VERSION=74 3 | ARG NEWRELIC_PHP_VERSION=20190902 4 | 5 | FROM busybox AS source_blackfire 6 | ARG BLACKFIRE_PHP_VERSION 7 | ADD https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$BLACKFIRE_PHP_VERSION blackfire-probe.tar.gz 8 | RUN tar xzvf blackfire-probe.tar.gz -C /tmp/ \ 9 | && mv /tmp/blackfire-*.so /blackfire.so 10 | 11 | FROM busybox AS source_newrelic 12 | ARG NEWRELIC_PHP_VERSION 13 | ADD https://download.newrelic.com/php_agent/archive/9.9.0.260/newrelic-php5-9.9.0.260-linux.tar.gz newrelic.tar.gz 14 | RUN tar xzvf newrelic.tar.gz -C /tmp/ \ 15 | && mv /tmp/newrelic-php5-9.9.0.260-linux/agent/x64/newrelic-$NEWRELIC_PHP_VERSION.so /newrelic.so 16 | 17 | FROM alpine/git AS source_git 18 | RUN git clone -b '4.x' --depth=1 --single-branch https://github.com/reynaldliu/tideways-PHP7.4.git \ 19 | && git clone -b 'master' --depth=1 https://github.com/NoiseByNorthwest/php-spx.git \ 20 | && mv * / 21 | 22 | FROM php:$MIN_PHP_VERSION AS source_php_ext 23 | COPY --from=source_git tideways-PHP7.4 /usr/src/php/ext/tideways 24 | COPY --from=source_git php-spx /usr/src/php/ext/spx 25 | RUN apt-get update \ 26 | && apt-get install -y --no-install-recommends \ 27 | libfreetype6-dev \ 28 | libjpeg62-turbo-dev \ 29 | libmcrypt-dev \ 30 | libsodium-dev \ 31 | libicu-dev \ 32 | libxslt-dev \ 33 | gnupg \ 34 | libssl-dev \ 35 | libgringotts-dev \ 36 | libzip-dev \ 37 | zlib1g-dev \ 38 | && rm -r /var/lib/apt/lists/* \ 39 | && docker-php-ext-configure gd --with-freetype --with-jpeg \ 40 | && docker-php-ext-install -j$(nproc) pcntl gd opcache bcmath soap intl zip xsl pdo_mysql sockets tideways spx\ 41 | && pecl install -f xdebug xhprof apcu msgpack libsodium runkit7 \ 42 | && mv $(php-config --extension-dir)/*.so / \ 43 | && mv /tideways.so /tideways_xhprof.so 44 | 45 | FROM php:$MIN_PHP_VERSION-fpm-buster 46 | ARG MIN_PHP_VERSION 47 | COPY --from=source_blackfire blackfire.so /tmp/ext/ 48 | COPY --from=source_newrelic newrelic.so /tmp/ext/ 49 | COPY --from=duhon/tideways /usr/lib/tideways/tideways-php-$MIN_PHP_VERSION.so /tmp/ext/tideways.so 50 | COPY --from=source_php_ext *.so /tmp/ext/ 51 | COPY --from=source_php_ext /usr/local/share/misc/php-spx/assets/web-ui /usr/local/share/misc/php-spx/assets/web-ui 52 | ADD https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 /usr/local/bin/mhsendmail 53 | ADD https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 /usr/local/bin/yq 54 | COPY --from=composer:2 /usr/bin/composer /usr/local/bin/ 55 | COPY --from=duhon/tideways /usr/bin/tideways /usr/local/bin/ 56 | COPY --from=blackfire/blackfire /usr/local/bin/blackfire /usr/local/bin/ 57 | 58 | RUN apt-get update \ 59 | && apt-get install -y --no-install-recommends \ 60 | vim \ 61 | git \ 62 | wget \ 63 | default-mysql-client \ 64 | openssh-server \ 65 | iputils-ping \ 66 | unzip \ 67 | libzip4 \ 68 | libxslt1.1 \ 69 | libpng16-16 \ 70 | libjpeg62-turbo \ 71 | libfreetype6 \ 72 | && rm -r /var/lib/apt/lists/*\ 73 | && mv /tmp/ext/* $(php-config --extension-dir)/ \ 74 | && docker-php-ext-enable apcu bcmath gd intl msgpack opcache pcntl pdo_mysql soap sockets xsl zip \ 75 | && echo 'alias ll="ls -lA"' >>/root/.bashrc \ 76 | && usermod -a -G root www-data \ 77 | && chmod +x /usr/local/bin/* \ 78 | && ln -sf /usr/local/bin/magento2/magento /usr/local/bin/magento \ 79 | && echo 'root:root' | chpasswd \ 80 | && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config 81 | 82 | WORKDIR /var/www/magento2ce 83 | 84 | EXPOSE 9000 85 | CMD ["php-fpm", "-R"] 86 | -------------------------------------------------------------------------------- /build/pmm_client: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | MAINTAINER Duhon 3 | 4 | RUN apt-get update && \ 5 | apt-get install -y wget && \ 6 | wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb && \ 7 | dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb && \ 8 | apt-get update && \ 9 | apt-get install -y pmm-client curl 10 | 11 | WORKDIR /usr/local/percona/pmm-client 12 | 13 | EXPOSE 42000 42002 14 | -------------------------------------------------------------------------------- /build/tideways: -------------------------------------------------------------------------------- 1 | FROM debian:stable-slim 2 | 3 | RUN apt-get update \ 4 | && apt-get install -yq --no-install-recommends gnupg2 curl sudo ca-certificates \ 5 | && echo 'deb http://s3-eu-west-1.amazonaws.com/tideways/packages debian main' > /etc/apt/sources.list.d/tideways.list \ 6 | && curl -sS 'https://s3-eu-west-1.amazonaws.com/tideways/packages/EEB5E8F4.gpg' | apt-key add - \ 7 | && DEBIAN_FRONTEND=noninteractive apt-get update \ 8 | && apt-get install -yq tideways-daemon tideways-php tideways-cli \ 9 | && apt-get autoremove --assume-yes \ 10 | && apt-get clean \ 11 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 12 | 13 | EXPOSE 9135 8135 14 | 15 | CMD sh -c 'tideways-daemon --address=0.0.0.0:9135 --udp=0.0.0.0:8135 $EXTRA_PARAMS' -------------------------------------------------------------------------------- /bundles/metrics.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | web: 4 | image: nginx:1.20-alpine 5 | hostname: web 6 | volumes: 7 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 8 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf 9 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.crt:/etc/nginx/server.crt 10 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.key:/etc/nginx/server.key 11 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/fetch_env.js:/etc/nginx/fetch_env.js 12 | - nginx_access_log:/var/log/nginx 13 | ports: 14 | - "${WEB_PORT}:80" 15 | - "${WEBS_PORT}:443" 16 | depends_on: 17 | - app 18 | x-hint: uncomment the line above and change error_log in nginx.conf 19 | x-info: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/nginx.html 20 | db: 21 | image: mariadb:10.4 22 | hostname: db 23 | environment: 24 | MYSQL_ALLOW_EMPTY_PASSWORD: "yes" 25 | MYSQL_DATABASE: "magento" 26 | shm_size: '1gb' 27 | volumes: 28 | - ${MAGENTO_PATH}/magento-docker/etc/mysql/my.cnf:/etc/mysql/conf.d/mysql.cnf 29 | ports: 30 | - "${DB_PORT}:3306" 31 | x-hits: 32 | - bin/magento dev:query-log:enable and watch var/debug/db.log 33 | x-info: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/mysql.html 34 | elastic: 35 | image: elasticsearch:7.1.0 36 | hostname: elastic 37 | ports: 38 | - "${ELASTIC_PORT}:9200" 39 | environment: 40 | - cluster.name=magento-cluster 41 | - bootstrap.memory_lock=true 42 | - discovery.type=single-node 43 | - http.port=9200 44 | - http.cors.enabled=true 45 | - http.cors.allow-origin=* 46 | - http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization 47 | - http.cors.allow-credentials=true 48 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 49 | ulimits: 50 | memlock: 51 | soft: -1 52 | hard: -1 53 | x-hits: 54 | - curl -i http://localhost:9200/_cluster/health 55 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/elasticsearch/es-overview.html 56 | x-setup: 57 | - bin/magento config:set catalog/search/engine elasticsearch7 58 | app: 59 | image: duhon/php:7.4-fpm-2.4.2 60 | hostname: app 61 | volumes: 62 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 63 | - ${MAGENTO_PATH}/magento-docker/etc/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini 64 | - ${MAGENTO_PATH}/magento-docker/etc/php/tools:/usr/local/bin/magento2:ro 65 | - ${MAGENTO_PATH}/magento-docker/etc/php/php.ini:/usr/local/etc/php/php.ini:ro 66 | - ${MAGENTO_PATH}/magento-docker/etc/php/php-fpm.conf:/usr/local/etc/php-fpm.conf 67 | environment: 68 | COMPOSER_HOME: /var/www/.composer 69 | PHP_IDE_CONFIG: serverName=magento.test 70 | command: sh -c 'service ssh start; php-fpm -R' 71 | x-hints: 72 | - magento reinstall 73 | - magento sample_data 74 | - magento page_builder 75 | - docker-compose scale app=0 && docker-compose scale app=1 76 | x-setup: 77 | - bin/magento config:set web/unsecure/base_url http://magento.test/ 78 | - bin/magento config:set web/secure/base_url https://magento.test/ 79 | - bin/magento config:set web/secure/use_in_frontend 0 80 | - bin/magento config:set web/secure/use_in_adminhtml 0 81 | - bin/magento config:set web/seo/use_rewrites 1 82 | - bin/magento config:set web/cookie/cookie_httponly 0 83 | - bin/magento config:set admin/security/use_form_key 0 84 | - bin/magento config:set admin/security/admin_account_sharing 1 85 | - bin/magento config:set admin/security/session_lifetime 31536000 86 | - bin/magento cache:clean config 87 | # - composer dump-autoload --optimize 88 | x-info: https://devdocs.magento.com/ 89 | redis: 90 | image: redis 91 | hostname: redis 92 | ports: 93 | - "${REDIS_PORT}:6379" 94 | sysctls: 95 | net.core.somaxconn: 1024 96 | ulimits: 97 | nproc: 65535 98 | nofile: 99 | soft: 20000 100 | hard: 40000 101 | x-hints: 102 | - redis-cli monitor 103 | - telnet localhost 6379 104 | x-setup: 105 | - bin/magento setup:config:set -n --page-cache=redis --page-cache-redis-server=redis --cache-backend-redis-db=3 106 | - bin/magento setup:config:set -n --session-save=redis --session-save-redis-host=redis --cache-backend-redis-db=0 107 | - bin/magento setup:config:set -n --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=1 108 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/redis/config-redis.html 109 | grafana: 110 | image: grafana/grafana 111 | depends_on: 112 | - prometheus 113 | ports: 114 | - "3000:3000" 115 | environment: 116 | GF_SECURITY_ADMIN_PASSWORD: "123123q" 117 | GF_ALLOW_SIGN_UP: "false" 118 | GF_AUTH_ANONYMOUS: "true" 119 | GF_INSTALL_PLUGINS: "percona-percona-app" 120 | redis-exporter: 121 | image: oliver006/redis_exporter 122 | depends_on: 123 | - redis 124 | environment: 125 | REDIS_ADDR: redis 126 | expose: 127 | - 9121 128 | nginx-exporter: 129 | image: quay.io/rebuy/nginx-exporter:v1.1.0 130 | volumes: 131 | - nginx_access_log:/var/log/nginx 132 | environment: 133 | NGINX_ACCESS_LOGS: /var/log/nginx/mtail.log 134 | NGINX_STATUS_URI: http://web:8080/nginx_status 135 | expose: 136 | - 9113 137 | - 9397 138 | x-info: https://github.com/rebuy-de/nginx-exporter 139 | fpm-exporter: 140 | image: bakins/php-fpm-exporter:v0.6.1 141 | command: 142 | - '--addr=0.0.0.0:9099' 143 | - '--fastcgi=tcp://app:9000/status' 144 | expose: 145 | - 9099 146 | x-info: https://github.com/bakins/php-fpm-exporter 147 | cadvisor: 148 | image: google/cadvisor 149 | volumes: 150 | - /:/rootfs:ro 151 | - /var/run:/var/run:rw 152 | - /sys:/sys:ro 153 | - /var/lib/docker/:/var/lib/docker:ro 154 | expose: 155 | - 8080 156 | mysqld-exporter: 157 | image: prom/mysqld-exporter 158 | depends_on: 159 | - db 160 | environment: 161 | DATA_SOURCE_NAME: "root@(db:3306)/magento" 162 | expose: 163 | - 9104 164 | #command: /bin/mysqld_exporter collect.binlog_size=true collect.info_schema.processlist=true 165 | x-info: https://github.com/prometheus/mysqld_exporter 166 | node-exporter: 167 | image: prom/node-exporter 168 | volumes: 169 | - /proc:/host/proc:ro 170 | - /sys:/host/sys:ro 171 | - /:/rootfs:ro 172 | command: 173 | - '--path.procfs=/host/proc' 174 | - '--path.sysfs=/host/sys' 175 | - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)' 176 | expose: 177 | - 9100 178 | x-info: https://hub.docker.com/r/prom/node-exporter 179 | prometheus: 180 | image: prom/prometheus 181 | ports: 182 | - "${PROMETHEUS_PORT}:9090" 183 | depends_on: 184 | - redis-exporter 185 | - nginx-exporter 186 | - fpm-exporter 187 | - cadvisor 188 | - mysqld-exporter 189 | - node-exporter 190 | volumes: 191 | - ${MAGENTO_PATH}/magento-docker/etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml 192 | command: 193 | - '--config.file=/etc/prometheus/prometheus.yml' 194 | pmm: 195 | image: duhon/pmm 196 | hostname: pmm 197 | ports: 198 | - "${PMM_PORT}:80" 199 | depends_on: 200 | - db 201 | environment: 202 | MYSQL_HOST: db 203 | elasticsearch-hq: 204 | image: elastichq/elasticsearch-hq 205 | ports: 206 | - "${ELASTIC_HQ_PORT}:5000" 207 | environment: 208 | - HQ_DEFAULT_URL=http://elastic:9200 209 | volumes: 210 | nginx_access_log: {} 211 | networks: 212 | default: 213 | driver: bridge 214 | -------------------------------------------------------------------------------- /bundles/minimal.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | web: 4 | image: nginx:1.20-alpine 5 | volumes: 6 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 7 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf 8 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.crt:/etc/nginx/server.crt 9 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.key:/etc/nginx/server.key 10 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/fetch_env.js:/etc/nginx/fetch_env.js 11 | ports: 12 | - "${WEB_PORT}:80" 13 | db: 14 | image: mariadb:10.4 15 | environment: 16 | MYSQL_ALLOW_EMPTY_PASSWORD: "yes" 17 | MYSQL_DATABASE: "magento" 18 | elastic: 19 | image: elasticsearch:7.1.0 20 | hostname: elastic 21 | ports: 22 | - "${ELASTIC_PORT}:9200" 23 | environment: 24 | - cluster.name=docker-cluster 25 | - bootstrap.memory_lock=true 26 | - discovery.type=single-node 27 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 28 | ulimits: 29 | memlock: 30 | soft: -1 31 | hard: -1 32 | x-hits: 33 | - curl -i http://localhost:9200/_cluster/health 34 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/elasticsearch/es-overview.html 35 | x-setup: 36 | - bin/magento config:set catalog/search/engine elasticsearch7 37 | app: 38 | image: duhon/php:7.4-fpm-2.4.2 39 | hostname: app 40 | volumes: 41 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 42 | # - ${MAGENTO_PATH}/magento-docker/etc/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini 43 | - ${MAGENTO_PATH}/magento-docker/etc/php/tools:/usr/local/bin/magento2:ro 44 | - ${MAGENTO_PATH}/magento-docker/etc/php/php.ini:/usr/local/etc/php/php.ini:ro 45 | - ${MAGENTO_PATH}/magento-docker/etc/php/php-fpm.conf:/usr/local/etc/php-fpm.conf 46 | environment: 47 | COMPOSER_HOME: /var/www/.composer 48 | x-setup: 49 | - bin/magento config:set web/seo/use_rewrites 1 50 | networks: 51 | default: 52 | driver: bridge 53 | -------------------------------------------------------------------------------- /bundles/performance.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | web: 4 | image: nginx:1.20-alpine 5 | hostname: web 6 | volumes: 7 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 8 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf 9 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.crt:/etc/nginx/server.crt 10 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.key:/etc/nginx/server.key 11 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/fetch_env.js:/etc/nginx/fetch_env.js 12 | networks: 13 | default: 14 | aliases: 15 | - magento.test 16 | ports: 17 | - "${WEB_PORT}:80" 18 | - "${WEBS_PORT}:443" 19 | depends_on: 20 | - app 21 | # command: nginx-debug -g 'daemon off;' 22 | x-hint: uncomment the line above and change error_log in nginx.conf 23 | x-info: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/nginx.html 24 | db: 25 | image: mariadb:10.4 26 | hostname: db 27 | environment: 28 | MYSQL_ALLOW_EMPTY_PASSWORD: "yes" 29 | MYSQL_DATABASE: "magento" 30 | shm_size: '1gb' 31 | volumes: 32 | - ${MAGENTO_PATH}/magento-docker/etc/mysql/my.cnf:/etc/mysql/conf.d/mysql.cnf 33 | ports: 34 | - "${DB_PORT}:3306" 35 | x-hits: 36 | - bin/magento dev:query-log:enable and watch var/debug/db.log 37 | x-info: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/mysql.html 38 | app: 39 | image: duhon/php:7.3-fpm 40 | hostname: app 41 | ports: 42 | - "${SSH_PORT}:22" 43 | stop_signal: SIGKILL 44 | volumes: 45 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 46 | - ${MAGENTO_PATH}/magento-docker/etc/php/tools:/usr/local/bin/magento2:ro 47 | # - ${MAGENTO_PATH}/magento-docker/etc/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini 48 | # - ${MAGENTO_PATH}/magento-docker/etc/php/blackfire.ini:/usr/local/etc/php/conf.d/blackfire.ini 49 | # - ${MAGENTO_PATH}/magento-docker/etc/php/tideways.ini:/usr/local/etc/php/conf.d/tideways.ini 50 | # - ${MAGENTO_PATH}/magento-docker/etc/php/xhprof.ini:/usr/local/etc/php/conf.d/xhprof.ini 51 | # - ${MAGENTO_PATH}/magento-docker/etc/php/tideways_xhprof.ini:/usr/local/etc/php/conf.d/tideways_xhprof.ini 52 | - ${MAGENTO_PATH}/magento-docker/etc/php/spx.ini:/usr/local/etc/php/conf.d/spx.ini 53 | # - ${MAGENTO_PATH}/magento-docker/etc/php/profiler.php:/usr/local/lib/php/header.php 54 | # - ${MAGENTO_PATH}/magento-docker/etc/php/append.ini:/usr/local/etc/php/conf.d/append.ini 55 | - ${MAGENTO_PATH}/magento-docker/etc/php/php.ini:/usr/local/etc/php/php.ini:ro 56 | - ${MAGENTO_PATH}/magento-docker/etc/php/php-fpm.conf:/usr/local/etc/php-fpm.conf 57 | environment: 58 | COMPOSER_HOME: /var/www/.composer 59 | PHP_IDE_CONFIG: serverName=magento.test 60 | TIDEWAYS_APIKEY: ${TIDEWAYS_APIKEY} 61 | command: sh -c 'service ssh start; php-fpm -R' 62 | x-hints: 63 | - magento reinstall 64 | - magento sample_data 65 | - magento page_builder 66 | - docker-compose up --detach --force-recreate app 67 | x-setup: 68 | - bin/magento config:set web/seo/use_rewrites 1 69 | - bin/magento config:set dev/template/allow_symlink 1 70 | - bin/magento setup:performance:generate-fixtures ./setup/performance-toolkit/profiles/ce/small.xml 71 | - bin/magento deploy:mode:set production 72 | - composer dumpautoload -o 73 | - bin/magento cache:clean 74 | x-info: https://devdocs.magento.com/ 75 | xhgui: 76 | image: duhon/xhgui 77 | hostname: xhgui 78 | depends_on: 79 | - mongodb 80 | ports: 81 | - "${XHGUI_PORT}:80" 82 | mongodb: 83 | image: mongo 84 | hostname: mongodb 85 | # command: --storageEngine=inMemory #engine: mmapv1, rocksdb, wiredTiger, inMemory 86 | environment: 87 | - MONGO_INITDB_DATABASE=xhprof 88 | volumes: 89 | - ${MAGENTO_PATH}/magento-docker/etc/mongo:/docker-entrypoint-initdb.d 90 | ports: 91 | - "${MONGO_PORT}:27017" 92 | blackfire: 93 | image: blackfire/blackfire 94 | environment: 95 | BLACKFIRE_LOG_LEVEL: 1 96 | BLACKFIRE_SERVER_ID: ${BLACKFIRE_SERVER_ID} 97 | BLACKFIRE_SERVER_TOKEN: ${BLACKFIRE_SERVER_TOKEN} 98 | BLACKFIRE_CLIENT_ID: ${BLACKFIRE_CLIENT_ID} 99 | BLACKFIRE_CLIENT_TOKEN: ${BLACKFIRE_CLIENT_TOKEN} 100 | tideways: 101 | image: duhon/tideways 102 | hostname: tideways 103 | environment: 104 | EXTRA_PARAMS: --debug 105 | newrelic: 106 | image: newrelic/php-daemon 107 | mail: 108 | image: mailhog/mailhog 109 | hostname: mail 110 | ports: 111 | - "${MAIL_PORT}:8025" 112 | mftf: 113 | image: selenium/standalone-chrome-debug:3.12.0 114 | ports: 115 | - "${MFTF_PORT}:5900" 116 | x-hints: 117 | - "vnc://localhost:5900 pass:secret" 118 | - magento prepare_tests 119 | - vendor/bin/mftf run:test 120 | x-info: https://devdocs.magento.com/mftf/docs/introduction.html 121 | elastic: 122 | image: elasticsearch:7.1.0 123 | hostname: elastic 124 | ports: 125 | - "${ELASTIC_PORT}:9200" 126 | environment: 127 | - cluster.name=magento-cluster 128 | - bootstrap.memory_lock=true 129 | - discovery.type=single-node 130 | - http.port=9200 131 | - http.cors.enabled=true 132 | - http.cors.allow-origin=* 133 | - http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization 134 | - http.cors.allow-credentials=true 135 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 136 | ulimits: 137 | memlock: 138 | soft: -1 139 | hard: -1 140 | x-hits: 141 | - curl -i http://localhost:9200/_cluster/health 142 | x-setup: 143 | - bin/magento config:set catalog/search/engine elasticsearch7 144 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/elasticsearch/es-overview.html 145 | redis: 146 | image: redis 147 | hostname: redis 148 | ports: 149 | - "${REDIS_PORT}:6379" 150 | sysctls: 151 | net.core.somaxconn: 1024 152 | ulimits: 153 | nproc: 65535 154 | nofile: 155 | soft: 20000 156 | hard: 40000 157 | x-hints: 158 | - redis-cli monitor 159 | - telnet localhost 6379 160 | x-setup: 161 | # - bin/magento setup:config:set -n --page-cache=redis --page-cache-redis-server=redis --cache-backend-redis-db=3 162 | - bin/magento setup:config:set -n --session-save=redis --session-save-redis-host=redis --cache-backend-redis-db=0 163 | - bin/magento setup:config:set -n --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=1 164 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/redis/config-redis.html 165 | rabbit: 166 | image: rabbitmq:management 167 | hostname: rabbitmq 168 | ports: 169 | - "${RABBIT_PORT}:15672" 170 | x-hints: 171 | - bin/magento queue:consumers:list 172 | - bin/magento queue:consumers:start 173 | - "http://localhost:15672/ user:guest pass:guest" 174 | x-setup: 175 | - bin/magento setup:config:set -n --amqp-host=rabbit --amqp-user=guest --amqp-password=guest 176 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/mq/manage-message-queues.html 177 | jmeter: 178 | image: duhon/jmeter:3.1 179 | user: '1000' 180 | environment: 181 | - DISPLAY 182 | # command: sh -c 'jmeter -Jhost=magento.test -Jbase_path=/ -Jfiles_folder=/var/www/magento2ce/setup/performance-toolkit/files/ -Djava.util.prefs.systemRoot=/tmp/ -Djava.util.prefs.userRoot=/tmp/ -j /dev/stdout' 183 | volumes: 184 | - ${MAGENTO_PATH}:/var/www 185 | - /tmp/.X11-unix:/tmp/.X11-unix 186 | - /etc/group:/etc/group:ro 187 | - /etc/passwd:/etc/passwd:ro 188 | - /etc/shadow:/etc/shadow:ro 189 | - /etc/sudoers.d:/etc/sudoers.d:ro 190 | networks: 191 | default: 192 | driver: bridge 193 | -------------------------------------------------------------------------------- /bundles/typical.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | web: 4 | image: nginx:1.20.0-alpine 5 | hostname: web 6 | volumes: 7 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 8 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf 9 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.crt:/etc/nginx/server.crt 10 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.key:/etc/nginx/server.key 11 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/fetch_env.js:/etc/nginx/fetch_env.js 12 | networks: 13 | default: 14 | aliases: 15 | - magento.test 16 | ports: 17 | - "${WEB_PORT}:80" 18 | - "${WEBS_PORT}:443" 19 | depends_on: 20 | - app 21 | # command: nginx-debug -g 'daemon off;' 22 | x-hint: uncomment the line above and change error_log in nginx.conf 23 | x-info: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/nginx.html 24 | db: 25 | image: mariadb:10.4 26 | hostname: db 27 | environment: 28 | MYSQL_ALLOW_EMPTY_PASSWORD: "yes" 29 | MYSQL_DATABASE: "magento" 30 | shm_size: '1gb' 31 | volumes: 32 | - ${MAGENTO_PATH}/magento-docker/etc/mysql/my.cnf:/etc/mysql/conf.d/mysql.cnf 33 | ports: 34 | - "${DB_PORT}:3306" 35 | x-hits: 36 | - bin/magento dev:query-log:enable and watch var/debug/db.log 37 | x-info: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/mysql.html 38 | app: 39 | image: duhon/php:7.4-fpm-2.4.2 40 | hostname: app 41 | ports: 42 | - "${SSH_PORT}:22" 43 | stop_signal: SIGKILL 44 | volumes: 45 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 46 | # - ${MAGENTO_PATH}/magento-docker/etc/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini 47 | - ${MAGENTO_PATH}/magento-docker/etc/php/tools:/usr/local/bin/magento2:ro 48 | # - ${MAGENTO_PATH}/magento-docker/etc/php/tideways.ini:/usr/local/etc/php/conf.d/tideways.ini 49 | # - ${MAGENTO_PATH}/magento-docker/etc/php/profiler.php:/usr/local/lib/php/header.php 50 | # - ${MAGENTO_PATH}/magento-docker/etc/php/append.ini:/usr/local/etc/php/conf.d/append.ini 51 | - ${MAGENTO_PATH}/magento-docker/etc/php/php.ini:/usr/local/etc/php/php.ini:ro 52 | - ${MAGENTO_PATH}/magento-docker/etc/php/php-fpm.conf:/usr/local/etc/php-fpm.conf 53 | - ${MAGENTO_PATH}/magento-docker/etc/php/tests/acceptance/.env:/var/www/magento2ce/dev/tests/acceptance/.env:rw 54 | - ${MAGENTO_PATH}/magento-docker/etc/php/tests/integration/install-config-mysql.php:/var/www/magento2ce/dev/tests/integration/etc/install-config-mysql.php:rw 55 | - ${MAGENTO_PATH}/magento-docker/etc/php/tests/api-functional/install-config-mysql.php:/var/www/magento2ce/dev/tests/api-functional/config/install-config-mysql.php:rw 56 | - ${MAGENTO_PATH}/magento-docker/etc/php/tests/api-functional/phpunit_rest.xml:/var/www/magento2ce/dev/tests/api-functional/phpunit_rest.xml:rw 57 | - ${MAGENTO_PATH}/magento-docker/etc/php/tests/api-functional/phpunit_graphql.xml:/var/www/magento2ce/dev/tests/api-functional/phpunit_graphql.xml:rw 58 | - ${MAGENTO_PATH}/magento-docker/etc/php/tests/api-functional/phpunit_soap.xml:/var/www/magento2ce/dev/tests/api-functional/phpunit_soap.xml:rw 59 | - ${MAGENTO_PATH}/magento-docker/etc/php/tests/setup-integration/install-config-mysql.php:/var/www/magento2ce/dev/tests/setup-integration/etc/install-config-mysql.php:rw 60 | - ${MAGENTO_PATH}/magento-docker/etc/php/tests/setup-integration/phpunit.xml:/var/www/magento2ce/dev/tests/setup-integration/phpunit.xml:rw 61 | environment: 62 | COMPOSER_HOME: /var/www/.composer 63 | PHP_IDE_CONFIG: serverName=magento.test 64 | command: sh -c 'service ssh start; php-fpm -R' 65 | x-hints: 66 | - magento reinstall ee b2b 67 | - magento sample_data 68 | - magento page_builder 69 | - docker-compose up --detach --force-recreate app 70 | x-setup: 71 | - bin/magento config:set web/seo/use_rewrites 1 72 | - bin/magento config:set dev/template/allow_symlink 1 73 | - bin/magento config:set admin/security/admin_account_sharing 1 74 | - bin/magento config:set admin/security/session_lifetime 31536000 75 | - bin/magento config:set system/media_storage_configuration/media_database default_setup 76 | - bin/magento dev:query-log:enable --query-time-threshold=1 77 | x-info: https://devdocs.magento.com/ 78 | mftf: 79 | image: selenium/standalone-chrome-debug:3.12.0 80 | ports: 81 | - "${MFTF_PORT}:5900" 82 | x-hints: 83 | - "vnc://localhost:5900 pass:secret" 84 | - magento prepare_tests 85 | - vendor/bin/mftf run:test 86 | x-info: https://devdocs.magento.com/mftf/docs/introduction.html 87 | elastic: 88 | image: elasticsearch:7.1.0 89 | hostname: elastic 90 | ports: 91 | - "${ELASTIC_PORT}:9200" 92 | environment: 93 | - cluster.name=magento-cluster 94 | - bootstrap.memory_lock=true 95 | - discovery.type=single-node 96 | - http.port=9200 97 | - http.cors.enabled=true 98 | - http.cors.allow-origin=* 99 | - http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization 100 | - http.cors.allow-credentials=true 101 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 102 | ulimits: 103 | memlock: 104 | soft: -1 105 | hard: -1 106 | x-hits: 107 | - curl -i http://localhost:9200/_cluster/health 108 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/elasticsearch/es-overview.html 109 | x-setup: 110 | - bin/magento config:set catalog/search/engine elasticsearch7 111 | redis: 112 | image: redis 113 | hostname: redis 114 | ports: 115 | - "${REDIS_PORT}:6379" 116 | sysctls: 117 | net.core.somaxconn: 1024 118 | ulimits: 119 | nproc: 65535 120 | nofile: 121 | soft: 20000 122 | hard: 40000 123 | x-hints: 124 | - redis-cli monitor 125 | - telnet localhost 6379 126 | x-setup: 127 | # - bin/magento setup:config:set -n --page-cache=redis --page-cache-redis-server=redis --cache-backend-redis-db=3 128 | - bin/magento setup:config:set -n --session-save=redis --session-save-redis-host=redis --cache-backend-redis-db=0 129 | - bin/magento setup:config:set -n --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=1 130 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/redis/config-redis.html 131 | rabbit: 132 | image: rabbitmq:management 133 | hostname: rabbitmq 134 | ports: 135 | - "${RABBIT_PORT}:15672" 136 | x-hints: 137 | - bin/magento queue:consumers:list 138 | - bin/magento queue:consumers:start 139 | - "http://localhost:15672/ user:guest pass:guest" 140 | x-setup: 141 | - bin/magento setup:config:set -n --amqp-host=rabbit --amqp-user=guest --amqp-password=guest 142 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/mq/manage-message-queues.html 143 | networks: 144 | default: 145 | driver: bridge 146 | -------------------------------------------------------------------------------- /etc/apache/apache2.conf: -------------------------------------------------------------------------------- 1 | ServerRoot "/etc/apache2" 2 | 3 | LoadModule access_compat_module /usr/lib/apache2/modules/mod_access_compat.so 4 | LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so 5 | LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so 6 | LoadModule authn_core_module /usr/lib/apache2/modules/mod_authn_core.so 7 | LoadModule authn_file_module /usr/lib/apache2/modules/mod_authn_file.so 8 | LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so 9 | LoadModule authz_host_module /usr/lib/apache2/modules/mod_authz_host.so 10 | LoadModule authz_user_module /usr/lib/apache2/modules/mod_authz_user.so 11 | LoadModule autoindex_module /usr/lib/apache2/modules/mod_autoindex.so 12 | LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so 13 | LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so 14 | LoadModule env_module /usr/lib/apache2/modules/mod_env.so 15 | LoadModule filter_module /usr/lib/apache2/modules/mod_filter.so 16 | LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so 17 | LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so 18 | LoadModule negotiation_module /usr/lib/apache2/modules/mod_negotiation.so 19 | LoadModule php7_module /usr/lib/apache2/modules/libphp7.so 20 | LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so 21 | LoadModule status_module /usr/lib/apache2/modules/mod_status.so 22 | 23 | LoadModule apreq_module /usr/lib/apache2/modules/mod_apreq2.so 24 | LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so 25 | LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so 26 | LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so 27 | LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so 28 | LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so 29 | 30 | User www-data 31 | Group root 32 | Listen 80 33 | ServerName magento.test 34 | Timeout 300 35 | KeepAlive On 36 | MaxKeepAliveRequests 100 37 | KeepAliveTimeout 5 38 | HostnameLookups Off 39 | ErrorLog /proc/self/fd/2 40 | LogLevel warn 41 | AccessFileName .htaccess 42 | CustomLog /dev/null common 43 | 44 | 45 | TypesConfig /etc/mime.types 46 | 47 | 48 | 49 | SetHandler application/x-httpd-php 50 | 51 | 52 | 53 | AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css 54 | AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript 55 | AddOutputFilterByType DEFLATE application/rss+xml 56 | AddOutputFilterByType DEFLATE application/xml 57 | 58 | 59 | 60 | StartServers 5 61 | MinSpareServers 5 62 | MaxSpareServers 10 63 | MaxRequestWorkers 150 64 | MaxConnectionsPerChild 0 65 | 66 | 67 | 68 | DocumentRoot /var/www/magento2ce 69 | 70 | 71 | Options Indexes FollowSymLinks 72 | AllowOverride All 73 | Require all granted 74 | 75 | 76 | # 77 | # LogLevel proxy:trace5 78 | # ProxyPass http://duhon.s3.amazonaws.com/media 79 | # ProxyPassReverse http://duhon.s3.amazonaws.com/media 80 | 81 | # PerlFixupHandler Apache2::Imager::Resize 82 | # PerlSetVar ImgResizeCacheDir '/tmp/' 83 | # PerlSetVar ImgResizeWidthParam 'width' 84 | # PerlSetVar ImgResizeHeightParam 'height' 85 | # 86 | 87 | -------------------------------------------------------------------------------- /etc/apache/httpd.conf: -------------------------------------------------------------------------------- 1 | ServerRoot "/usr/local/apache2" 2 | 3 | LoadModule mpm_event_module modules/mod_mpm_event.so 4 | LoadModule authn_file_module modules/mod_authn_file.so 5 | LoadModule authn_core_module modules/mod_authn_core.so 6 | LoadModule authz_host_module modules/mod_authz_host.so 7 | LoadModule authz_groupfile_module modules/mod_authz_groupfile.so 8 | LoadModule authz_user_module modules/mod_authz_user.so 9 | LoadModule authz_core_module modules/mod_authz_core.so 10 | LoadModule access_compat_module modules/mod_access_compat.so 11 | LoadModule auth_basic_module modules/mod_auth_basic.so 12 | LoadModule deflate_module modules/mod_deflate.so 13 | LoadModule filter_module modules/mod_filter.so 14 | LoadModule mime_module modules/mod_mime.so 15 | #LoadModule log_config_module modules/mod_log_config.so 16 | LoadModule env_module modules/mod_env.so 17 | LoadModule headers_module modules/mod_headers.so 18 | LoadModule setenvif_module modules/mod_setenvif.so 19 | LoadModule version_module modules/mod_version.so 20 | LoadModule proxy_module modules/mod_proxy.so 21 | LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so 22 | LoadModule unixd_module modules/mod_unixd.so 23 | LoadModule status_module modules/mod_status.so 24 | LoadModule autoindex_module modules/mod_autoindex.so 25 | LoadModule dir_module modules/mod_dir.so 26 | LoadModule alias_module modules/mod_alias.so 27 | LoadModule rewrite_module modules/mod_rewrite.so 28 | 29 | Listen 80 30 | ServerName magento.test 31 | Timeout 300 32 | KeepAlive On 33 | MaxKeepAliveRequests 100 34 | KeepAliveTimeout 5 35 | HostnameLookups Off 36 | ErrorLog /proc/self/fd/2 37 | LogLevel warn 38 | AccessFileName .htaccess 39 | 40 | 41 | User daemon 42 | Group root 43 | 44 | 45 | 46 | RequestHeader unset Proxy early 47 | 48 | 49 | 50 | SSLRandomSeed startup builtin 51 | SSLRandomSeed connect builtin 52 | 53 | 54 | 55 | AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css 56 | AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript 57 | AddOutputFilterByType DEFLATE application/rss+xml 58 | AddOutputFilterByType DEFLATE application/xml 59 | 60 | 61 | 62 | DocumentRoot /var/www/magento2ce 63 | 64 | 65 | ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://app:9000/var/www/magento2ce/$1 66 | 67 | 68 | 69 | Options Indexes FollowSymLinks 70 | AllowOverride All 71 | Require all granted 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /etc/apache/virtual_host.conf: -------------------------------------------------------------------------------- 1 | 2 | DocumentRoot /var/www/magento2ce 3 | LogLevel trace2 4 | 5 | 6 | Options Indexes FollowSymLinks 7 | AllowOverride All 8 | Require all granted 9 | 10 | 11 | 12 | PerlHandler Apache2::Imager::Resize 13 | PerlSetVar ImgResizeNoCache on 14 | PerlSetVar ImgResizeWidthParam 'width' 15 | PerlSetVar ImgResizeHeightParam 'height' 16 | 17 | 18 | -------------------------------------------------------------------------------- /etc/mongo/xhgui.js: -------------------------------------------------------------------------------- 1 | db.results.ensureIndex( { 'meta.SERVER.REQUEST_TIME' : -1 } ); 2 | db.results.ensureIndex( { 'profile.main().wt' : -1 } ); 3 | db.results.ensureIndex( { 'profile.main().mu' : -1 } ); 4 | db.results.ensureIndex( { 'profile.main().cpu' : -1 } ); 5 | db.results.ensureIndex( { 'meta.url' : 1 } ); -------------------------------------------------------------------------------- /etc/mysql/my.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | #log_output=file 3 | slow_query_log=OFF 4 | #long_query_time=0 5 | #log_slow_admin_statements=ON 6 | #log_slow_slave_statements=ON 7 | #innodb_monitor_enable=all 8 | 9 | #innodb_thread_sleep_delay = 0 10 | #innodb_flush_log_at_trx_commit = 0 11 | #innodb_buffer_pool_size = 8G 12 | #innodb_flush_method = O_DSYNC 13 | #innodb_log_file_size = 1G 14 | #innodb_log_buffer_size = 2M 15 | #innodb_thread_concurrency = 0 16 | #innodb_max_dirty_pages_pct_lwm 0 17 | #innodb_read_ahead_threshold 56 18 | #innodb_adaptive_max_sleep_delay 150000 19 | #innodb_buffer_pool_instances 8 20 | #innodb_io_capacity = 200 21 | max_connections = 64 22 | thread_cache_size = 16 23 | query_cache_size = 32M 24 | query_cache_limit = 1M 25 | max_allowed_packet = 128M 26 | -------------------------------------------------------------------------------- /etc/nginx/fetch_env.js: -------------------------------------------------------------------------------- 1 | function get_domain(r) { 2 | return process.env.UPSTREAM_PORT; 3 | } 4 | 5 | function get_mage_run_type(r) { 6 | return process.env.MAGE_RUN_TYPE; 7 | } 8 | 9 | function get_mage_debug_show_args(r) { 10 | return process.env.MAGE_DEBUG_SHOW_ARGS; 11 | } -------------------------------------------------------------------------------- /etc/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx root; 2 | worker_processes auto; 3 | 4 | env DOMAIN=magento.test; 5 | env MAGE_RUN_TYPE=website; 6 | env MAGE_DEBUG_SHOW_ARGS=0; 7 | 8 | pid /var/run/nginx.pid; 9 | load_module modules/ngx_http_js_module.so; 10 | load_module modules/ngx_http_image_filter_module.so; 11 | 12 | events { 13 | worker_connections 1024; 14 | } 15 | 16 | http { 17 | js_include fetch_env.js; 18 | js_set $domain get_domain; 19 | js_set $mage_run_type get_mage_run_type; 20 | js_set $mage_debug_show_args get_mage_debug_show_args; 21 | 22 | error_log /var/log/nginx/error.log error; 23 | include /etc/nginx/mime.types; 24 | default_type application/octet-stream; 25 | 26 | log_format mtail '$host $remote_addr - $remote_user [$time_local] ' 27 | '"$request" $status $body_bytes_sent $request_time ' 28 | '"$http_referer" "$http_user_agent" "$content_type" "$upstream_cache_status"'; 29 | 30 | access_log on; 31 | log_not_found off; 32 | log_subrequest off; 33 | rewrite_log off; 34 | #resolver 127.0.0.11; 35 | sendfile on; 36 | 37 | #timeout zone 38 | keepalive_timeout 65; 39 | client_body_timeout 11; 40 | client_header_timeout 12; 41 | proxy_read_timeout 13; 42 | send_timeout 14; 43 | fastcgi_read_timeout 6000s; 44 | fastcgi_connect_timeout 10s; 45 | client_max_body_size 100m; 46 | client_body_buffer_size 1m; 47 | tcp_nopush on; 48 | 49 | upstream fastcgi_backend { 50 | server app:9000; 51 | } 52 | 53 | server { 54 | listen 8080; 55 | location /nginx_status { 56 | access_log off; 57 | stub_status on; 58 | } 59 | location = /fpm_status { 60 | access_log off; 61 | include fastcgi_params; 62 | fastcgi_pass fastcgi_backend; 63 | } 64 | location = /fpm_ping { 65 | access_log off; 66 | include fastcgi_params; 67 | fastcgi_pass fastcgi_backend; 68 | } 69 | } 70 | 71 | server { 72 | # Enable QUIC and HTTP/3. 73 | #listen 443 quic reuseport; 74 | # Enable HTTP/2 (optional). 75 | listen 443 ssl http2; 76 | listen 80; 77 | 78 | server_name ~^(?[^.]*).$domain; 79 | set $MAGE_ROOT /var/www/magento2ce; 80 | 81 | ssl_certificate /etc/nginx/server.crt; 82 | ssl_certificate_key /etc/nginx/server.key; 83 | # Enable all TLS versions (TLSv1.3 is required for QUIC). 84 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; 85 | # Add Alt-Svc header to negotiate HTTP/3. 86 | #add_header alt-svc 'h3-23=":443"; ma=86400'; 87 | 88 | root $MAGE_ROOT/pub; 89 | index index.php; 90 | autoindex off; 91 | charset UTF-8; 92 | error_page 404 403 = /errors/404.php; 93 | add_header X-Frame-Options "SAMEORIGIN"; 94 | access_log /var/log/nginx/mtail.log mtail; 95 | 96 | gzip on; 97 | gzip_disable "msie6"; 98 | gzip_comp_level 6; 99 | gzip_min_length 1100; 100 | gzip_buffers 16 8k; 101 | gzip_proxied any; 102 | gzip_vary on; 103 | gzip_types 104 | text/plain 105 | text/css 106 | text/js 107 | text/xml 108 | text/javascript 109 | application/javascript 110 | application/x-javascript 111 | application/json 112 | application/xml 113 | application/xml+rss 114 | image/svg+xml; 115 | 116 | location @not_found_media { 117 | add_header Cache-Control "public"; 118 | expires +1y; 119 | try_files /get.php$is_args$args =404; 120 | } 121 | 122 | location / { 123 | proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict"; 124 | try_files $uri /index.php$is_args$args; 125 | } 126 | 127 | location = /favicon.ico { 128 | alias $MAGE_ROOT/pub/errors/default/images/favicon.ico; 129 | } 130 | 131 | # Setup 132 | location ~* ^/setup($|/) { 133 | root $MAGE_ROOT; 134 | location ~ ^/setup/index.php { 135 | fastcgi_pass fastcgi_backend; 136 | fastcgi_index index.php; 137 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 138 | include fastcgi_params; 139 | } 140 | } 141 | 142 | # Update 143 | location ~* ^/update($|/) { 144 | root $MAGE_ROOT; 145 | location ~ ^/update/index.php { 146 | fastcgi_split_path_info ^(/update/index.php)(/.+)$; 147 | fastcgi_pass fastcgi_backend; 148 | fastcgi_index index.php; 149 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 150 | fastcgi_param PATH_INFO $fastcgi_path_info; 151 | include fastcgi_params; 152 | } 153 | } 154 | 155 | # Static 156 | location /static/ { 157 | location ~ ^/static/version { 158 | rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last; 159 | } 160 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|html|json)$ { 161 | add_header Cache-Control "public"; 162 | expires +1y; 163 | if (!-f $request_filename) { 164 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; 165 | } 166 | } 167 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { 168 | add_header Cache-Control "no-store"; 169 | expires off; 170 | if (!-f $request_filename) { 171 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; 172 | } 173 | } 174 | if (!-f $request_filename) { 175 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; 176 | } 177 | } 178 | 179 | # Media 180 | location /media/ { 181 | # location ~* ^/media/.*\.jpe?g$ { 182 | # resolver 8.8.8.8; 183 | # set $bucket 'duhon'; 184 | # image_filter resize $arg_width $arg_height; 185 | # image_filter_interlace on; 186 | # image_filter_jpeg_quality 90; 187 | # image_filter_buffer 50M; 188 | # #error_page 415 = @not_found_media; 189 | # error_page 415 = http://s3.amazonaws.com/$bucket$uri; 190 | # proxy_pass http://s3.amazonaws.com/$bucket$uri; 191 | # proxy_pass_request_body off; 192 | # proxy_pass_request_headers off; 193 | # proxy_intercept_errors on; 194 | # proxy_hide_header "x-amz-id-2"; 195 | # proxy_hide_header "x-amz-request-id"; 196 | # proxy_hide_header "x-amz-storage-class"; 197 | # proxy_hide_header "Set-Cookie"; 198 | # proxy_ignore_headers "Set-Cookie"; 199 | # } 200 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { 201 | add_header Cache-Control "public"; 202 | expires +1y; 203 | try_files $uri /get.php$is_args$args; 204 | } 205 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { 206 | add_header Cache-Control "no-store"; 207 | expires off; 208 | try_files $uri /get.php$is_args$args; 209 | } 210 | } 211 | 212 | # Main 213 | location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ { 214 | include fastcgi_params; 215 | fastcgi_pass fastcgi_backend; 216 | fastcgi_buffers 16 16k; 217 | fastcgi_buffer_size 32k; 218 | fastcgi_index index.php; 219 | 220 | #set $MAGE_RUN_TYPE website or store; 221 | fastcgi_param MAGE_RUN_TYPE $mage_run_type; 222 | fastcgi_param MAGE_DEBUG_SHOW_ARGS $mage_debug_show_args; 223 | fastcgi_param MAGE_RUN_CODE $mage_code; 224 | fastcgi_param SERVER_NAME $host; 225 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 226 | } 227 | 228 | #only for function test 229 | location ~ ^/dev/tests/(acceptance|functional)/utils($|/) { 230 | root $MAGE_ROOT; 231 | fastcgi_pass fastcgi_backend; 232 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 233 | include fastcgi_params; 234 | } 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /etc/nginx/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDAzCCAeugAwIBAgIJAJlK257FtEoDMA0GCSqGSIb3DQEBBQUAMBgxFjAUBgNV 3 | BAMMDSoubWFnZW50by5jb20wHhcNMTkxMDI5MDAwOTU4WhcNMjkxMDI2MDAwOTU4 4 | WjAYMRYwFAYDVQQDDA0qLm1hZ2VudG8uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC 5 | AQ8AMIIBCgKCAQEAxp8LBfuhoOwWzvYXB6NoncmnrxCc6h9FGQdyAK2nFTJ5vIXK 6 | +ZRVSBvGn69BSeZyThTdOmSa47I+7RJg3rW1siVyv187rZNH8yWHex6+DvsxTL9X 7 | uGjwbd/8vN71feQ9u+z2WODAWbXuOk/fijQAj8Vz2S8Nx/G7WKY+Q3wvQRQGQmlO 8 | CDJyyNKYCf8zDJM0bXGdKPzWEajiWrcDCVXblp9dWH5tIxL5D8qFxJ3CEMXpix5L 9 | 9lbwsFN3jAMlSqugYFxCtVUJr7lVjCYhzPiIeoJiAN/kspD0URC3woj+/YSV0nQD 10 | 4ee/fFNiDnJgYXA9WC2uGLQzZ7QOMEqelbDk0wIDAQABo1AwTjAdBgNVHQ4EFgQU 11 | FsYuVWjZPe/VkvGOcL+AS+cMXqgwHwYDVR0jBBgwFoAUFsYuVWjZPe/VkvGOcL+A 12 | S+cMXqgwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAH9cYQfQq1OZy 13 | yGL26dPLsBAv/hzdvlRqCr29dlDQSgRRWLoiqwN+I63hNcKYboxBm5CkL5CvVncO 14 | cbAgu8w+0hpjXDktxtpu9EWtxrZR8XYr+ihfwO2/tUHLjxlG85UU/rXoehUhJ7Yr 15 | lWod7uutyXaR9titTIX8nDRlqJxK3UfKgzQMGtMbzXZY1kWgrBsitrfWVihUgjIM 16 | jIFnKr2BUCH7NP05lEUOBV1sYI9QLBXr0hS1LfGQCgGkpUnWhLTQif+NSnNC1dqw 17 | TSC9MnG82hB32/Qqb8ZO8ucqcEL4iw9RrbkxZYsYWypSFYm8YKczZ4ftb5XsdnX3 18 | qXpk5N3+vw== 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /etc/nginx/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAxp8LBfuhoOwWzvYXB6NoncmnrxCc6h9FGQdyAK2nFTJ5vIXK 3 | +ZRVSBvGn69BSeZyThTdOmSa47I+7RJg3rW1siVyv187rZNH8yWHex6+DvsxTL9X 4 | uGjwbd/8vN71feQ9u+z2WODAWbXuOk/fijQAj8Vz2S8Nx/G7WKY+Q3wvQRQGQmlO 5 | CDJyyNKYCf8zDJM0bXGdKPzWEajiWrcDCVXblp9dWH5tIxL5D8qFxJ3CEMXpix5L 6 | 9lbwsFN3jAMlSqugYFxCtVUJr7lVjCYhzPiIeoJiAN/kspD0URC3woj+/YSV0nQD 7 | 4ee/fFNiDnJgYXA9WC2uGLQzZ7QOMEqelbDk0wIDAQABAoIBAFWVTDusvG1JrV5K 8 | PYwmBjsPHDjb8LEU/kIVqjLOoJMKp9fq0pYOK10h0skVzA0axiAM73JszSzVrjWa 9 | 2LC+HWeAqVv6ng1hy/viLOmJSp3L8Oc//31PgmHlxNJhQ+iWA1/JcDDFzzwYn2jy 10 | 58B2PdO1YgCwPMDt0SsWnveXOAlS4+OEDJ9b3NRFeL8fAk3/+/aFsJYPrjKGsqkM 11 | 0XQ9M+UCOQP9QTh4R8LnpNgIXWysoz4fVnk2oIEw+BvGBMVn237onDVz0YjLiomh 12 | WO/iDrUxN8Hx5UYfzAwNhmbqZFeVM1QMT6x2pTsGz2YhCCkGpqrC69Mx5uRbvquM 13 | AlJtwBECgYEA7wVHcH6x2srkyf7v+U0UAEyYhQNxWb6DfWRKjxxjIww4slSUe6f3 14 | KqfBx/XtTy+KTRooCwRg6z+/mkal3eJ2awEFjYkiuSwCPYNYkK3sUU3n50cCWnj2 15 | hZwvFkLM4wpYH7dWUi+9fhm40P2foNUQOIusOeqdG9+/WKgaHOdMMBkCgYEA1LsU 16 | W0fYgk5a6F9/XuhHpEN/2lA0X4Wa/8apkVVeDg2otbXrzMAFE7gmsjA5Cw/GQl5t 17 | RNjuKf5P4S41wfD2xDEq0hdIQMoW/pqq5TXm3pWJeRfAKCCXSQEuKFEV8hqYMj+i 18 | j241FRXM+dYC9wKpwpcF6ctjRLFjb0D3BgiA6csCgYAUxiCvZlOO8JNx+vZgdJKI 19 | dB/Nb78qTaSgAVd5mL4FDcrftPoyxSZ2Tp5JAtbdSwR6LwvL6VWDHMdKYVmJL2Wb 20 | ZztUUdbywSBwuDm6WWNwrZS6RTGvK1RByJFPHf8wvHVsTEL0YbHWg+XMRD7be6kt 21 | QPZ3Ei0VfxziV7ntSS0WAQKBgALvMbCwpQPnIMnjx1X/zj0t0S2pvY8zwJeWnfAr 22 | RUjcV19qSv5gB7Hl8GK015SXexyfQNKaS26421E32fX65Ox/4R9UwuJh5z9L0t+m 23 | hrC7T1IkSbpD+NJA+eoEdFEKnN7UkeF4m7LWwiUQFqphlwXgH2zCKXRhHgYC12V1 24 | 6JFRAoGBAMyi0xIbTeOQ5bbHxbJNzQz8XKWxoj8V5iAwSyGI8uW1NuhmhSbw8z6Y 25 | rwCUiYluWi99vAclW4jDzMdCPNOVX4m5516iO3L7dtGcPz7UTCR/j0soieJV1tx/ 26 | ogjaAtfBZbALnWXvovi3bfdTxAxyZ7/gavmspLHi0mzy1Di28aVM 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /etc/nodejs/Gruntfile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © Magento, Inc. All rights reserved. 3 | * See COPYING.txt for license details. 4 | */ 5 | 6 | // For performance use one level down: 'name/{,*/}*.js' 7 | // If you want to recursively match all subfolders, use: 'name/**/*.js' 8 | 9 | module.exports = function (grunt) { 10 | 'use strict'; 11 | 12 | var _ = require('underscore'), 13 | path = require('path'), 14 | filesRouter = require('./dev/tools/grunt/tools/files-router'), 15 | configDir = './dev/tools/grunt/configs', 16 | tasks = grunt.file.expand('./dev/tools/grunt/tasks/*'), 17 | themes; 18 | 19 | filesRouter.set('themes', 'dev/tools/grunt/configs/themes'); 20 | themes = filesRouter.get('themes'); 21 | 22 | tasks = _.map(tasks, function(task){ return task.replace('.js', '') }); 23 | tasks.push('time-grunt'); 24 | tasks.forEach(function (task) { 25 | require(task)(grunt); 26 | }); 27 | 28 | require('load-grunt-config')(grunt, { 29 | configPath: path.join(__dirname, configDir), 30 | init: true, 31 | jitGrunt: { 32 | staticMappings: { 33 | usebanner: 'grunt-banner' 34 | } 35 | } 36 | }); 37 | 38 | _.each({ 39 | /** 40 | * Assembling tasks. 41 | * ToDo: define default tasks. 42 | */ 43 | default: function () { 44 | grunt.log.subhead('I\'m default task and at the moment I\'m empty, sorry :/'); 45 | }, 46 | 47 | /** 48 | * Production preparation task. 49 | */ 50 | prod: function (component) { 51 | var tasks = [ 52 | 'less', 53 | 'autoprefixer', 54 | 'cssmin', 55 | 'usebanner' 56 | ].map(function(task){ 57 | return task + ':' + component; 58 | }); 59 | 60 | if (typeof component === 'undefined') { 61 | grunt.log.subhead('Tip: Please make sure that u specify prod subtask. By default prod task do nothing'); 62 | } else { 63 | grunt.task.run(tasks); 64 | } 65 | }, 66 | 67 | /** 68 | * Refresh themes. 69 | */ 70 | refresh: function () { 71 | var tasks = [ 72 | 'clean', 73 | 'exec:all' 74 | ]; 75 | _.each(themes, function(theme, name) { 76 | tasks.push('less:' + name); 77 | }); 78 | grunt.task.run(tasks); 79 | }, 80 | 81 | /** 82 | * Documentation 83 | */ 84 | documentation: [ 85 | 'replace:documentation', 86 | 'less:documentation', 87 | 'styledocco:documentation', 88 | 'usebanner:documentationCss', 89 | 'usebanner:documentationLess', 90 | 'usebanner:documentationHtml', 91 | 'clean:var', 92 | 'clean:pub' 93 | ], 94 | 95 | 'legacy-build': [ 96 | 'mage-minify:legacy' 97 | ], 98 | 99 | spec: function (theme) { 100 | var runner = require('./dev/tests/js/jasmine/spec_runner'); 101 | 102 | runner.init(grunt, { theme: theme }); 103 | 104 | grunt.task.run(runner.getTasks()); 105 | } 106 | }, function (task, name) { 107 | grunt.registerTask(name, task); 108 | }); 109 | }; 110 | -------------------------------------------------------------------------------- /etc/nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "magento2", 3 | "author": "Magento Commerce Inc.", 4 | "description": "Magento2 node modules dependencies for local development", 5 | "license": "(OSL-3.0 OR AFL-3.0)", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/magento/magento2.git" 9 | }, 10 | "homepage": "http://magento.com/", 11 | "devDependencies": { 12 | "glob": "~7.1.1", 13 | "grunt": "~1.0.1", 14 | "grunt-autoprefixer": "~3.0.4", 15 | "grunt-banner": "~0.6.0", 16 | "grunt-continue": "~0.1.0", 17 | "grunt-contrib-clean": "~1.1.0", 18 | "grunt-contrib-connect": "~1.0.2", 19 | "grunt-contrib-cssmin": "~2.2.1", 20 | "grunt-contrib-imagemin": "~2.0.1", 21 | "grunt-contrib-jasmine": "~1.1.0", 22 | "grunt-contrib-less": "~1.4.1", 23 | "grunt-contrib-watch": "~1.0.0", 24 | "grunt-eslint": "~20.1.0", 25 | "grunt-exec": "~3.0.0", 26 | "grunt-jscs": "~3.0.1", 27 | "grunt-replace": "~1.0.1", 28 | "grunt-styledocco": "~0.3.0", 29 | "grunt-template-jasmine-requirejs": "~0.2.3", 30 | "grunt-text-replace": "~0.4.0", 31 | "imagemin-svgo": "~5.2.1", 32 | "load-grunt-config": "~0.19.2", 33 | "morgan": "~1.9.0", 34 | "node-minify": "~2.3.1", 35 | "path": "~0.12.7", 36 | "serve-static": "~1.13.1", 37 | "squirejs": "~0.2.1", 38 | "strip-json-comments": "~2.0.1", 39 | "time-grunt": "~1.4.0", 40 | "underscore": "~1.8.0" 41 | } 42 | } -------------------------------------------------------------------------------- /etc/php/Memory.php: -------------------------------------------------------------------------------- 1 | getName()] = memory_get_usage(true); 89 | } 90 | 91 | /** 92 | * {@inheritdoc} 93 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 94 | */ 95 | public function endTest(\PHPUnit\Framework\Test $test, $time) 96 | { 97 | self::$memUse[\get_class($test)][$test->getName()] = $this->convert( 98 | memory_get_usage(true) - self::$memUse[\get_class($test)][$test->getName()] 99 | ); 100 | } 101 | 102 | /** 103 | * {@inheritdoc} 104 | */ 105 | public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, $time) 106 | { 107 | } 108 | 109 | /** 110 | * @param $size 111 | * @return string 112 | */ 113 | private function convert($size) 114 | { 115 | $unit = ['b','kb','mb','gb','tb','pb']; 116 | if ($size > 0) { 117 | return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; 118 | } 119 | return '0b'; 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /etc/php/allow_symlinks.patch: -------------------------------------------------------------------------------- 1 | Index: lib/internal/Magento/Framework/Filesystem/Directory/ReadFactory.php 2 | IDEA additional info: 3 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 4 | <+>UTF-8 5 | =================================================================== 6 | --- lib/internal/Magento/Framework/Filesystem/Directory/ReadFactory.php (revision Local Version) 7 | +++ lib/internal/Magento/Framework/Filesystem/Directory/ReadFactory.php (revision Shelved Version) 8 | @@ -43,8 +43,7 @@ 9 | return new Read( 10 | $factory, 11 | $driver, 12 | - $path, 13 | - new PathValidator($driver) 14 | + $path 15 | ); 16 | } 17 | } 18 | Index: lib/internal/Magento/Framework/View/Element/Template/File/Validator.php 19 | IDEA additional info: 20 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 21 | <+>UTF-8 22 | =================================================================== 23 | --- lib/internal/Magento/Framework/View/Element/Template/File/Validator.php (revision Local Version) 24 | +++ lib/internal/Magento/Framework/View/Element/Template/File/Validator.php (revision Shelved Version) 25 | @@ -117,8 +117,9 @@ 26 | ($this->isPathInDirectories($filename, $this->_compiledDir) 27 | || $this->isPathInDirectories($filename, $this->moduleDirs) 28 | || $this->isPathInDirectories($filename, $this->_themesDir) 29 | - || $this->_isAllowSymlinks) 30 | - && $this->getRootDirectory()->isFile($this->getRootDirectory()->getRelativePath($filename)); 31 | + ) 32 | + && $this->getRootDirectory()->isFile($this->getRootDirectory()->getRelativePath($filename)) 33 | + || $this->_isAllowSymlinks; 34 | } 35 | return $this->_templatesValidationResults[$filename]; 36 | } 37 | -------------------------------------------------------------------------------- /etc/php/append.ini: -------------------------------------------------------------------------------- 1 | auto_prepend_file=header.php 2 | -------------------------------------------------------------------------------- /etc/php/blackfire.ini: -------------------------------------------------------------------------------- 1 | extension=blackfire.so 2 | blackfire.agent_socket=tcp://blackfire:8707 -------------------------------------------------------------------------------- /etc/php/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "secure-http": false 4 | } 5 | } 6 | 7 | -------------------------------------------------------------------------------- /etc/php/fpm_sock.conf: -------------------------------------------------------------------------------- 1 | [www] 2 | listen = /var/run/fpm.sock 3 | listen.mode = 0666 4 | -------------------------------------------------------------------------------- /etc/php/newrelic.ini: -------------------------------------------------------------------------------- 1 | extension=newrelic.so 2 | 3 | newrelic.appname="dev" 4 | newrelic.license="" 5 | newrelic.daemon.address=newrelic:31339 6 | -------------------------------------------------------------------------------- /etc/php/php-fpm.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | error_log = /proc/1/fd/2 3 | log_level = notice 4 | daemonize = no 5 | [www] 6 | access.log = /dev/null 7 | clear_env = no 8 | catch_workers_output = yes 9 | process.dumpable = yes 10 | user = www-data 11 | group = root 12 | listen = 0.0.0.0:9000 13 | pm = static 14 | pm.max_children = 4 15 | pm.status_path = /status 16 | ping.path = /ping 17 | -------------------------------------------------------------------------------- /etc/php/php.ini: -------------------------------------------------------------------------------- 1 | ; Basic configuration override 2 | expose_php = off 3 | memory_limit = 2047M 4 | post_max_size = 1000M 5 | upload_max_filesize = 1000M 6 | date.timezone = UTC 7 | max_execution_time = 18000 8 | session.auto_start = off 9 | zlib.output_compression = off 10 | suhosin.session.cryptua = off 11 | always_populate_raw_post_data = -1 12 | session.save_path = /tmp 13 | max_input_vars = 100000 14 | max_input_nesting_level = 100000 15 | 16 | ; Error reporting 17 | display_errors = off 18 | display_startup_errors = off 19 | error_reporting = E_ALL 20 | log_errors = on 21 | error_log = /proc/1/fd/2 22 | opcache.error_log = /proc/1/fd/2 23 | report_memleaks = On 24 | track_errors = Off 25 | 26 | ; A bit of performance tuning 27 | realpath_cache_size = 4096K 28 | realpath_cache_ttl = 10 29 | 30 | ; OpCache tuning 31 | opcache.blacklist_filename = "" 32 | opcache.consistency_checks = 0 33 | opcache.dups_fix = Off 34 | opcache.enable = On 35 | opcache.enable_cli = On 36 | opcache.enable_file_override = On 37 | opcache.file_cache = "/tmp/php-file-cache" 38 | opcache.file_cache_consistency_checks = 1 39 | opcache.file_cache_only = Off 40 | opcache.file_update_protection = 2 41 | opcache.force_restart_timeout = 180 42 | opcache.huge_code_pages = Off 43 | opcache.inherited_hack = On 44 | opcache.interned_strings_buffer = 8 45 | opcache.lockfile_path = /tmp 46 | opcache.log_verbosity_level = 1 47 | opcache.max_accelerated_files = 100000 48 | opcache.max_file_size = 0 49 | opcache.max_wasted_percentage = 5 50 | opcache.memory_consumption = 256 51 | opcache.opt_debug_level = 0 52 | opcache.optimization_level = 0x7FFFBFFF 53 | opcache.preferred_memory_model = "" 54 | opcache.protect_memory = 0 55 | opcache.restrict_api = "" 56 | opcache.revalidate_freq = 10 57 | opcache.revalidate_path = Off 58 | opcache.save_comments = 1 59 | opcache.use_cwd = On 60 | opcache.validate_permission = Off 61 | opcache.validate_root = On 62 | opcache.validate_timestamps = On 63 | 64 | ; Mail hog 65 | sendmail_path = "/usr/local/bin/mhsendmail --smtp-addr=mail:1025" -------------------------------------------------------------------------------- /etc/php/profiler.php: -------------------------------------------------------------------------------- 1 | $value) { 40 | $profile[strtr($key, ['.' => '_'])] = $value; 41 | } 42 | $data = [ 43 | 'profile' => $profile, 44 | 'meta' => [ 45 | 'server' => $_SERVER, 46 | 'get' => $_GET, 47 | 'env' => $_ENV, 48 | ] 49 | ]; 50 | 51 | try { 52 | self::send('http://xhgui/api.php', $data); 53 | } catch (Exception $e) { 54 | error_log('xhgui - ' . $e->getMessage()); 55 | } 56 | } 57 | 58 | private static function send($url, $data) 59 | { 60 | $options = [ 61 | 'http' => [ 62 | 'header' => "Content-type: application/json\r\n", 63 | 'method' => 'POST', 64 | 'content' => json_encode($data) 65 | ] 66 | ]; 67 | 68 | $context = stream_context_create($options); 69 | $result = file_get_contents($url, false, $context); 70 | if ($result === false) { 71 | error_log(file_get_contents('php://input')); 72 | throw new Exception('fail to send data'); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /etc/php/spx.ini: -------------------------------------------------------------------------------- 1 | extension=spx.so 2 | 3 | spx.http_enabled=1 4 | spx.http_key="dev" 5 | spx.http_ip_whitelist=* 6 | -------------------------------------------------------------------------------- /etc/php/tests/acceptance/.env: -------------------------------------------------------------------------------- 1 | MAGENTO_BASE_URL=http://magento.test/ 2 | MAGENTO_BACKEND_NAME=admin 3 | MAGENTO_ADMIN_USERNAME=admin 4 | MAGENTO_ADMIN_PASSWORD=123123q 5 | SELENIUM_CLOSE_ALL_SESSIONS=true 6 | BROWSER=chrome 7 | MODULE_ALLOWLIST=Magento_Framework,ConfigurableProductWishlist,ConfigurableProductCatalogSearch 8 | BROWSER_LOG_BLOCKLIST=other 9 | ELASTICSEARCH_VERSION=7 10 | MODULE_WHITELIST=Magento_Framework,Magento_ConfigurableProductWishlist,Magento_ConfigurableProductCatalogSearch 11 | SELENIUM_HOST=mftf 12 | SELENIUM_PORT=4444 13 | SELENIUM_PROTOCOL=http 14 | SELENIUM_PATH=/wd/hub 15 | WAIT_TIMEOUT=60 16 | -------------------------------------------------------------------------------- /etc/php/tests/api-functional/install-config-mysql.php: -------------------------------------------------------------------------------- 1 | 'en_US', 8 | 'timezone' => 'America/Los_Angeles', 9 | 'currency' => 'USD', 10 | 'db-host' => 'db', 11 | 'db-name' => 'magento_integration_tests', 12 | 'db-user' => 'root', 13 | 'db-password' => '', 14 | // 'db-prefix' => 'api_graphql_', // need rewrite many tests 15 | 'search-engine' => 'elasticsearch7', 16 | 'elasticsearch-host' => 'elastic', 17 | 'elasticsearch-port' => '9200', 18 | 'backend-frontname' => 'backend', 19 | 'base-url' => 'http://magento.test/', 20 | 'use-secure' => '0', 21 | 'use-rewrites' => '0', 22 | 'admin-lastname' => 'Admin', 23 | 'admin-firstname' => 'Admin', 24 | 'admin-email' => 'admin@example.com', 25 | 'admin-user' => 'admin', 26 | 'admin-password' => '123123q', 27 | 'admin-use-security-key' => '0', 28 | /* PayPal has limitation for order number - 20 characters. 10 digits prefix + 8 digits number is good enough */ 29 | 'sales-order-increment-prefix' => time(), 30 | 'session-save' => 'db', 31 | 'cleanup-database' => true, 32 | 'amqp-host' => 'rabbit', 33 | 'amqp-port' => '5672', 34 | 'amqp-user' => 'guest', 35 | 'amqp-password' => 'guest', 36 | ]; 37 | -------------------------------------------------------------------------------- /etc/php/tests/api-functional/phpunit_graphql.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 19 | 20 | 21 | 22 | testsuite/Magento/WebApiTest.php 23 | 24 | 25 | testsuite/Magento/GraphQl 26 | 27 | 28 | 29 | 30 | 31 | ./testsuite 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | var/allure-results 64 | true 65 | 66 | 67 | codingStandardsIgnoreStart 68 | 69 | 70 | codingStandardsIgnoreEnd 71 | 72 | 73 | expectedExceptionMessageRegExp 74 | 75 | 76 | magentoAdminConfigFixture 77 | 78 | 79 | magentoAppArea 80 | 81 | 82 | magentoAppIsolation 83 | 84 | 85 | magentoCache 86 | 87 | 88 | magentoComponentsDir 89 | 90 | 91 | magentoConfigFixture 92 | 93 | 94 | magentoDataFixture 95 | 96 | 97 | magentoDataFixtureBeforeTransaction 98 | 99 | 100 | magentoDbIsolation 101 | 102 | 103 | magentoIndexerDimensionMode 104 | 105 | 106 | magentoApiDataFixture 107 | 108 | 109 | Override 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /etc/php/tests/api-functional/phpunit_rest.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 19 | 20 | 21 | 22 | testsuite/Magento/WebApiTest.php 23 | 24 | 25 | testsuite 26 | ../../../app/code/*/*/Test/Api 27 | testsuite/Magento/GraphQl 28 | 29 | 30 | 31 | 32 | 33 | ./testsuite 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | var/allure-results 70 | true 71 | 72 | 73 | codingStandardsIgnoreStart 74 | 75 | 76 | codingStandardsIgnoreEnd 77 | 78 | 79 | expectedExceptionMessageRegExp 80 | 81 | 82 | magentoAdminConfigFixture 83 | 84 | 85 | magentoAppArea 86 | 87 | 88 | magentoAppIsolation 89 | 90 | 91 | magentoCache 92 | 93 | 94 | magentoComponentsDir 95 | 96 | 97 | magentoConfigFixture 98 | 99 | 100 | magentoDataFixture 101 | 102 | 103 | magentoDataFixtureBeforeTransaction 104 | 105 | 106 | magentoDbIsolation 107 | 108 | 109 | magentoIndexerDimensionMode 110 | 111 | 112 | magentoApiDataFixture 113 | 114 | 115 | Override 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /etc/php/tests/api-functional/phpunit_soap.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 19 | 20 | 21 | 22 | testsuite/Magento/WebApiTest.php 23 | 24 | 25 | testsuite 26 | 27 | ../../../app/code/*/*/Test/Api 28 | 29 | 30 | 31 | 32 | 33 | ./testsuite 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | var/allure-results 69 | true 70 | 71 | 72 | codingStandardsIgnoreStart 73 | 74 | 75 | codingStandardsIgnoreEnd 76 | 77 | 78 | expectedExceptionMessageRegExp 79 | 80 | 81 | magentoAdminConfigFixture 82 | 83 | 84 | magentoAppArea 85 | 86 | 87 | magentoAppIsolation 88 | 89 | 90 | magentoCache 91 | 92 | 93 | magentoComponentsDir 94 | 95 | 96 | magentoConfigFixture 97 | 98 | 99 | magentoDataFixture 100 | 101 | 102 | magentoDataFixtureBeforeTransaction 103 | 104 | 105 | magentoDbIsolation 106 | 107 | 108 | magentoIndexerDimensionMode 109 | 110 | 111 | magentoApiDataFixture 112 | 113 | 114 | Override 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /etc/php/tests/functional/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | ANY 13 | 14 | 15 | 16 | 17 | 18 | testCase 19 | admin 20 | 123123q 21 | http://magento.test/admin/ 22 | admin/auth/login 23 | 24 | 25 | dev/tests/functional/isolation.php 26 | none 27 | none 28 | none 29 | 30 | 31 | db 32 | root 33 | magento 34 | http://magento.test/ 35 | backend 36 | 37 | 38 | 39 | hmnxrnxd4l0oii0uvyaflm5fdha1mybf 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /etc/php/tests/functional/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 15 | 16 | 17 | tests 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /etc/php/tests/integration/install-config-mysql.php: -------------------------------------------------------------------------------- 1 | 'db', 8 | 'db-user' => 'root', 9 | 'db-password' => '', 10 | 'db-name' => 'magento_integration_tests', 11 | 'db-prefix' => '', 12 | 'search-engine' => 'elasticsearch7', 13 | 'elasticsearch-host' => 'elastic', 14 | 'elasticsearch-port' => '9200', 15 | 'backend-frontname' => 'backend', 16 | 'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, 17 | 'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, 18 | 'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, 19 | 'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, 20 | 'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME 21 | ]; 22 | -------------------------------------------------------------------------------- /etc/php/tests/setup-integration/install-config-mysql.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'db-host' => 'db', 10 | 'db-user' => 'root', 11 | 'db-password' => '', 12 | 'db-name' => 'magento_integration_tests', 13 | 'db-prefix' => '', 14 | 'backend-frontname' => 'admin', 15 | 'admin-user' => 'admin', 16 | 'admin-password' => '123123q', 17 | 'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, 18 | 'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, 19 | 'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME, 20 | 'enable-modules' => 'Magento_TestSetupModule2,Magento_TestSetupModule1,Magento_Backend', 21 | 'disable-modules' => 'all' 22 | ], 23 | 'checkout' => [ 24 | 'host' => 'db', 25 | 'username' => 'root', 26 | 'password' => '', 27 | 'dbname' => 'magento_integration_tests_checkout' 28 | ], 29 | 'sales' => [ 30 | 'host' => 'db', 31 | 'username' => 'root', 32 | 'password' => '', 33 | 'dbname' => 'magento_integration_tests_sales' 34 | ] 35 | ]; 36 | -------------------------------------------------------------------------------- /etc/php/tests/setup-integration/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 16 | 17 | 18 | 19 | testsuite 20 | 21 | 22 | 23 | 24 | 25 | ../../../app/code/Magento 26 | ../../../lib/internal/Magento 27 | 28 | 29 | 30 | 31 | . 32 | testsuite 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | var/allure-results 49 | true 50 | 51 | 52 | codingStandardsIgnoreStart 53 | 54 | 55 | codingStandardsIgnoreEnd 56 | 57 | 58 | expectedExceptionMessageRegExp 59 | 60 | 61 | magentoAdminConfigFixture 62 | 63 | 64 | magentoAppArea 65 | 66 | 67 | magentoAppIsolation 68 | 69 | 70 | magentoCache 71 | 72 | 73 | magentoComponentsDir 74 | 75 | 76 | magentoConfigFixture 77 | 78 | 79 | magentoDataFixture 80 | 81 | 82 | magentoDataFixtureBeforeTransaction 83 | 84 | 85 | magentoDbIsolation 86 | 87 | 88 | magentoIndexerDimensionMode 89 | 90 | 91 | moduleName 92 | 93 | 94 | dataProviderFromFile 95 | 96 | 97 | magentoSchemaFixture 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /etc/php/tideways.ini: -------------------------------------------------------------------------------- 1 | extension=tideways.so 2 | 3 | tideways.auto_start=1 4 | tideways.log_level=2 5 | tideways.sample_rate=100 6 | tideways.udp_connection="tideways:8135" 7 | tideways.connection="tcp://tideways:9135" 8 | tideways.enable_cli=0 9 | tideways.monitor_cli=0 10 | tideways.framework=all 11 | tideways.timeout=10000 12 | tideways.service=web 13 | tideways.monitor=basic 14 | tideways.collect=full 15 | tideways.backtrace_limit=100 16 | tideways.stack_threshold=5000 17 | tideways.traces_only_keep_minimum_ms=0 18 | tideways.batch_threshold=500 19 | tideways.event_threshold=100 20 | tideways.clock_source=0 21 | tideways.log_segfaults=0 22 | tideways.disable_at_memory_percentage=90 23 | tideways.features.stopwatch_fio=0 24 | 25 | tideways.dynamic_tracepoints.enable_web=1 26 | tideways.dynamic_tracepoints.enable_cli=1 27 | tideways.features.phpinfo=1 28 | -------------------------------------------------------------------------------- /etc/php/tideways_xhprof.ini: -------------------------------------------------------------------------------- 1 | extension=tideways_xhprof.so 2 | 3 | tideways.load_library=0 4 | tideways.auto_prepend_library=0 5 | tideways.auto_start=0 6 | 7 | -------------------------------------------------------------------------------- /etc/php/tools/inventory: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | shopt -s extglob 4 | 5 | cp -rlf ../inventory/!(.git|dev|_metapackage|.github|..|.) ./app/code/Magento/ 6 | cp -rlf ../inventory/dev/tests/!(.git|vendor|..|.) ./dev/tests/ 7 | composer config minimum-stability dev 8 | #TODO: the batter way https://github.com/magento/inventory/wiki/Metapackage-Installation-Guide 9 | 10 | bin/magento setup:upgrade 11 | -------------------------------------------------------------------------------- /etc/php/tools/layout_debugger: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #https://github.com/nathanjosiah/magento2-layout-debugger 3 | 4 | ! composer show nathanjosiah/magento2-layout-debugger >/dev/null 2>&1 5 | isset=$? 6 | 7 | if [[ ${isset} != 1 ]]; then 8 | composer require nathanjosiah/magento2-layout-debugger:dev-master 9 | bin/magento setup:upgrade 10 | bin/magento setup:di:compile 11 | #bin/magento setup:static-content:deploy 12 | fi 13 | 14 | set +e 15 | bin/magento config:show dev/debug/layout_debugger_comments_enabled_frontend >/dev/null 2>&1 16 | enable=$? 17 | set -e 18 | 19 | bin/magento config:set dev/debug/layout_debugger_comments_enabled_frontend ${enable} -------------------------------------------------------------------------------- /etc/php/tools/link_edition: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | |\tLink or Unlink EE code\t\tDefault: link 19 | --source \tPath to EE clone\t\tDefault: $ee 20 | --exclude |\tExclude EE files from CE\tDefault: true 21 | --help\t\t\t\tThis help 22 | "; 23 | exit(0); 24 | } 25 | 26 | if (!file_exists($ce)) { 27 | echo "Expected $ce folder not found" . PHP_EOL; 28 | exit(1); 29 | } 30 | 31 | if (!file_exists($ee)) { 32 | echo "Expected $ee folder not found" . PHP_EOL; 33 | exit(1); 34 | } 35 | 36 | $excludePaths = []; 37 | $unusedPaths = []; 38 | 39 | switch ($command) { 40 | case 'link': 41 | foreach (scanFiles($ee) as $filename) { 42 | $target = preg_replace('#^' . preg_quote($ee) . "#", '', $filename); 43 | $link = str_repeat('../', substr_count($target, '/') - 1) . $filename; 44 | if (!file_exists(dirname($ce . $target))) { 45 | symlink(dirname($link), dirname($ce . $target)); 46 | $excludePaths[] = resolvePath(dirname($target)); 47 | } elseif (!file_exists($ce . $target)) { 48 | if (is_link(dirname($ce . $target))) { 49 | continue; 50 | } 51 | symlink($link, $ce . $target); 52 | $excludePaths[] = resolvePath($target); 53 | } else { 54 | continue; 55 | } 56 | 57 | echo end($excludePaths) . PHP_EOL; 58 | } 59 | /* unlink broken links */ 60 | foreach (scanFiles($ce) as $filename) { 61 | if (is_link($filename) && !file_exists($filename)) { 62 | $unusedPaths[] = resolvePath(preg_replace('#^' . preg_quote($ce) . "#", '', $filename)); 63 | unlinkFile($filename); 64 | } 65 | } 66 | 67 | setExcludePaths($excludePaths, $unusedPaths, ($isExclude)?$excludeFile:false); 68 | 69 | echo "All symlinks completed:" . PHP_EOL 70 | . ($isExclude?"Full list\t" . $excludeFile . PHP_EOL . "Updated\t\t":""); 71 | break; 72 | 73 | case 'unlink': 74 | foreach (scanFiles($ce) as $filename) { 75 | if (is_link($filename)) { 76 | $unusedPaths[] = resolvePath(preg_replace('#^' . preg_quote($ce) . "#", '', $filename)); 77 | unlinkFile($filename); 78 | } 79 | } 80 | setExcludePaths($excludePaths, $unusedPaths, ($isExclude)?$excludeFile:false); 81 | break; 82 | } 83 | 84 | /** 85 | * Create exclude file based on $newPaths and $oldPaths 86 | * 87 | * @param array $newPaths 88 | * @param array $oldPaths 89 | * @param bool $writeToFile 90 | * @return void 91 | */ 92 | function setExcludePaths($newPaths, $oldPaths, $writeToFile = false) 93 | { 94 | if (false != $writeToFile && file_exists($writeToFile)) { 95 | $content = file($writeToFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); 96 | foreach ($content as $lineNum => $line) { 97 | $newKey = array_search($line, $newPaths); 98 | if (false !== $newKey) { 99 | unset($newPaths[$newKey]); 100 | } 101 | 102 | $oldKey = array_search($line, $oldPaths); 103 | if (false !== $oldKey) { 104 | unset($content[$lineNum]); 105 | } 106 | } 107 | $content = array_merge($content, $newPaths); 108 | formatContent($content); 109 | file_put_contents($writeToFile, $content); 110 | } 111 | formatContent($newPaths); 112 | // file_put_contents(getcwd() . DIRECTORY_SEPARATOR . 'exclude.log', $newPaths); 113 | } 114 | 115 | /** 116 | * Format content before write to file 117 | * 118 | * @param array $content 119 | * @return void 120 | */ 121 | function formatContent(&$content) 122 | { 123 | array_walk( 124 | $content, 125 | function (&$value) { 126 | $value = resolvePath($value) . PHP_EOL; 127 | } 128 | ); 129 | } 130 | 131 | /** 132 | * Scan all files from Magento root 133 | * 134 | * @param string $path 135 | * @return array 136 | */ 137 | function scanFiles($path) 138 | { 139 | $results = []; 140 | foreach (glob($path . DIRECTORY_SEPARATOR . '*') as $filename) { 141 | $results[] = $filename; 142 | if (is_dir($filename)) { 143 | $results = array_merge($results, scanFiles($filename)); 144 | } 145 | } 146 | return $results; 147 | } 148 | 149 | /** 150 | * OS depends unlink 151 | * 152 | * @param string $filename 153 | * @return void 154 | */ 155 | function unlinkFile($filename) 156 | { 157 | strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && is_dir($filename) ? @rmdir($filename) : @unlink($filename); 158 | } 159 | 160 | /** 161 | * Resolve path to Unix format 162 | * 163 | * @param string $path 164 | * @return string 165 | */ 166 | function resolvePath($path) 167 | { 168 | return ltrim(str_replace('\\', '/', $path), '/'); 169 | } 170 | -------------------------------------------------------------------------------- /etc/php/tools/magento: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | script_name=$1 4 | dir=$(dirname $0)/magento2 5 | sh=${dir}/${script_name} 6 | 7 | umask 002 8 | if [[ $# -eq 0 ]]; then 9 | ls -1 $dir 10 | exit 0 11 | fi 12 | 13 | if [[ $2 == '-h' || $2 == '--help' ]]; then 14 | cat $sh 15 | else 16 | shift 17 | echo '------start------------' 18 | set -ex; source $sh $@ 19 | echo '-------stop------------' 20 | fi 21 | -------------------------------------------------------------------------------- /etc/php/tools/magento2_debug: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #https://github.com/clawrock/magento2-debug 3 | 4 | ! composer show clawrock/magento2-debug >/dev/null 2>&1 5 | isset=$? 6 | 7 | if [[ ${isset} != 1 ]]; then 8 | composer require --dev clawrock/magento2-debug 9 | bin/magento setup:upgrade 10 | fi 11 | 12 | set +e 13 | bin/magento config:show clawrock_debug/general/active >/dev/null 2>&1 14 | enable=$? 15 | set -e 16 | 17 | bin/magento config:set clawrock_debug/general/active ${enable} -------------------------------------------------------------------------------- /etc/php/tools/packages: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #don't use it 4 | exit 1 5 | 6 | dir=`basename $(pwd)` 7 | ver=${1:-'ce'} 8 | VERSION=${2:-'2.1.0'} 9 | DB=${3:-$dir} 10 | HOST=${4:-"$dir.test"} 11 | HOST_DB=${5:-"db"} 12 | REPO=${6:-"https://repo.magento.com/"} 13 | 14 | mysql -uroot -h$HOST_DB -e "DROP DATABASE IF EXISTS $DB; create database $DB;" 15 | 16 | shopt -s extglob 17 | rm -rf !(.idea|.git|.|..) 18 | shopt -u extglob 19 | [ -d .git ] && mv .git ../tmp/ 20 | if [ $ver = 'ee' ]; then 21 | composer create-project --repository-url=$REPO magento/project-enterprise-edition=$VERSION . 22 | else 23 | composer create-project --repository-url=$REPO magento/project-community-edition=$VERSION . 24 | fi 25 | 26 | chmod -R ug+x bin 27 | 28 | bin/magento setup:install \ 29 | --cleanup-database \ 30 | --language=en_US \ 31 | --timezone=America/Los_Angeles \ 32 | --currency=USD \ 33 | --use-secure=0 \ 34 | --use-secure-admin=0 \ 35 | --admin-use-security-key=0 \ 36 | --use-rewrites=0 \ 37 | --backend-frontname=admin \ 38 | --admin-lastname=Admin \ 39 | --admin-firstname=Admin \ 40 | --admin-email=magento@mailinator.com \ 41 | --admin-user=admin \ 42 | --admin-password=123123q \ 43 | --base-url=http://$HOST/ \ 44 | --db-name=$DB \ 45 | --db-host=$HOST_DB 46 | 47 | bin/magento deploy:mode:set developer 48 | mv ../tmp/.git . 49 | -------------------------------------------------------------------------------- /etc/php/tools/page_builder: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | shopt -s extglob 4 | if [ -d .git ]; then 5 | cp -rlf ../magento2-page-builder/!(.git|vendor|..|.) . 6 | if [ -f LICENSE_EE.txt ]; then 7 | git --work-tree=../magento2-page-builder-ee --git-dir=../magento2-page-builder-ee/.git clean -dfx 8 | cp -rlf ../magento2-page-builder-ee/!(.git|vendor|..|.) . 9 | fi 10 | composer require magento/dom:2.1.7 11 | else 12 | echo 'TODO install page-builder from composer' 13 | fi 14 | bin/magento setup:upgrade 15 | bin/magento config:set cms/pagebuilder/enabled 1 16 | -------------------------------------------------------------------------------- /etc/php/tools/prepare_tests: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | test=${1:-'all'} 4 | 5 | if [ $test = 'integration' ] || [ $test = 'all' ]; then 6 | #For integration tests 7 | php -r '(new PDO("mysql:host=db;dbname=magento", "root"))->exec("CREATE DATABASE IF NOT EXISTS magento_integration_tests;");' 8 | php -r '(new PDO("mysql:host=db;dbname=magento", "root"))->exec("CREATE DATABASE IF NOT EXISTS magento_integration_tests_checkout;");' 9 | php -r '(new PDO("mysql:host=db;dbname=magento", "root"))->exec("CREATE DATABASE IF NOT EXISTS magento_integration_tests_sales;");' 10 | fi 11 | 12 | #For functional tests 13 | if [ $test = 'mftf' ] || [ $test = 'all' ]; then 14 | #The Admin Account Sharing drop-down menu is set to Yes in the backend (Stores > Configuration > Advanced > Admin > Security); 15 | bin/magento config:set admin/security/admin_account_sharing 1 16 | #The Add Secret Key to URLs drop-down menu is set to No in the backend (Stores > Configuration > Advanced > Admin > Security); 17 | bin/magento config:set admin/security/use_form_key 0 18 | #The Enable WYSIWYG Editor drop-down menu is set to Disabled Completely in the backend (Stores > Configuration > General> Content Management > WYSIWYG Options); 19 | bin/magento config:set cms/wysiwyg/enabled disabled 20 | #If the Nginx Web server is used on your development environment 21 | bin/magento config:set web/seo/use_rewrites 1 22 | #clean cache after change config 23 | bin/magento cache:flush 24 | 25 | #https://devdocs.magento.com/mftf/docs/getting-started.html 26 | cp -f dev/tests/acceptance/.htaccess.sample dev/tests/acceptance/.htaccess 27 | vendor/bin/mftf build:project 28 | #vendor/bin/mftf generate:urn-catalog --force .idea/ 29 | vendor/bin/mftf generate:tests 30 | fi 31 | -------------------------------------------------------------------------------- /etc/php/tools/reinstall: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | shopt -s extglob 3 | 4 | #clean project dir 5 | if [[ -d .git ]]; then 6 | git clean -dfx -e '.idea' $(mount | grep -oP '/var/www/magento2ce/\K\S*' | xargs -rn 1 echo '-e ') 7 | git checkout composer.lock composer.json 8 | fi 9 | 10 | #apply edition 11 | for edition in "$@"; do 12 | if ! [[ -d ../${edition} ]]; then 13 | edition=magento2${edition} 14 | fi 15 | cp -rlf ../"${edition}"/!(.git|vendor|..|.) . 16 | done 17 | 18 | #install magento 19 | composer install 20 | bin/magento setup:install \ 21 | --cleanup-database \ 22 | --backend-frontname=admin \ 23 | --admin-lastname=Admin \ 24 | --admin-firstname=Admin \ 25 | --admin-email=magento@mailinator.com \ 26 | --admin-user=admin \ 27 | --admin-password=123123q \ 28 | --db-name=magento \ 29 | --db-host=db \ 30 | --elasticsearch-host=elastic \ 31 | --db-prefix=m2_ 32 | 33 | #do x-setup lines 34 | IFS=$'\n' setup=($(yq eval .services.*.x-setup /var/www/magento-docker/docker-compose.yml | grep -oP '^(?:\s*\-\s)+(?!null)\K.*')) 35 | for i in ${setup[*]}; do eval "${i}"; done 36 | -------------------------------------------------------------------------------- /etc/php/tools/sample_data: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #TODO: need update like 4 | shopt -s extglob 5 | #def or git 6 | method='def' 7 | if [[ -d .git ]]; then 8 | method='git' 9 | fi 10 | if ! grep -q 'repo.magento.com' composer.json; then 11 | composer config repositories.magento composer https://repo.magento.com/ 12 | fi 13 | #mkdir -p ./var/composer_home/ 14 | #cp -f ~/.composer/auth.json ./var/composer_home/ 15 | #cp -f ~/.composer/config.json ./var/composer_home/ 16 | 17 | if [[ ${method} = 'git' ]]; then 18 | git --work-tree=../magento2-sample-data --git-dir=../magento2-sample-data/.git clean -dfx 19 | cp -rlf ../magento2-sample-data/!(.git|vendor|..|.) . 20 | if [[ -f LICENSE_EE.txt ]]; then 21 | git --work-tree=../magento2-sample-data-ee --git-dir=../magento2-sample-data-ee/.git clean -dfx 22 | cp -rlf ../magento2-sample-data-ee/!(.git|vendor|..|.) . 23 | fi 24 | else 25 | bin/magento sampledata:deploy 26 | fi 27 | bin/magento setup:upgrade 28 | 29 | -------------------------------------------------------------------------------- /etc/php/xdebug.ini: -------------------------------------------------------------------------------- 1 | zend_extension=xdebug.so 2 | 3 | xdebug.remote_enable=on 4 | xdebug.remote_autostart=on 5 | xdebug.idekey=xdebug 6 | #xdebug.remote_port=9001 7 | #xdebug.remote_connect_back=1 8 | xdebug.remote_host=host.docker.internal 9 | xdebug.max_nesting_level = 1000 10 | #xdebug.remote_mode = jit 11 | #xdebug.renite_enable = 1 12 | #xdebug.show_mem_delta = 1 13 | #xdebug.profiler_enable = 0 14 | #xdebug.profiler_output_dir = /var/www/tmp/ 15 | -------------------------------------------------------------------------------- /etc/php/xhprof.ini: -------------------------------------------------------------------------------- 1 | extension=xhprof.so 2 | -------------------------------------------------------------------------------- /etc/phpstorm/.name: -------------------------------------------------------------------------------- 1 | magento -------------------------------------------------------------------------------- /etc/phpstorm/deployment.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /etc/phpstorm/magento.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /etc/phpstorm/magento2plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /etc/phpstorm/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /etc/phpstorm/php-test-framework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /etc/phpstorm/php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini, /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini, /usr/local/etc/php/conf.d/docker-php-ext-gd.ini, /usr/local/etc/php/conf.d/docker-php-ext-intl.ini, /usr/local/etc/php/conf.d/docker-php-ext-msgpack.ini, /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini, /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini, /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini, /usr/local/etc/php/conf.d/docker-php-ext-soap.ini, /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini, /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini, /usr/local/etc/php/conf.d/docker-php-ext-tideways_xhprof.ini, /usr/local/etc/php/conf.d/docker-php-ext-xsl.ini, /usr/local/etc/php/conf.d/docker-php-ext-zip.ini, /usr/local/etc/php/conf.d/xdebug.ini 28 | /usr/local/etc/php/php.ini 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /etc/phpstorm/remote-mappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /etc/phpstorm/tools/tools_magento.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 64 | 65 | 66 | 67 | 71 | 72 | 73 | 74 | 78 | 79 | 80 | 81 | 85 | 86 | 87 | 88 | 92 | 93 | 94 | 95 | 99 | 100 | -------------------------------------------------------------------------------- /etc/phpstorm/webServers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /etc/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s 3 | evaluation_interval: 15s 4 | external_labels: 5 | monitor: 'magento' 6 | scrape_configs: 7 | - job_name: 'prometheus' 8 | static_configs: 9 | - targets: ['localhost:9090','redis-exporter:9121','nginx-exporter:9397','fpm-exporter:9099','cadvisor:8080','mysqld-exporter:9104','node-exporter:9100'] 10 | -------------------------------------------------------------------------------- /etc/redis/sentinel.conf: -------------------------------------------------------------------------------- 1 | port 26379 2 | dir /tmp 3 | sentinel monitor mymaster redis-master 6379 2 4 | sentinel down-after-milliseconds mymaster 5000 5 | sentinel parallel-syncs mymaster 1 6 | sentinel failover-timeout mymaster 5000 -------------------------------------------------------------------------------- /etc/varnish/nginx.conf: -------------------------------------------------------------------------------- 1 | user root; 2 | worker_processes auto; 3 | 4 | error_log /var/log/nginx/error.log warn; 5 | pid /var/run/nginx.pid; 6 | 7 | events { 8 | worker_connections 1024; 9 | } 10 | 11 | http { 12 | include /etc/nginx/mime.types; 13 | default_type application/octet-stream; 14 | 15 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 16 | '$status $body_bytes_sent "$http_referer" ' 17 | '"$http_user_agent" "$http_x_forwarded_for"'; 18 | 19 | access_log /var/log/nginx/access.log main; 20 | log_not_found off; 21 | log_subrequest off; 22 | rewrite_log off; 23 | resolver 127.0.0.11; 24 | sendfile on; 25 | 26 | #timeout zone 27 | keepalive_timeout 65; 28 | client_body_timeout 11; 29 | client_header_timeout 12; 30 | proxy_read_timeout 13; 31 | send_timeout 14; 32 | fastcgi_read_timeout 6000s; 33 | fastcgi_connect_timeout 10s; 34 | 35 | #tcp_nopush on; 36 | #listen 443 ssl http2; 37 | 38 | upstream fastcgi_backend { 39 | server app:9000; 40 | } 41 | 42 | server { 43 | listen 8080; 44 | server_name magento.test; 45 | set $MAGE_ROOT /var/www/magento2ce; 46 | set $MAGE_MODE 'none'; 47 | include /var/www/magento2ce/nginx.conf.sample; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /etc/varnish/varnish.vcl: -------------------------------------------------------------------------------- 1 | vcl 4.0; 2 | 3 | import std; 4 | # The minimal Varnish version is 4.0 5 | # For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https' 6 | 7 | backend default { 8 | .host = "web"; 9 | .port = "80"; 10 | .first_byte_timeout = 600s; 11 | } 12 | 13 | acl purge { 14 | "app"; 15 | } 16 | 17 | sub vcl_recv { 18 | if (req.method == "PURGE") { 19 | if (client.ip !~ purge) { 20 | return (synth(405, "Method not allowed")); 21 | } 22 | # To use the X-Pool header for purging varnish during automated deployments, make sure the X-Pool header 23 | # has been added to the response in your backend server config. This is used, for example, by the 24 | # capistrano-magento2 gem for purging old content from varnish during it's deploy routine. 25 | if (!req.http.X-Magento-Tags-Pattern && !req.http.X-Pool) { 26 | return (synth(400, "X-Magento-Tags-Pattern or X-Pool header required")); 27 | } 28 | if (req.http.X-Magento-Tags-Pattern) { 29 | ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern); 30 | } 31 | if (req.http.X-Pool) { 32 | ban("obj.http.X-Pool ~ " + req.http.X-Pool); 33 | } 34 | return (synth(200, "Purged")); 35 | } 36 | 37 | if (req.method != "GET" && 38 | req.method != "HEAD" && 39 | req.method != "PUT" && 40 | req.method != "POST" && 41 | req.method != "TRACE" && 42 | req.method != "OPTIONS" && 43 | req.method != "DELETE") { 44 | /* Non-RFC2616 or CONNECT which is weird. */ 45 | return (pipe); 46 | } 47 | 48 | # We only deal with GET and HEAD by default 49 | if (req.method != "GET" && req.method != "HEAD") { 50 | return (pass); 51 | } 52 | 53 | # Bypass shopping cart, checkout and search requests 54 | if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") { 55 | return (pass); 56 | } 57 | 58 | # Bypass health check requests 59 | if (req.url ~ "/health_check.php") { 60 | return (pass); 61 | } 62 | 63 | # Set initial grace period usage status 64 | set req.http.grace = "none"; 65 | 66 | # normalize url in case of leading HTTP scheme and domain 67 | set req.url = regsub(req.url, "^http[s]?://", ""); 68 | 69 | # collect all cookies 70 | std.collect(req.http.Cookie); 71 | 72 | # Compression filter. See https://www.varnish-cache.org/trac/wiki/FAQ/Compression 73 | if (req.http.Accept-Encoding) { 74 | if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") { 75 | # No point in compressing these 76 | unset req.http.Accept-Encoding; 77 | } elsif (req.http.Accept-Encoding ~ "gzip") { 78 | set req.http.Accept-Encoding = "gzip"; 79 | } elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") { 80 | set req.http.Accept-Encoding = "deflate"; 81 | } else { 82 | # unknown algorithm 83 | unset req.http.Accept-Encoding; 84 | } 85 | } 86 | 87 | # Remove all marketing get parameters to minimize the cache objects 88 | if (req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=") { 89 | set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=[-_A-z0-9+()%.]+&?", ""); 90 | set req.url = regsub(req.url, "[?|&]+$", ""); 91 | } 92 | 93 | # Static files caching 94 | if (req.url ~ "^/(pub/)?(media|static)/") { 95 | # Static files should not be cached by default 96 | # return (pass); 97 | 98 | # But if you use a few locales and don't use CDN you can enable caching static files by commenting previous line (#return (pass);) and uncommenting next 3 lines 99 | unset req.http.Https; 100 | unset req.http.X-Forwarded-Proto; 101 | unset req.http.Cookie; 102 | } 103 | 104 | return (hash); 105 | } 106 | 107 | sub vcl_hash { 108 | if (req.http.cookie ~ "X-Magento-Vary=") { 109 | hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1")); 110 | } 111 | 112 | # For multi site configurations to not cache each other's content 113 | if (req.http.host) { 114 | hash_data(req.http.host); 115 | } else { 116 | hash_data(server.ip); 117 | } 118 | 119 | if (req.url ~ "/graphql") { 120 | call process_graphql_headers; 121 | } 122 | 123 | # To make sure http users don't see ssl warning 124 | if (req.http.X-Forwarded-Proto) { 125 | hash_data(req.http.X-Forwarded-Proto); 126 | } 127 | 128 | } 129 | 130 | sub process_graphql_headers { 131 | if (req.http.Store) { 132 | hash_data(req.http.Store); 133 | } 134 | if (req.http.Content-Currency) { 135 | hash_data(req.http.Content-Currency); 136 | } 137 | } 138 | 139 | sub vcl_backend_response { 140 | 141 | set beresp.grace = 3d; 142 | 143 | if (beresp.http.content-type ~ "text") { 144 | set beresp.do_esi = true; 145 | } 146 | 147 | if (bereq.url ~ "\.js$" || beresp.http.content-type ~ "text") { 148 | set beresp.do_gzip = true; 149 | } 150 | 151 | if (beresp.http.X-Magento-Debug) { 152 | set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control; 153 | } 154 | 155 | # cache only successfully responses and 404s 156 | if (beresp.status != 200 && beresp.status != 404) { 157 | set beresp.ttl = 0s; 158 | set beresp.uncacheable = true; 159 | return (deliver); 160 | } elsif (beresp.http.Cache-Control ~ "private") { 161 | set beresp.uncacheable = true; 162 | set beresp.ttl = 86400s; 163 | return (deliver); 164 | } 165 | 166 | # validate if we need to cache it and prevent from setting cookie 167 | if (beresp.ttl > 0s && (bereq.method == "GET" || bereq.method == "HEAD")) { 168 | unset beresp.http.set-cookie; 169 | } 170 | 171 | # If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass 172 | if (beresp.ttl <= 0s || 173 | beresp.http.Surrogate-control ~ "no-store" || 174 | (!beresp.http.Surrogate-Control && 175 | beresp.http.Cache-Control ~ "no-cache|no-store") || 176 | beresp.http.Vary == "*") { 177 | # Mark as Hit-For-Pass for the next 2 minutes 178 | set beresp.ttl = 120s; 179 | set beresp.uncacheable = true; 180 | } 181 | 182 | return (deliver); 183 | } 184 | 185 | sub vcl_deliver { 186 | if (resp.http.x-varnish ~ " ") { 187 | set resp.http.X-Magento-Cache-Debug = "HIT"; 188 | set resp.http.Grace = req.http.grace; 189 | } else { 190 | set resp.http.X-Magento-Cache-Debug = "MISS"; 191 | } 192 | 193 | # Not letting browser to cache non-static files. 194 | if (resp.http.Cache-Control !~ "private" && req.url !~ "^/(pub/)?(media|static)/") { 195 | set resp.http.Pragma = "no-cache"; 196 | set resp.http.Expires = "-1"; 197 | set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0"; 198 | } 199 | 200 | unset resp.http.X-Magento-Debug; 201 | unset resp.http.X-Magento-Tags; 202 | unset resp.http.X-Powered-By; 203 | unset resp.http.Server; 204 | unset resp.http.X-Varnish; 205 | unset resp.http.Via; 206 | unset resp.http.Link; 207 | } 208 | 209 | sub vcl_hit { 210 | if (obj.ttl >= 0s) { 211 | # Hit within TTL period 212 | return (deliver); 213 | } 214 | } 215 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## LINUX ## 4 | #requare 5 | sudo apt update 6 | sudo apt install htop 7 | sudo apt install git 8 | sudo apt install mc 9 | sudo apt-get install apt-transport-https ca-certificates curl software-properties-common 10 | #install docker 11 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 12 | sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 13 | sudo apt-get update 14 | sudo apt-get install docker-ce 15 | sudo groupadd docker 16 | sudo usermod -aG docker $USER 17 | sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose 18 | sudo chmod +x /usr/local/bin/docker-compose 19 | 20 | ## MAC OS ## 21 | #requare 22 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 23 | #install docker 24 | brew cask install docker 25 | #optimization for mac 26 | #https://gist.github.com/tombigel/d503800a282fcadbee14b537735d202c 27 | 28 | ## WINDOWS ## PowerShell 29 | Invoke-WebRequest "https://master.dockerproject.org/windows/x86_64/docker.zip" -OutFile "$env:TEMP\docker.zip" -UseBasicParsing 30 | Expand-Archive -Path "$env:TEMP\docker.zip" -DestinationPath $env:ProgramFiles 31 | # Add path to this PowerShell session immediately 32 | $env:path += ";$env:ProgramFiles\Docker" 33 | # For persistent use after a reboot 34 | $Path = [Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::Machine) 35 | [Environment]::SetEnvironmentVariable("Path", $Path + ";$env:ProgramFiles\Docker", [EnvironmentVariableTarget]::Machine) 36 | 37 | #prepare data 38 | mkdir ~/www 39 | cd ~/www/ 40 | chown -R $USER:root . 41 | chmod g+s . 42 | git clone https://github.com/duhon/magento-docker.git 43 | cp magento-docker/bundles/typical.yml magento-docker/docker-compose.yml 44 | cp magento-docker/.env.dist magento-docker/.env 45 | git clone https://github.com/magento/magento2ce.git 46 | git clone https://github.com/magento/magento2ee.git 47 | git clone https://github.com/magento/magento2b2b.git 48 | -------------------------------------------------------------------------------- /services/apache-fcgi.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | web: 4 | image: httpd:alpine 5 | expose: 6 | - "80" 7 | volumes: 8 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 9 | - ${MAGENTO_PATH}/magento-docker/etc/apache/httpd.conf:/usr/local/apache2/conf/httpd.conf 10 | -------------------------------------------------------------------------------- /services/apache-mod.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | app: 4 | build: 5 | context: ${MAGENTO_PATH}/magento-docker 6 | dockerfile: build/php/apache-mod 7 | image: apache-mod 8 | expose: 9 | - "80" 10 | volumes: 11 | - ${MAGENTO_PATH}:/var/www:z 12 | - ${MAGENTO_PATH}/magento-docker/etc/php/tools:/usr/local/bin/magento2:ro 13 | - ${MAGENTO_PATH}/magento-docker/etc/php/php.ini:/usr/local/etc/php/php.ini:ro 14 | - ${MAGENTO_PATH}/magento-docker/etc/apache/virtual_host.conf:/etc/apache2/sites-enabled/000-default.conf:ro 15 | environment: 16 | APACHE_RUN_USER: "www-data" 17 | APACHE_RUN_GROUP: "root" 18 | COMPOSER_HOME: /var/www/.composer 19 | command: sh -c 'a2enmod rewrite; apache2-foreground' 20 | -------------------------------------------------------------------------------- /services/blackfire.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | blackfire: 4 | image: blackfire/blackfire 5 | environment: 6 | BLACKFIRE_LOG_LEVEL: 1 7 | BLACKFIRE_SERVER_ID: ${BLACKFIRE_SERVER_ID} 8 | BLACKFIRE_SERVER_TOKEN: ${BLACKFIRE_SERVER_TOKEN} 9 | BLACKFIRE_CLIENT_ID: ${BLACKFIRE_CLIENT_ID} 10 | BLACKFIRE_CLIENT_TOKEN: ${BLACKFIRE_CLIENT_TOKEN} -------------------------------------------------------------------------------- /services/cadvisor.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | cadvisor: 4 | image: google/cadvisor 5 | hostname: cadvisor 6 | expose: 7 | - 8080 8 | volumes: 9 | - /:/rootfs:ro 10 | - /var/run:/var/run:ro 11 | - /sys:/sys:ro 12 | - /var/lib/docker/:/var/lib/docker:ro 13 | - /dev/disk/:/dev/disk:ro 14 | -------------------------------------------------------------------------------- /services/elastic.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | elastic: 4 | image: elasticsearch:6.7.1 5 | hostname: elastic 6 | expose: 7 | - "9200" 8 | - "9300" 9 | environment: 10 | - cluster.name=docker-cluster 11 | - bootstrap.memory_lock=true 12 | - discovery.type=single-node 13 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 14 | ulimits: 15 | memlock: 16 | soft: -1 17 | hard: -1 18 | x-setup: 19 | - bin/magento config:set catalog/search/engine elasticsearch6 20 | - bin/magento config:set catalog/search/elasticsearch6_server_hostname elastic 21 | - bin/magento indexer:reindex catalogsearch_fulltext -------------------------------------------------------------------------------- /services/elasticsearch-hq.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | elasticsearch-hq: 4 | image: elastichq/elasticsearch-hq 5 | ports: 6 | - "${ELASTIC_HQ_PORT}:5000" 7 | environment: 8 | - HQ_DEFAULT_URL=http://elastic:9200 -------------------------------------------------------------------------------- /services/jmeter.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | jmeter: 4 | image: duhon/jmeter:3.1 5 | user: '1000' 6 | environment: 7 | - DISPLAY 8 | # command: jmeter -n -t /var/www/magento2-infrastructure/build/core_dev/performance/mpaf/tool/throughputLoop.jmx -Jhost=magento.test -Jadmin_enabled=1 -JadminEditProduct=25 -Jloops=100 -Jadmin_password=123123q -Jadmin_user=admin -Jadmin_path=admin -Jbase_path=/index.php/ -Jusers=2 -Jreport_save_path=/var/www/tmp/ 9 | command: sh -c 'jmeter -Jhost=magento.test -Jbase_path=/index.php/ -Jfiles_folder=/var/www/magento2-infrastructure/build/core_dev/performance/mpaf/tool/fragments/files/ -Djava.util.prefs.systemRoot=/tmp/ -Djava.util.prefs.userRoot=/tmp/ -j /dev/stdout' 10 | volumes: 11 | - ${MAGENTO_PATH}:/var/www 12 | - /tmp/.X11-unix:/tmp/.X11-unix 13 | - /etc/group:/etc/group:ro 14 | - /etc/passwd:/etc/passwd:ro 15 | - /etc/shadow:/etc/shadow:ro 16 | - /etc/sudoers.d:/etc/sudoers.d:ro 17 | -------------------------------------------------------------------------------- /services/mail.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | mail: 4 | image: mailhog/mailhog 5 | hostname: mail 6 | expose: 7 | - "1025" 8 | - "8025" 9 | -------------------------------------------------------------------------------- /services/memcached.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | memcached: 4 | image: memcached 5 | hostname: memcache 6 | expose: 7 | - "11211" 8 | -------------------------------------------------------------------------------- /services/mftf.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | mftf: 4 | image: selenium/standalone-chrome-debug:3.12.0 5 | expose: 6 | - "5900" 7 | x-hints: 8 | - 'vnc://0.0.0.0:5900 pass:secret' -------------------------------------------------------------------------------- /services/mongodb.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | mongodb: 4 | image: mongo 5 | hostname: mongodb 6 | expose: 7 | - "27017" 8 | -------------------------------------------------------------------------------- /services/mtf.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | mtf: 4 | image: selenium/standalone-firefox-debug:2.48.2 5 | expose: 6 | - "5900" 7 | x-hints: 8 | - 'vnc://0.0.0.0:5900 pass:secret' -------------------------------------------------------------------------------- /services/mysql.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | db: 4 | image: mysql:5.7 5 | hostname: db 6 | # volumes: 7 | # - /tmp/:/var/lib/mysql 8 | tmpfs: 9 | - /tmp 10 | environment: 11 | MYSQL_ALLOW_EMPTY_PASSWORD: "yes" 12 | MYSQL_DATABASE: "magento" 13 | -------------------------------------------------------------------------------- /services/newrelic.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | newrelic: 4 | image: newrelic/php-daemon -------------------------------------------------------------------------------- /services/nginx.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | web: 4 | image: nginx:alpine 5 | hostname: web 6 | # environment: 7 | # - NGINX_HOST=magento.test 8 | # - NGINX_PORT=8080 9 | volumes: 10 | - ${MAGENTO_PATH}:/var/www 11 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf 12 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.crt:/etc/nginx/server.crt 13 | - ${MAGENTO_PATH}/magento-docker/etc/nginx/server.key:/etc/nginx/server.key 14 | networks: 15 | default: 16 | aliases: 17 | - magento.test 18 | # command: /bin/sh -c "envsubst < /etc/nginx/nginx.conf > /etc/nginx/nginx.conf && nginx-debug -g 'daemon off;'" 19 | -------------------------------------------------------------------------------- /services/nodejs.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | nodejs: 4 | image: digitallyseamless/nodejs-bower-grunt 5 | hostname: nodejs 6 | volumes: 7 | - ${MAGENTO_PATH}/magento2ce:/data:${FILE_SYNC} 8 | tty: true 9 | command: sh -c 'cp Gruntfile.js.sample Gruntfile.js && cp package.json.sample package.json && npm install && bash' 10 | x-hints: 11 | - https://devdocs.magento.com/guides/v2.3/test/js/jasmine.html 12 | - grunt spec 13 | x-setup: 14 | - bin/magento setup:static-content:deploy -f 15 | -------------------------------------------------------------------------------- /services/php.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | app: 4 | build: 5 | context: ${MAGENTO_PATH}/magento-docker 6 | dockerfile: build/php/test 7 | image: duhon/php:7.1-fpm 8 | hostname: app 9 | volumes: 10 | - ${MAGENTO_PATH}:/var/www:${FILE_SYNC} 11 | - ${MAGENTO_PATH}/magento-docker/etc/php/tools:/usr/local/bin/magento2:ro 12 | - ${MAGENTO_PATH}/magento-docker/etc/php/php.ini:/usr/local/etc/php/php.ini:ro 13 | - ${MAGENTO_PATH}/magento-docker/etc/php/php-fpm.conf:/usr/local/etc/php-fpm.conf 14 | environment: 15 | # MAGE_MODE: "developer" 16 | COMPOSER_HOME: /var/www/.composer 17 | -------------------------------------------------------------------------------- /services/phpmyadmin.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | phpmyadmin: 4 | image: phpmyadmin/phpmyadmin 5 | environment: 6 | - PMA_HOST=db 7 | - PMA_USER=root 8 | expose: 9 | - 80 -------------------------------------------------------------------------------- /services/pmm.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | pmm: 4 | image: duhon/pmm 5 | hostname: pmm 6 | environment: 7 | MYSQL_HOST: db 8 | -------------------------------------------------------------------------------- /services/rabbit.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | rabbit: 4 | image: rabbitmq:management 5 | hostname: rabbitmq 6 | expose: 7 | - "15672" 8 | x-setup: 9 | - bin/magento setup:config:set --amqp-host=rabbit --amqp-user=guest --amqp-password=guest 10 | -------------------------------------------------------------------------------- /services/redis-stat.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | redis-stat: 4 | image: insready/redis-stat 5 | expose: 6 | - "63790" 7 | command: --server redis 8 | -------------------------------------------------------------------------------- /services/redis.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | redis-master: 4 | image: redis 5 | hostname: redis 6 | expose: 7 | - "6379" 8 | sysctls: 9 | net.core.somaxconn: 1024 10 | ulimits: 11 | nproc: 65535 12 | nofile: 13 | soft: 20000 14 | hard: 40000 15 | x-hints: 16 | - redis-cli monitor 17 | - telnet localhost 6379 18 | x-setup: 19 | - bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=redis-master 20 | - bin/magento setup:config:set --session-save=redis --session-save-redis-host=redis-master 21 | - bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redis-master 22 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/redis/config-redis.html 23 | redis-slave: 24 | image: redis 25 | command: redis-server --slaveof redis-master 6379 26 | redis-sentinel: 27 | image: redis 28 | volumes: 29 | - ${MAGENTO_PATH}/magento-docker/etc/redis/sentinel.conf:/etc/redis/sentinel.conf 30 | command: redis-server /etc/redis/sentinel.conf --sentinel 31 | redis-stat: 32 | image: insready/redis-stat 33 | hostname: redis-stat 34 | expose: 35 | - "63790" 36 | command: '--server redis' 37 | -------------------------------------------------------------------------------- /services/solr.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | solr: 4 | image: makuk66/docker-solr:4.10.4 5 | hostname: solr 6 | expose: 7 | - "8983" 8 | volumes: 9 | - ${MAGENTO_PATH}/magento2ee/app/code/Magento/Solr/conf:/opt/magento2/conf 10 | # command: solr solr-create -c magento2 -d /opt/magento2/conf 11 | -------------------------------------------------------------------------------- /services/tideways.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | tideways: 4 | image: duhon/tideways 5 | hostname: tideways 6 | environment: 7 | EXTRA_PARAMS: --debug -------------------------------------------------------------------------------- /services/varnish.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | varnish: 4 | image: million12/varnish 5 | depends_on: 6 | - web 7 | ports: 8 | - "${VARNISH_PORT}:80" 9 | volumes: 10 | - ${MAGENTO_PATH}/magento-docker/etc/varnish/varnish.vcl:/etc/varnish/default.vcl:ro 11 | x-hints: 12 | - bin/magento cache:flush 13 | x-setup: 14 | - bin/magento -v config:set system/full_page_cache/varnish/backend_host web 15 | - bin/magento -v config:set system/full_page_cache/varnish/access_list web 16 | - bin/magento -v config:set system/full_page_cache/varnish/backend_port 80 17 | - bin/magento -v config:set system/full_page_cache/caching_application 2 18 | - bin/magento -v setup:config:set --http-cache-hosts=varnish:80 19 | x-info: https://devdocs.magento.com/guides/v2.3/config-guide/varnish/config-varnish.html 20 | -------------------------------------------------------------------------------- /services/xhgui.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | xhgui: 4 | image: duhon/xhgui 5 | hostname: xhgui 6 | --------------------------------------------------------------------------------