├── dist
├── mnt
│ └── .gitignore
├── mysql
│ ├── .gitignore
│ └── docker-entrypoint-initdb.d
│ │ └── .gitignore
├── tmp
│ └── .gitignore
├── docker-sync.yml
├── mutagen.sh
└── bin
│ └── magento-docker
├── bin
├── .gitignore
└── ece-docker
├── images
├── php
│ ├── cli
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-cli.ini
│ │ │ └── php-xdebug.ini
│ │ ├── bin
│ │ │ ├── run-cron
│ │ │ ├── ece-command
│ │ │ ├── cloud-deploy
│ │ │ ├── magento-command
│ │ │ ├── magento-installer
│ │ │ ├── cloud-post-deploy
│ │ │ ├── cloud-build
│ │ │ └── run-hooks
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ ├── fpm
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-fpm.ini
│ │ │ ├── php-xdebug.ini
│ │ │ └── php-fpm.conf
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ ├── 7.0-cli
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-cli.ini
│ │ │ └── php-xdebug.ini
│ │ ├── bin
│ │ │ ├── run-cron
│ │ │ ├── ece-command
│ │ │ ├── cloud-deploy
│ │ │ ├── magento-command
│ │ │ ├── magento-installer
│ │ │ ├── cloud-post-deploy
│ │ │ ├── cloud-build
│ │ │ └── run-hooks
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ ├── 7.0-fpm
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-fpm.ini
│ │ │ ├── php-xdebug.ini
│ │ │ └── php-fpm.conf
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ ├── 7.1-cli
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-cli.ini
│ │ │ └── php-xdebug.ini
│ │ ├── bin
│ │ │ ├── run-cron
│ │ │ ├── ece-command
│ │ │ ├── cloud-deploy
│ │ │ ├── magento-command
│ │ │ ├── magento-installer
│ │ │ ├── cloud-post-deploy
│ │ │ ├── cloud-build
│ │ │ └── run-hooks
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ ├── 7.1-fpm
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-fpm.ini
│ │ │ ├── php-xdebug.ini
│ │ │ └── php-fpm.conf
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ ├── 7.2-cli
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-cli.ini
│ │ │ └── php-xdebug.ini
│ │ ├── bin
│ │ │ ├── run-cron
│ │ │ ├── ece-command
│ │ │ ├── cloud-deploy
│ │ │ ├── magento-command
│ │ │ ├── magento-installer
│ │ │ ├── cloud-post-deploy
│ │ │ ├── cloud-build
│ │ │ └── run-hooks
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ ├── 7.2-fpm
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-fpm.ini
│ │ │ ├── php-xdebug.ini
│ │ │ └── php-fpm.conf
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ ├── 7.3-cli
│ │ ├── etc
│ │ │ ├── mail.ini
│ │ │ ├── php-cli.ini
│ │ │ └── php-xdebug.ini
│ │ ├── bin
│ │ │ ├── run-cron
│ │ │ ├── ece-command
│ │ │ ├── cloud-deploy
│ │ │ ├── magento-command
│ │ │ ├── magento-installer
│ │ │ ├── cloud-post-deploy
│ │ │ ├── cloud-build
│ │ │ └── run-hooks
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
│ └── 7.3-fpm
│ │ ├── etc
│ │ ├── mail.ini
│ │ ├── php-fpm.ini
│ │ ├── php-xdebug.ini
│ │ └── php-fpm.conf
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
├── varnish
│ ├── 6.2
│ │ ├── Dockerfile
│ │ └── etc
│ │ │ └── default.vcl
│ └── 4.0
│ │ ├── Dockerfile
│ │ └── etc
│ │ └── varnish.vcl
├── redis
│ ├── 3.2
│ │ └── Dockerfile
│ ├── 4.0
│ │ └── Dockerfile
│ └── 5.0
│ │ └── Dockerfile
├── elasticsearch
│ ├── 2.4
│ │ └── Dockerfile
│ ├── 5.2
│ │ └── Dockerfile
│ ├── 6.5
│ │ └── Dockerfile
│ └── 1.7
│ │ └── Dockerfile
├── tls
│ ├── Dockerfile
│ ├── certs
│ │ ├── magento2.docker.crt
│ │ ├── magento2.docker.key
│ │ └── magento2.docker.pem
│ └── pound.cfg
└── nginx
│ └── 1.9
│ ├── Dockerfile
│ ├── bin
│ └── docker-environment
│ └── etc
│ ├── certs
│ ├── magento.crt
│ └── magento.key
│ └── vhost.conf
├── .gitignore
├── COPYING.txt
├── src
├── App
│ ├── ConfigurationMismatchException.php
│ └── GenericException.php
├── Filesystem
│ ├── FilesystemException.php
│ ├── FileList.php
│ └── DirectoryList.php
├── Config
│ ├── ReaderInterface.php
│ ├── ConfigFactory.php
│ ├── Environment
│ │ ├── Converter.php
│ │ └── Reader.php
│ ├── Dist
│ │ ├── Formatter.php
│ │ └── Generator.php
│ ├── Relationship.php
│ └── Reader.php
├── Service
│ ├── ServiceInterface.php
│ ├── ServiceFactory.php
│ └── Config.php
├── Compose
│ ├── ComposeInterface.php
│ ├── ComposeFactory.php
│ ├── DeveloperCompose.php
│ └── FunctionalCompose.php
├── Test
│ └── Unit
│ │ ├── Config
│ │ ├── Environment
│ │ │ ├── ConverterTest.php
│ │ │ └── ReaderTest.php
│ │ ├── RelationshipTest.php
│ │ ├── Dist
│ │ │ └── GeneratorTest.php
│ │ └── ReaderTest.php
│ │ └── Service
│ │ ├── ServiceFactoryTest.php
│ │ └── ConfigTest.php
├── Application.php
└── Command
│ ├── BuildDist.php
│ └── BuildCompose.php
├── bootstrap.php
├── autoload.php
├── phpunit.xml.dist
├── .github
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── LICENSE_MIT.txt
├── config
└── services.xml
├── composer.json
└── README.md
/dist/mnt/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/mysql/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/tmp/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bin/.gitignore:
--------------------------------------------------------------------------------
1 | dev-ece-docker
2 |
--------------------------------------------------------------------------------
/dist/mysql/docker-entrypoint-initdb.d/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/php/cli/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/fpm/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/7.0-fpm/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/7.1-fpm/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/7.2-fpm/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/7.3-fpm/etc/mail.ini:
--------------------------------------------------------------------------------
1 | ; Sendmail
2 | sendmail_path=/usr/sbin/sendmail -t -i
3 |
--------------------------------------------------------------------------------
/images/php/cli/bin/run-cron:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cron && tail -f -n0 /var/log/cron.log
4 |
--------------------------------------------------------------------------------
/images/varnish/6.2/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM varnish:6.2
2 |
3 | COPY etc/default.vcl /etc/varnish/
4 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/bin/run-cron:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cron && tail -f -n0 /var/log/cron.log
4 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/bin/run-cron:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cron && tail -f -n0 /var/log/cron.log
4 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/bin/run-cron:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cron && tail -f -n0 /var/log/cron.log
4 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/bin/run-cron:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cron && tail -f -n0 /var/log/cron.log
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | vendor
3 | composer.phar
4 | composer.lock
5 | .DS_Store
6 | auth.json
7 | docker-compose.yml
8 |
--------------------------------------------------------------------------------
/images/php/fpm/etc/php-fpm.ini:
--------------------------------------------------------------------------------
1 | memory_limit = !PHP_MEMORY_LIMIT! ; Variable: PHP_MEMORY_LIMIT
2 | opcache.enable = 1
3 |
--------------------------------------------------------------------------------
/images/redis/3.2/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM redis:3.2
2 |
3 | VOLUME /data
4 |
5 | EXPOSE 6379
6 |
7 | CMD ["redis-server"]
8 |
--------------------------------------------------------------------------------
/images/redis/4.0/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM redis:4.0
2 |
3 | VOLUME /data
4 |
5 | EXPOSE 6379
6 |
7 | CMD ["redis-server"]
8 |
--------------------------------------------------------------------------------
/images/php/7.0-fpm/etc/php-fpm.ini:
--------------------------------------------------------------------------------
1 | memory_limit = !PHP_MEMORY_LIMIT! ; Variable: PHP_MEMORY_LIMIT
2 | opcache.enable = 1
3 |
--------------------------------------------------------------------------------
/images/php/7.1-fpm/etc/php-fpm.ini:
--------------------------------------------------------------------------------
1 | memory_limit = !PHP_MEMORY_LIMIT! ; Variable: PHP_MEMORY_LIMIT
2 | opcache.enable = 1
3 |
--------------------------------------------------------------------------------
/images/php/7.2-fpm/etc/php-fpm.ini:
--------------------------------------------------------------------------------
1 | memory_limit = !PHP_MEMORY_LIMIT! ; Variable: PHP_MEMORY_LIMIT
2 | opcache.enable = 1
3 |
--------------------------------------------------------------------------------
/images/php/7.3-fpm/etc/php-fpm.ini:
--------------------------------------------------------------------------------
1 | memory_limit = !PHP_MEMORY_LIMIT! ; Variable: PHP_MEMORY_LIMIT
2 | opcache.enable = 1
3 |
--------------------------------------------------------------------------------
/images/php/cli/bin/ece-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | ECE_COMMAND="$MAGENTO_ROOT/vendor/bin/ece-tools"
6 |
7 | exec $ECE_COMMAND "$@"
8 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/bin/ece-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | ECE_COMMAND="$MAGENTO_ROOT/vendor/bin/ece-tools"
6 |
7 | exec $ECE_COMMAND "$@"
8 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/bin/ece-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | ECE_COMMAND="$MAGENTO_ROOT/vendor/bin/ece-tools"
6 |
7 | exec $ECE_COMMAND "$@"
8 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/bin/ece-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | ECE_COMMAND="$MAGENTO_ROOT/vendor/bin/ece-tools"
6 |
7 | exec $ECE_COMMAND "$@"
8 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/bin/ece-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | ECE_COMMAND="$MAGENTO_ROOT/vendor/bin/ece-tools"
6 |
7 | exec $ECE_COMMAND "$@"
8 |
--------------------------------------------------------------------------------
/images/redis/5.0/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM redis:5.0
2 |
3 | VOLUME /data
4 |
5 | EXPOSE 6379
6 |
7 | #CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]
8 | CMD ["redis-server"]
9 |
--------------------------------------------------------------------------------
/images/php/cli/bin/cloud-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"deploy\" hook."
8 |
9 | run-hooks deploy
10 |
11 | echo "Deployment finished."
12 |
--------------------------------------------------------------------------------
/dist/docker-sync.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | syncs:
3 | magento-sync:
4 | src: './'
5 | sync_excludes:
6 | - '.git'
7 | - '.idea'
8 | - '.magento'
9 | - '.docker'
10 | - '.github'
11 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/bin/cloud-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"deploy\" hook."
8 |
9 | run-hooks deploy
10 |
11 | echo "Deployment finished."
12 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/bin/cloud-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"deploy\" hook."
8 |
9 | run-hooks deploy
10 |
11 | echo "Deployment finished."
12 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/bin/cloud-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"deploy\" hook."
8 |
9 | run-hooks deploy
10 |
11 | echo "Deployment finished."
12 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/bin/cloud-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"deploy\" hook."
8 |
9 | run-hooks deploy
10 |
11 | echo "Deployment finished."
12 |
--------------------------------------------------------------------------------
/images/php/cli/bin/magento-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | MAGENTO_COMMAND="$MAGENTO_ROOT/bin/magento"
6 |
7 | chmod +x $MAGENTO_COMMAND
8 |
9 | exec $MAGENTO_COMMAND "$@"
10 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/bin/magento-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | MAGENTO_COMMAND="$MAGENTO_ROOT/bin/magento"
6 |
7 | chmod +x $MAGENTO_COMMAND
8 |
9 | exec $MAGENTO_COMMAND "$@"
10 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/bin/magento-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | MAGENTO_COMMAND="$MAGENTO_ROOT/bin/magento"
6 |
7 | chmod +x $MAGENTO_COMMAND
8 |
9 | exec $MAGENTO_COMMAND "$@"
10 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/bin/magento-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | MAGENTO_COMMAND="$MAGENTO_ROOT/bin/magento"
6 |
7 | chmod +x $MAGENTO_COMMAND
8 |
9 | exec $MAGENTO_COMMAND "$@"
10 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/bin/magento-command:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | MAGENTO_COMMAND="$MAGENTO_ROOT/bin/magento"
6 |
7 | chmod +x $MAGENTO_COMMAND
8 |
9 | exec $MAGENTO_COMMAND "$@"
10 |
--------------------------------------------------------------------------------
/images/php/cli/bin/magento-installer:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | BUILD_COMMAND="cloud-build"
8 | DEPLOY_COMMAND="cloud-deploy"
9 |
10 | $BUILD_COMMAND
11 | $DEPLOY_COMMAND
12 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/bin/magento-installer:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | BUILD_COMMAND="cloud-build"
8 | DEPLOY_COMMAND="cloud-deploy"
9 |
10 | $BUILD_COMMAND
11 | $DEPLOY_COMMAND
12 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/bin/magento-installer:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | BUILD_COMMAND="cloud-build"
8 | DEPLOY_COMMAND="cloud-deploy"
9 |
10 | $BUILD_COMMAND
11 | $DEPLOY_COMMAND
12 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/bin/magento-installer:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | BUILD_COMMAND="cloud-build"
8 | DEPLOY_COMMAND="cloud-deploy"
9 |
10 | $BUILD_COMMAND
11 | $DEPLOY_COMMAND
12 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/bin/magento-installer:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | BUILD_COMMAND="cloud-build"
8 | DEPLOY_COMMAND="cloud-deploy"
9 |
10 | $BUILD_COMMAND
11 | $DEPLOY_COMMAND
12 |
--------------------------------------------------------------------------------
/images/php/cli/bin/cloud-post-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"post-deploy\" hook."
8 |
9 | run-hooks post_deploy
10 |
11 | echo "Post deployment finished."
12 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/bin/cloud-post-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"post-deploy\" hook."
8 |
9 | run-hooks post_deploy
10 |
11 | echo "Post deployment finished."
12 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/bin/cloud-post-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"post-deploy\" hook."
8 |
9 | run-hooks post_deploy
10 |
11 | echo "Post deployment finished."
12 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/bin/cloud-post-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"post-deploy\" hook."
8 |
9 | run-hooks post_deploy
10 |
11 | echo "Post deployment finished."
12 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/bin/cloud-post-deploy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | echo "Running \"post-deploy\" hook."
8 |
9 | run-hooks post_deploy
10 |
11 | echo "Post deployment finished."
12 |
--------------------------------------------------------------------------------
/images/varnish/4.0/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM million12/varnish
2 |
3 | ENV VCL_CONFIG /data/varnish.vcl
4 | ENV VARNISHD_PARAMS -p default_ttl=3600 -p default_grace=3600 -p feature=+esi_ignore_https -p feature=+esi_disable_xml_check
5 |
6 | COPY etc/varnish.vcl /data/varnish.vcl
7 |
--------------------------------------------------------------------------------
/images/elasticsearch/2.4/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM elasticsearch:2.4
2 |
3 | RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml
4 | RUN bin/plugin install analysis-icu && \
5 | bin/plugin install analysis-phonetic
6 |
7 | EXPOSE 9200 9300
8 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/etc/php-cli.ini:
--------------------------------------------------------------------------------
1 | ; php.ini
2 | memory_limit = -1
3 | zlib.output_compression = on
4 | realpath_cache_size = 32k
5 | realpath_cache_ttl = 7200
6 | always_populate_raw_post_data = -1
7 | max_input_vars = 10000
8 | session.gc_probability = 1
9 | opcache.enable = 1
10 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/etc/php-cli.ini:
--------------------------------------------------------------------------------
1 | ; php.ini
2 | memory_limit = -1
3 | zlib.output_compression = on
4 | realpath_cache_size = 32k
5 | realpath_cache_ttl = 7200
6 | always_populate_raw_post_data = -1
7 | max_input_vars = 10000
8 | session.gc_probability = 1
9 | opcache.enable = 1
10 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/etc/php-cli.ini:
--------------------------------------------------------------------------------
1 | ; php.ini
2 | memory_limit = -1
3 | zlib.output_compression = on
4 | realpath_cache_size = 32k
5 | realpath_cache_ttl = 7200
6 | always_populate_raw_post_data = -1
7 | max_input_vars = 10000
8 | session.gc_probability = 1
9 | opcache.enable = 1
10 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/etc/php-cli.ini:
--------------------------------------------------------------------------------
1 | ; php.ini
2 | memory_limit = -1
3 | zlib.output_compression = on
4 | realpath_cache_size = 32k
5 | realpath_cache_ttl = 7200
6 | always_populate_raw_post_data = -1
7 | max_input_vars = 10000
8 | session.gc_probability = 1
9 | opcache.enable = 1
10 |
--------------------------------------------------------------------------------
/images/php/cli/etc/php-cli.ini:
--------------------------------------------------------------------------------
1 | ; php.ini
2 | memory_limit = -1
3 | zlib.output_compression = on
4 | realpath_cache_size = 32k
5 | realpath_cache_ttl = 7200
6 | always_populate_raw_post_data = -1
7 | max_input_vars = 10000
8 | session.gc_probability = 1
9 | opcache.enable = 1
10 |
--------------------------------------------------------------------------------
/images/php/cli/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/fpm/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/7.0-fpm/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/7.1-fpm/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/7.2-fpm/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/php/7.3-fpm/etc/php-xdebug.ini:
--------------------------------------------------------------------------------
1 | ; Xdebug settings will only kick in if the Xdebug module is loaded
2 | xdebug.remote_enable = 1
3 | xdebug.remote_port = 9001
4 | xdebug.remote_autostart = 0
5 | xdebug.remote_connect_back = 0
6 | xdebug.scream = 0
7 | xdebug.show_local_vars = 1
8 | xdebug.idekey = PHPSTORM
9 |
--------------------------------------------------------------------------------
/images/elasticsearch/5.2/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM docker.elastic.co/elasticsearch/elasticsearch:5.2.2
2 |
3 | RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml
4 | RUN bin/elasticsearch-plugin install analysis-icu && \
5 | bin/elasticsearch-plugin install analysis-phonetic
6 |
7 | EXPOSE 9200 9300
8 |
--------------------------------------------------------------------------------
/images/elasticsearch/6.5/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM docker.elastic.co/elasticsearch/elasticsearch:6.5.4
2 |
3 | RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml
4 | RUN bin/elasticsearch-plugin install analysis-icu && \
5 | bin/elasticsearch-plugin install analysis-phonetic
6 |
7 | EXPOSE 9200 9300
8 |
--------------------------------------------------------------------------------
/images/elasticsearch/1.7/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM elasticsearch:1.7
2 |
3 | RUN echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml
4 | RUN plugin --install elasticsearch/elasticsearch-analysis-icu/2.7.0 && \
5 | plugin --install elasticsearch/elasticsearch-analysis-phonetic/2.7.0
6 |
7 | EXPOSE 9200 9300
8 |
--------------------------------------------------------------------------------
/COPYING.txt:
--------------------------------------------------------------------------------
1 | Copyright © 2013-present Magento, Inc.
2 |
3 | Each Magento source file included in this distribution is licensed under OSL 3.0 license
4 |
5 | http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6 | Please see LICENSE.txt for the full text of the OSL 3.0 license or contact license@magentocommerce.com for a copy.
7 |
--------------------------------------------------------------------------------
/images/tls/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mnuessler/tls-termination-proxy
2 |
3 | EXPOSE 443
4 |
5 | COPY certs/magento2.docker.pem /certs/cert.pem
6 | COPY pound.cfg /etc/pound/
7 |
8 | ENV HTTPS_UPSTREAM_SERVER_ADDRESS varnish
9 | ENV HTTPS_UPSTREAM_SERVER_PORT 80
10 | ENV CERT_PATH /certs/cert.pem
11 | ENV TIMEOUT 15
12 | ENV REWRITE_LOCATION 0
13 |
--------------------------------------------------------------------------------
/src/App/ConfigurationMismatchException.php:
--------------------------------------------------------------------------------
1 | set(DirectoryList::class, new DirectoryList(
13 | __DIR__,
14 | BP,
15 | ECE_BP
16 | ));
17 |
18 | return $container;
19 |
--------------------------------------------------------------------------------
/src/App/GenericException.php:
--------------------------------------------------------------------------------
1 | load('services.xml');
14 |
15 | $container->compile();
16 |
17 | $application = new Magento\CloudDocker\Application($container);
18 | $application->run();
19 |
--------------------------------------------------------------------------------
/autoload.php:
--------------------------------------------------------------------------------
1 | $items]);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Compose/ComposeInterface.php:
--------------------------------------------------------------------------------
1 | $value) {
26 | $formattedValue = is_bool($value) ? var_export($value, true) : $value;
27 | $data [] = $variable . '=' . $formattedValue;
28 | }
29 |
30 | return $data;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/images/php/cli/bin/cloud-build:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | RUN_HOOKS="run-hooks"
8 |
9 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10 | echo "Cleaning directories."
11 |
12 | rm -rf $MAGENTO_ROOT/setup/*
13 | rm -rf $MAGENTO_ROOT/vendor/*
14 | rm -rf $MAGENTO_ROOT/generated/*
15 | fi
16 |
17 | echo "Installing dependencies."
18 |
19 | composer --working-dir=$MAGENTO_ROOT install --no-suggest --no-ansi --no-interaction --no-progress --prefer-dist
20 |
21 | echo "Running \"build\" hook."
22 |
23 | $RUN_HOOKS build
24 |
25 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
26 | echo "Fixing file permissions."
27 |
28 | find $MAGENTO_ROOT/pub -type f -exec chmod 664 {} \;
29 | find $MAGENTO_ROOT/pub -type d -exec chmod 775 {} \;
30 | fi
31 |
32 | echo "Building complete."
33 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/bin/cloud-build:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | RUN_HOOKS="run-hooks"
8 |
9 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10 | echo "Cleaning directories."
11 |
12 | rm -rf $MAGENTO_ROOT/setup/*
13 | rm -rf $MAGENTO_ROOT/vendor/*
14 | rm -rf $MAGENTO_ROOT/generated/*
15 | fi
16 |
17 | echo "Installing dependencies."
18 |
19 | composer --working-dir=$MAGENTO_ROOT install --no-suggest --no-ansi --no-interaction --no-progress --prefer-dist
20 |
21 | echo "Running \"build\" hook."
22 |
23 | $RUN_HOOKS build
24 |
25 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
26 | echo "Fixing file permissions."
27 |
28 | find $MAGENTO_ROOT/pub -type f -exec chmod 664 {} \;
29 | find $MAGENTO_ROOT/pub -type d -exec chmod 775 {} \;
30 | fi
31 |
32 | echo "Building complete."
33 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/bin/cloud-build:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | RUN_HOOKS="run-hooks"
8 |
9 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10 | echo "Cleaning directories."
11 |
12 | rm -rf $MAGENTO_ROOT/setup/*
13 | rm -rf $MAGENTO_ROOT/vendor/*
14 | rm -rf $MAGENTO_ROOT/generated/*
15 | fi
16 |
17 | echo "Installing dependencies."
18 |
19 | composer --working-dir=$MAGENTO_ROOT install --no-suggest --no-ansi --no-interaction --no-progress --prefer-dist
20 |
21 | echo "Running \"build\" hook."
22 |
23 | $RUN_HOOKS build
24 |
25 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
26 | echo "Fixing file permissions."
27 |
28 | find $MAGENTO_ROOT/pub -type f -exec chmod 664 {} \;
29 | find $MAGENTO_ROOT/pub -type d -exec chmod 775 {} \;
30 | fi
31 |
32 | echo "Building complete."
33 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/bin/cloud-build:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | RUN_HOOKS="run-hooks"
8 |
9 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10 | echo "Cleaning directories."
11 |
12 | rm -rf $MAGENTO_ROOT/setup/*
13 | rm -rf $MAGENTO_ROOT/vendor/*
14 | rm -rf $MAGENTO_ROOT/generated/*
15 | fi
16 |
17 | echo "Installing dependencies."
18 |
19 | composer --working-dir=$MAGENTO_ROOT install --no-suggest --no-ansi --no-interaction --no-progress --prefer-dist
20 |
21 | echo "Running \"build\" hook."
22 |
23 | $RUN_HOOKS build
24 |
25 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
26 | echo "Fixing file permissions."
27 |
28 | find $MAGENTO_ROOT/pub -type f -exec chmod 664 {} \;
29 | find $MAGENTO_ROOT/pub -type d -exec chmod 775 {} \;
30 | fi
31 |
32 | echo "Building complete."
33 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/bin/cloud-build:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | [ "$DEBUG" = "true" ] && set -x
6 |
7 | RUN_HOOKS="run-hooks"
8 |
9 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10 | echo "Cleaning directories."
11 |
12 | rm -rf $MAGENTO_ROOT/setup/*
13 | rm -rf $MAGENTO_ROOT/vendor/*
14 | rm -rf $MAGENTO_ROOT/generated/*
15 | fi
16 |
17 | echo "Installing dependencies."
18 |
19 | composer --working-dir=$MAGENTO_ROOT install --no-suggest --no-ansi --no-interaction --no-progress --prefer-dist
20 |
21 | echo "Running \"build\" hook."
22 |
23 | $RUN_HOOKS build
24 |
25 | if [ "$MAGENTO_RUN_MODE" == "production" ]; then
26 | echo "Fixing file permissions."
27 |
28 | find $MAGENTO_ROOT/pub -type f -exec chmod 664 {} \;
29 | find $MAGENTO_ROOT/pub -type d -exec chmod 775 {} \;
30 | fi
31 |
32 | echo "Building complete."
33 |
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 | src/Test/Unit
13 |
14 |
15 |
16 |
17 | src
18 |
19 | src/Test
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/images/php/fpm/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | # Configure Sendmail if required
9 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
10 | /etc/init.d/sendmail start
11 | fi
12 |
13 | # Enable PHP extensions
14 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
15 | PHP_EXT_COM_ON=docker-php-ext-enable
16 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
17 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
18 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
19 | fi
20 |
21 | # Substitute in php.ini values
22 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
23 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
24 |
25 | # Configure PHP-FPM
26 | [ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
27 |
28 | exec "$@"
29 |
30 |
--------------------------------------------------------------------------------
/images/php/7.0-fpm/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | # Configure Sendmail if required
9 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
10 | /etc/init.d/sendmail start
11 | fi
12 |
13 | # Enable PHP extensions
14 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
15 | PHP_EXT_COM_ON=docker-php-ext-enable
16 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
17 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
18 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
19 | fi
20 |
21 | # Substitute in php.ini values
22 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
23 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
24 |
25 | # Configure PHP-FPM
26 | [ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
27 |
28 | exec "$@"
29 |
30 |
--------------------------------------------------------------------------------
/images/php/7.1-fpm/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | # Configure Sendmail if required
9 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
10 | /etc/init.d/sendmail start
11 | fi
12 |
13 | # Enable PHP extensions
14 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
15 | PHP_EXT_COM_ON=docker-php-ext-enable
16 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
17 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
18 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
19 | fi
20 |
21 | # Substitute in php.ini values
22 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
23 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
24 |
25 | # Configure PHP-FPM
26 | [ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
27 |
28 | exec "$@"
29 |
30 |
--------------------------------------------------------------------------------
/images/php/7.2-fpm/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | # Configure Sendmail if required
9 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
10 | /etc/init.d/sendmail start
11 | fi
12 |
13 | # Enable PHP extensions
14 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
15 | PHP_EXT_COM_ON=docker-php-ext-enable
16 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
17 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
18 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
19 | fi
20 |
21 | # Substitute in php.ini values
22 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
23 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
24 |
25 | # Configure PHP-FPM
26 | [ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
27 |
28 | exec "$@"
29 |
30 |
--------------------------------------------------------------------------------
/images/php/7.3-fpm/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | # Configure Sendmail if required
9 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
10 | /etc/init.d/sendmail start
11 | fi
12 |
13 | # Enable PHP extensions
14 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
15 | PHP_EXT_COM_ON=docker-php-ext-enable
16 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
17 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
18 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
19 | fi
20 |
21 | # Substitute in php.ini values
22 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
23 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
24 |
25 | # Configure PHP-FPM
26 | [ ! -z "${MAGENTO_RUN_MODE}" ] && sed -i "s/!MAGENTO_RUN_MODE!/${MAGENTO_RUN_MODE}/" /usr/local/etc/php-fpm.conf
27 |
28 | exec "$@"
29 |
30 |
--------------------------------------------------------------------------------
/images/php/fpm/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:{%version%}-fpm-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT 2G
4 | ENV MAGENTO_ROOT /app
5 | ENV DEBUG false
6 | ENV MAGENTO_RUN_MODE production
7 | ENV UPLOAD_MAX_FILESIZE 64M
8 | {%env_php_extensions%}
9 |
10 | # Install dependencies
11 | RUN apt-get update \
12 | && apt-get upgrade -y \
13 | && apt-get install -y --no-install-recommends \
14 | {%packages%} \
15 | && rm -rf /var/lib/apt/lists/*
16 |
17 | # Configure the gd library
18 | {%docker-php-ext-configure%}
19 |
20 | # Install required PHP extensions
21 | {%docker-php-ext-install%}
22 |
23 | {%php-pecl-extensions%}
24 |
25 | {%installation_scripts%}
26 |
27 | {%docker-php-ext-enable%}
28 |
29 | COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini
30 | COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
31 | COPY etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
32 | COPY etc/php-fpm.conf /usr/local/etc/
33 |
34 | COPY docker-entrypoint.sh /docker-entrypoint.sh
35 | RUN ["chmod", "+x", "/docker-entrypoint.sh"]
36 | ENTRYPOINT ["/docker-entrypoint.sh"]
37 |
38 | CMD ["php-fpm", "-R"]
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
11 |
12 | ### Preconditions
13 |
17 | 1.
18 | 2.
19 |
20 | ### Steps to reproduce
21 |
25 | 1.
26 | 2.
27 | 3.
28 |
29 | ### Expected result
30 |
31 | 1. [Screenshots, logs or description]
32 |
33 | ### Actual result
34 |
35 | 1. [Screenshots, logs or description]
36 |
--------------------------------------------------------------------------------
/LICENSE_MIT.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Meanbee
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 |
--------------------------------------------------------------------------------
/src/Test/Unit/Config/Environment/ConverterTest.php:
--------------------------------------------------------------------------------
1 | converter = new Converter();
29 | }
30 |
31 | public function testConvert()
32 | {
33 | $this->assertSame(
34 | [
35 | 'MAGENTO_RUN_MODE=production',
36 | 'DEBUG=false',
37 | 'PHP_ENABLE_XDEBUG=true',
38 | ],
39 | $this->converter->convert([
40 | 'MAGENTO_RUN_MODE' => 'production',
41 | 'DEBUG' => false,
42 | 'PHP_ENABLE_XDEBUG' => true,
43 | ])
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Application.php:
--------------------------------------------------------------------------------
1 | container = $container;
31 |
32 | parent::__construct();
33 | }
34 |
35 | /**
36 | * @inheritdoc
37 | */
38 | protected function getDefaultCommands()
39 | {
40 | return array_merge(parent::getDefaultCommands(), [
41 | $this->container->get(Command\BuildCompose::class),
42 | $this->container->get(Command\BuildDist::class),
43 | $this->container->get(Command\Image\GeneratePhp::class)
44 | ]);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Config/Dist/Formatter.php:
--------------------------------------------------------------------------------
1 | = 5.4 short array syntax. Otherwise use
20 | * default var_export functionality.
21 | *
22 | * @param mixed $var
23 | * @param int $depth
24 | * @return string
25 | */
26 | public function varExport($var, int $depth = 1): string
27 | {
28 | if (!is_array($var)) {
29 | return var_export($var, true);
30 | }
31 |
32 | $indexed = array_keys($var) === range(0, count($var) - 1);
33 | $expanded = [];
34 | foreach ($var as $key => $value) {
35 | $expanded[] = str_repeat(self::INDENT, $depth)
36 | . ($indexed ? '' : $this->varExport($key) . ' => ')
37 | . $this->varExport($value, $depth + 1);
38 | }
39 |
40 | return sprintf("[\n%s\n%s]", implode(",\n", $expanded), str_repeat(self::INDENT, $depth - 1));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Test/Unit/Service/ServiceFactoryTest.php:
--------------------------------------------------------------------------------
1 | factory = new ServiceFactory();
30 | }
31 |
32 | /**
33 | * @throws ConfigurationMismatchException
34 | */
35 | public function testCreate()
36 | {
37 | $this->factory->create(ServiceFactory::SERVICE_CLI, '7.0');
38 | }
39 |
40 | /**
41 | * @expectedExceptionMessage Service "test" is not supported
42 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
43 | *
44 | * @throws ConfigurationMismatchException
45 | */
46 | public function testCreateServiceNotSupported()
47 | {
48 | $this->factory->create('test', '5.6');
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/images/nginx/1.9/etc/certs/magento.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDdDCCAlwCCQCkL06EvsPP2TANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJH
3 | QjERMA8GA1UECBMIU29tZXJzZXQxDTALBgNVBAcTBEJhdGgxEDAOBgNVBAoTB01l
4 | YW5iZWUxFDASBgNVBAMTC21hZ2VudG8uZGV2MSMwIQYJKoZIhvcNAQkBFhRzeXNh
5 | ZG1pbkBleGFtcGxlLmNvbTAeFw0xNzA2MjgxMjEyMTZaFw0yNzA2MjYxMjEyMTZa
6 | MHwxCzAJBgNVBAYTAkdCMREwDwYDVQQIEwhTb21lcnNldDENMAsGA1UEBxMEQmF0
7 | aDEQMA4GA1UEChMHTWVhbmJlZTEUMBIGA1UEAxMLbWFnZW50by5kZXYxIzAhBgkq
8 | hkiG9w0BCQEWFHN5c2FkbWluQGV4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEF
9 | AAOCAQ8AMIIBCgKCAQEA71Ar7riah4gVBY6AisU76n1qYNDhnKLZ6OAd2I+3ll+U
10 | zQPzb2B+Mn32zo1WURGmBODUMfvAsfPaW/XWODfaAzi+0x3+K/5h5t28Twkc3x4J
11 | 5jFuJGhTqez30lxrG6KgAsKo61NL80Ey6wgC/G+EOOL/xrwOKi8veSKPcFWQCI5P
12 | Ctjhb1uW5n5UvelnZ4P8Q+o4gzjPGW0UgtZqdOBD9gUSF8gRtxwyqoJldyY+YWpv
13 | eQGmlj6bqMPR27EVPjmtXTdY7SASt8FwZviLlIb3d0MegEJOasAbbRqwKb8Frnuu
14 | xUG17ga0WoK939uAnL6F7dTfDBusE4AUfuHrmSzp2wIDAQABMA0GCSqGSIb3DQEB
15 | CwUAA4IBAQDM4Et6nCcAISR+J4rA4iF8mLi+1dj94KHcdmanm7Y06wFzt7g1Lf5u
16 | DjHbVzqqLNCNGIsxOA5f2ERQ2vqXR+0PkB85Yhgr2xyFnmpgo8qoroHnCEvdVPi0
17 | a96nb7LmhknC2zWHAufXy1vyNRWuGLHIUUw5xnTUhJkhybJiT/68F0uK/qmwbSGb
18 | bGKsR8Z5UeE7OPT+OEplpIVBo55ktQ4ehAxB3FCa8kZdpYNASsfcyHOYTVDXMlVL
19 | OT3VHhx7i0qh1mFm+SLST82Noq0bhbNRnd2HlkUrsSX8LAeI4YvSnvnbxs//Bm0d
20 | 9BocWjDXr12xHdbS7SMoZPgBZ9Bn9koV
21 | -----END CERTIFICATE-----
22 |
--------------------------------------------------------------------------------
/images/tls/certs/magento2.docker.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDljCCAn4CCQDnRn3DzcK9LDANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UEBhMC
3 | VVMxDjAMBgNVBAgMBVRleGFzMQ8wDQYDVQQHDAZBdXN0aW4xEDAOBgNVBAoMB01h
4 | Z2VudG8xDjAMBgNVBAsMBUNsb3VkMRgwFgYDVQQDDA9tYWdlbnRvMi5kb2NrZXIx
5 | IDAeBgkqhkiG9w0BCQEWEWNsb3VkQG1hZ2VudG8uY29tMB4XDTE5MDMyMTE2MDQz
6 | MloXDTIwMDMyMDE2MDQzMlowgYwxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhh
7 | czEPMA0GA1UEBwwGQXVzdGluMRAwDgYDVQQKDAdNYWdlbnRvMQ4wDAYDVQQLDAVD
8 | bG91ZDEYMBYGA1UEAwwPbWFnZW50bzIuZG9ja2VyMSAwHgYJKoZIhvcNAQkBFhFj
9 | bG91ZEBtYWdlbnRvLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
10 | AMtRwjGlgJTxDc9uWIopXDYaFJBzzZ7sc1sM5Bcd/T9ES3964KpHemY+5fYjXGk7
11 | tWrE1GKcpfC2NOQrCi4T4EcIE81U0NNr3OUy2l769J9CXo4RG5BBAsO4Tr5H+vZv
12 | Voh38WfCSamJ7Rdnvxmd2x3x5R4mTS3tJRCytxEJujUg376CT5LMoPgHEp9tH1Vx
13 | 1jf0pmYzbEz4JwOoQyvy0wBb/2f91Z0ak4gXFman06yW6fcJf5Hugv5mDnE4Bz+g
14 | xr0QP0csTQBw3EV6mC3wZP9YQf16r8dyo9wx+JCKWl1opvFJ4byDFW4L+JVwTBws
15 | nNjPCphdiaUWKHR9UfD5co0CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEACXRJPY97
16 | 93oNMYtKXnwa9r1+9eMvp2kITRiYI2kKejPQcvDAFN/V7NVkz8x6sZJgLpje6NTP
17 | n64cyTll1tbe2WYznoDn9VkRN7NNC9XgE5yH/ceOyrSVZBNv0strK1B375fWHjN6
18 | r5pvLg3yAgxU0xaWHqTMqwTYIFZLmBnBu3j7HfGtuI8Ic0gMJXWIY/S4eSE2Wzbu
19 | Icnf+ToRa4AKf+3otYqrrQ9zT6GZqrYDzQVmm173OLmvsQMqlo3+0G27Pxb6/KGW
20 | MEG3SslulnNqDwi7bgqa+ZZ/7L+T1ruh6gNUHXAUUAampUrsXJZenThAwhY7UiHk
21 | GjnO5Hagvij1hA==
22 | -----END CERTIFICATE-----
23 |
--------------------------------------------------------------------------------
/config/services.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 | ### Description
12 |
16 |
17 | ### Fixed Issues (if relevant)
18 |
22 | 1. magento/magento-cloud-docker#: Issue title
23 | 2. ...
24 |
25 | ### Manual testing scenarios
26 |
30 | 1. ...
31 | 2. ...
32 |
33 | ### Contribution checklist
34 | - [ ] Pull request has a meaningful description of its purpose
35 | - [ ] All commits are accompanied by meaningful commit messages
36 |
--------------------------------------------------------------------------------
/src/Filesystem/FileList.php:
--------------------------------------------------------------------------------
1 | directoryList = $directoryList;
24 | }
25 |
26 | /**
27 | * @return string
28 | */
29 | public function getMagentoDockerCompose(): string
30 | {
31 | return $this->directoryList->getMagentoRoot() . '/docker-compose.yml';
32 | }
33 |
34 | /**
35 | * @return string
36 | */
37 | public function getAppConfig(): string
38 | {
39 | return $this->directoryList->getMagentoRoot() . '/.magento.app.yaml';
40 | }
41 |
42 | /**
43 | * @return string
44 | */
45 | public function getServicesConfig(): string
46 | {
47 | return $this->directoryList->getMagentoRoot() . '/.magento/services.yaml';
48 | }
49 |
50 | /**
51 | * @return string
52 | */
53 | public function getEceToolsCompose(): string
54 | {
55 | return $this->directoryList->getEceToolsRoot() . '/docker-compose.yml';
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Command/BuildDist.php:
--------------------------------------------------------------------------------
1 | distGenerator = $distGenerator;
34 |
35 | parent::__construct();
36 | }
37 |
38 | /**
39 | * @inheritDoc
40 | */
41 | protected function configure()
42 | {
43 | $this->setName(self::NAME)
44 | ->setDescription('Generates Docker .dist files');
45 | }
46 |
47 | /**
48 | * {@inheritDoc}
49 | *
50 | * @throws ConfigurationMismatchException
51 | */
52 | public function execute(InputInterface $input, OutputInterface $output)
53 | {
54 | $this->distGenerator->generate();
55 |
56 | $output->writeln('Dist files generated');
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/images/php/cli/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | CRON_LOG=/var/log/cron.log
9 |
10 | if [ ! -z "${CRONTAB}" ]; then
11 | echo "${CRONTAB}" > /etc/cron.d/magento
12 | fi
13 |
14 | # Get rsyslog running for cron output
15 | touch $CRON_LOG
16 | echo "cron.* $CRON_LOG" > /etc/rsyslog.d/cron.conf
17 | service rsyslog start
18 |
19 | # Configure Sendmail if required
20 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
21 | /etc/init.d/sendmail start
22 | fi
23 |
24 | # Enable PHP extensions
25 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
26 | PHP_EXT_COM_ON=docker-php-ext-enable
27 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
28 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
29 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
30 | fi
31 |
32 | # Substitute in php.ini values
33 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
34 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
35 |
36 | # Configure composer
37 | [ ! -z "${COMPOSER_GITHUB_TOKEN}" ] && \
38 | composer config --global github-oauth.github.com $COMPOSER_GITHUB_TOKEN
39 |
40 | [ ! -z "${COMPOSER_MAGENTO_USERNAME}" ] && \
41 | composer config --global http-basic.repo.magento.com \
42 | $COMPOSER_MAGENTO_USERNAME $COMPOSER_MAGENTO_PASSWORD
43 |
44 | exec "$@"
45 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | CRON_LOG=/var/log/cron.log
9 |
10 | if [ ! -z "${CRONTAB}" ]; then
11 | echo "${CRONTAB}" > /etc/cron.d/magento
12 | fi
13 |
14 | # Get rsyslog running for cron output
15 | touch $CRON_LOG
16 | echo "cron.* $CRON_LOG" > /etc/rsyslog.d/cron.conf
17 | service rsyslog start
18 |
19 | # Configure Sendmail if required
20 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
21 | /etc/init.d/sendmail start
22 | fi
23 |
24 | # Enable PHP extensions
25 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
26 | PHP_EXT_COM_ON=docker-php-ext-enable
27 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
28 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
29 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
30 | fi
31 |
32 | # Substitute in php.ini values
33 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
34 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
35 |
36 | # Configure composer
37 | [ ! -z "${COMPOSER_GITHUB_TOKEN}" ] && \
38 | composer config --global github-oauth.github.com $COMPOSER_GITHUB_TOKEN
39 |
40 | [ ! -z "${COMPOSER_MAGENTO_USERNAME}" ] && \
41 | composer config --global http-basic.repo.magento.com \
42 | $COMPOSER_MAGENTO_USERNAME $COMPOSER_MAGENTO_PASSWORD
43 |
44 | exec "$@"
45 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | CRON_LOG=/var/log/cron.log
9 |
10 | if [ ! -z "${CRONTAB}" ]; then
11 | echo "${CRONTAB}" > /etc/cron.d/magento
12 | fi
13 |
14 | # Get rsyslog running for cron output
15 | touch $CRON_LOG
16 | echo "cron.* $CRON_LOG" > /etc/rsyslog.d/cron.conf
17 | service rsyslog start
18 |
19 | # Configure Sendmail if required
20 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
21 | /etc/init.d/sendmail start
22 | fi
23 |
24 | # Enable PHP extensions
25 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
26 | PHP_EXT_COM_ON=docker-php-ext-enable
27 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
28 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
29 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
30 | fi
31 |
32 | # Substitute in php.ini values
33 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
34 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
35 |
36 | # Configure composer
37 | [ ! -z "${COMPOSER_GITHUB_TOKEN}" ] && \
38 | composer config --global github-oauth.github.com $COMPOSER_GITHUB_TOKEN
39 |
40 | [ ! -z "${COMPOSER_MAGENTO_USERNAME}" ] && \
41 | composer config --global http-basic.repo.magento.com \
42 | $COMPOSER_MAGENTO_USERNAME $COMPOSER_MAGENTO_PASSWORD
43 |
44 | exec "$@"
45 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | CRON_LOG=/var/log/cron.log
9 |
10 | if [ ! -z "${CRONTAB}" ]; then
11 | echo "${CRONTAB}" > /etc/cron.d/magento
12 | fi
13 |
14 | # Get rsyslog running for cron output
15 | touch $CRON_LOG
16 | echo "cron.* $CRON_LOG" > /etc/rsyslog.d/cron.conf
17 | service rsyslog start
18 |
19 | # Configure Sendmail if required
20 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
21 | /etc/init.d/sendmail start
22 | fi
23 |
24 | # Enable PHP extensions
25 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
26 | PHP_EXT_COM_ON=docker-php-ext-enable
27 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
28 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
29 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
30 | fi
31 |
32 | # Substitute in php.ini values
33 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
34 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
35 |
36 | # Configure composer
37 | [ ! -z "${COMPOSER_GITHUB_TOKEN}" ] && \
38 | composer config --global github-oauth.github.com $COMPOSER_GITHUB_TOKEN
39 |
40 | [ ! -z "${COMPOSER_MAGENTO_USERNAME}" ] && \
41 | composer config --global http-basic.repo.magento.com \
42 | $COMPOSER_MAGENTO_USERNAME $COMPOSER_MAGENTO_PASSWORD
43 |
44 | exec "$@"
45 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | [ "$DEBUG" = "true" ] && set -x
4 |
5 | # Ensure our Magento directory exists
6 | mkdir -p $MAGENTO_ROOT
7 |
8 | CRON_LOG=/var/log/cron.log
9 |
10 | if [ ! -z "${CRONTAB}" ]; then
11 | echo "${CRONTAB}" > /etc/cron.d/magento
12 | fi
13 |
14 | # Get rsyslog running for cron output
15 | touch $CRON_LOG
16 | echo "cron.* $CRON_LOG" > /etc/rsyslog.d/cron.conf
17 | service rsyslog start
18 |
19 | # Configure Sendmail if required
20 | if [ "$ENABLE_SENDMAIL" == "true" ]; then
21 | /etc/init.d/sendmail start
22 | fi
23 |
24 | # Enable PHP extensions
25 | PHP_EXT_DIR=/usr/local/etc/php/conf.d
26 | PHP_EXT_COM_ON=docker-php-ext-enable
27 | [ -d ${PHP_EXT_DIR} ] && rm -f ${PHP_EXT_DIR}/docker-php-ext-*.ini
28 | if [ -x "$(command -v ${PHP_EXT_COM_ON})" ] && [ ! -z "${PHP_EXTENSIONS}" ]; then
29 | ${PHP_EXT_COM_ON} ${PHP_EXTENSIONS}
30 | fi
31 |
32 | # Substitute in php.ini values
33 | [ ! -z "${PHP_MEMORY_LIMIT}" ] && sed -i "s/!PHP_MEMORY_LIMIT!/${PHP_MEMORY_LIMIT}/" /usr/local/etc/php/conf.d/zz-magento.ini
34 | [ ! -z "${UPLOAD_MAX_FILESIZE}" ] && sed -i "s/!UPLOAD_MAX_FILESIZE!/${UPLOAD_MAX_FILESIZE}/" /usr/local/etc/php/conf.d/zz-magento.ini
35 |
36 | # Configure composer
37 | [ ! -z "${COMPOSER_GITHUB_TOKEN}" ] && \
38 | composer config --global github-oauth.github.com $COMPOSER_GITHUB_TOKEN
39 |
40 | [ ! -z "${COMPOSER_MAGENTO_USERNAME}" ] && \
41 | composer config --global http-basic.repo.magento.com \
42 | $COMPOSER_MAGENTO_USERNAME $COMPOSER_MAGENTO_PASSWORD
43 |
44 | exec "$@"
45 |
--------------------------------------------------------------------------------
/dist/bin/magento-docker:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | if [ ${#@} -ne 0 ] && [ "${@#"-h"}" = "" ]; then
6 | USAGE="Magento Cloud Docker
7 |
8 | \033[33mArguments:\033[0m
9 | pull pull latest images
10 | up destroy, re-create and start containers
11 | down destroy containers
12 | bash connect to bash
13 | stop stop containers
14 | start start containers
15 | restart restart containers
16 | ece-build build application
17 | ece-deploy deploy application
18 | ece-redeploy re-build and re-deploy application
19 |
20 | \033[33mOptions:\033[0m
21 | -h show this help text\n"
22 |
23 | printf "$USAGE"
24 | exit 0;
25 | fi;
26 |
27 | case "$1" in
28 | pull)
29 | docker-compose pull
30 | ;;
31 | up)
32 | docker-compose down --volumes
33 | docker-compose up --detach
34 | ;;
35 | down)
36 | docker-compose down --volumes
37 | ;;
38 | bash)
39 | docker-compose run deploy bash
40 | ;;
41 | stop)
42 | docker-compose stop
43 | ;;
44 | start)
45 | docker-compose start
46 | ;;
47 | restart)
48 | docker-compose restart
49 | ;;
50 | ece-build)
51 | docker-compose run build cloud-build
52 | ;;
53 | ece-deploy)
54 | docker-compose run deploy cloud-deploy
55 | ;;
56 | ece-redeploy)
57 | docker-compose run build cloud-build
58 | docker-compose run deploy cloud-deploy
59 | ;;
60 | *)
61 | printf "\033[31m Wrong command passed\033[0m\n"
62 | exit 1
63 | esac
64 |
--------------------------------------------------------------------------------
/src/Filesystem/DirectoryList.php:
--------------------------------------------------------------------------------
1 | root = $root;
38 | $this->magentoRoot = $magentoRoot;
39 | $this->eceRoot = $eceRoot;
40 | }
41 |
42 | /**
43 | * @return string
44 | */
45 | private function getRoot(): string
46 | {
47 | return $this->root;
48 | }
49 |
50 | /**
51 | * @return string
52 | */
53 | public function getMagentoRoot(): string
54 | {
55 | return $this->magentoRoot;
56 | }
57 |
58 | /**
59 | * @return string
60 | */
61 | public function getEceToolsRoot(): string
62 | {
63 | return $this->eceRoot;
64 | }
65 |
66 | /**
67 | * @return string
68 | */
69 | public function getDockerRoot(): string
70 | {
71 | return $this->getMagentoRoot() . '/.docker';
72 | }
73 |
74 | /**
75 | * @return string
76 | */
77 | public function getImagesRoot(): string
78 | {
79 | return $this->getRoot() . '/images';
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/images/nginx/1.9/etc/certs/magento.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIIEpQIBAAKCAQEA71Ar7riah4gVBY6AisU76n1qYNDhnKLZ6OAd2I+3ll+UzQPz
3 | b2B+Mn32zo1WURGmBODUMfvAsfPaW/XWODfaAzi+0x3+K/5h5t28Twkc3x4J5jFu
4 | JGhTqez30lxrG6KgAsKo61NL80Ey6wgC/G+EOOL/xrwOKi8veSKPcFWQCI5PCtjh
5 | b1uW5n5UvelnZ4P8Q+o4gzjPGW0UgtZqdOBD9gUSF8gRtxwyqoJldyY+YWpveQGm
6 | lj6bqMPR27EVPjmtXTdY7SASt8FwZviLlIb3d0MegEJOasAbbRqwKb8FrnuuxUG1
7 | 7ga0WoK939uAnL6F7dTfDBusE4AUfuHrmSzp2wIDAQABAoIBACl/GV8Xm5QMwLhp
8 | 8Vgewzjx7lRDZBupEWgUFJjMsuTcRg0WtkuFy9wtg3Jlh6YfDU6jPag9Izi4NBDm
9 | G/M7nA4a9Nvew4gVYByMLm72AY+ewdCsmZCulnNMp9xOMjRkiqJv5qKHmw/fKlke
10 | 1oW3QJIsqnVnfn1KGU1D9ONhsswIq0x8u3NEt0Fc3zRjVm6dcXef6kNBZJQNynFG
11 | BbDfV0qkuiTmabvh04huhldtHYZmHXAHeeQ9k0SRkn9gVdSqjMe+DQ5odjaukotb
12 | P1qnG94AdkXuVDGNXFoQ8rNLZPXQ9UO/P81pN6og728u+OuwaSwYgJhia4j88zg/
13 | Ffptg6ECgYEA+aRh1iQFHGj5eT/dijgghnkK2fkoZlKGazeDdqME9ASpZPuLiPI0
14 | 0ng+BEWA2ejLM/B0UuBm/VWy9cwT7F4d5ByCvrpclYA0Tn7d94K6YP0cwBYvHa54
15 | j6fkKgy/R1BjKCD2AKI2g0Hgh3QzgrgPwMdZcjEi4eWbLx9s6ocCLLcCgYEA9Why
16 | XB9FTQdK/ptGSAKye+VVXqXqYxFHHKes55b+ACbK2mYF9Xqp7z0fu56ZqCdxGbG2
17 | GmhFM8RnebsHGc38761+VrI73GQ6S2dMKt6PzCg7t+3NCaF7Z+t65kEV55w6Vmri
18 | eIw34hXTpbPemHXomcvifpY9ootqnP0BhjfYD/0CgYEArBZV3yEbaNcwShXtaM+C
19 | FFCyW0n3QHnY8WXmOMztqCzifJsuN+wG36NF1Pn4db6U/SvfdBX+yNnfsLLKdSD3
20 | 5/yDYGjlU6V56TZpWqqCQkOZIwzn08UmlJi+nwIEhWtzvwDhs9QeUeMCnT1MGOs6
21 | 6MBC94XJrwDxNc2q7gy9QgcCgYEAnBHrwNiGS0GbGScI4F0Ow6qKy2G7GXvwfLHK
22 | TZKCQPhqw9Bkc8Sp9CMsXja0Q/Opgwy44jxz3kNHB2zBTFDrTkZI9bvuQ/Bd/nxY
23 | PV9DljP0HroWTsyq3eEtTOgRlTWPCEx7cOzD0X3OFzC4HL/HyJ+YkKbd1dTSXbqt
24 | 0H0NZMUCgYEA0Fdu0oZMMDDWFFEcRY5PVenxuj59cl6gARB86e5p3clIGwTx5/5C
25 | FJzp0zdfb9vE/cTlV3mKSFUskSUTFHaHjI1w3oRD/oDMkgImRpDvqye0PBpiSyRE
26 | Cz4N7ikKJRzxABkHtCqEG+VA/ah2obIpbzYSfGTAKlS/6u7FBgLSmn8=
27 | -----END RSA PRIVATE KEY-----
28 |
--------------------------------------------------------------------------------
/images/tls/certs/magento2.docker.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDLUcIxpYCU8Q3P
3 | bliKKVw2GhSQc82e7HNbDOQXHf0/REt/euCqR3pmPuX2I1xpO7VqxNRinKXwtjTk
4 | KwouE+BHCBPNVNDTa9zlMtpe+vSfQl6OERuQQQLDuE6+R/r2b1aId/Fnwkmpie0X
5 | Z78Zndsd8eUeJk0t7SUQsrcRCbo1IN++gk+SzKD4BxKfbR9VcdY39KZmM2xM+CcD
6 | qEMr8tMAW/9n/dWdGpOIFxZmp9Oslun3CX+R7oL+Zg5xOAc/oMa9ED9HLE0AcNxF
7 | epgt8GT/WEH9eq/HcqPcMfiQilpdaKbxSeG8gxVuC/iVcEwcLJzYzwqYXYmlFih0
8 | fVHw+XKNAgMBAAECggEBAKfaaqEECoBr9cPPTIdbmAYOR/XttM7EVIPRw6iWGJIX
9 | tuCauEm70wAAY2duUAeMxLxNnS2AN7rfIhFQuwnJXPonX/m/UNuKjAYokoGhWzzz
10 | 1Q4ib4gLM9YTHecXk8fJqT3nD8RicN/nv3X4L5tdaB1zq3zVkBgfVN9RO7N0PWdH
11 | sNxlA9cE5UmfJoIFdL7EBoMGC+o6tJEB0DbS/Nu9FCuq7L1/GDSyM3cldc+3EegX
12 | RwiTW3+11xqct9grWmVy/lb2/DoIZQdg8JjuJDrhuDbx2g+bBOIFmxxhQpk4OkmD
13 | GloP5Hoc0GHtuFi2Pa/8gCODEqEFddQR6pMe3zUFr0ECgYEA5KsYFQ+jeFaH4Dr9
14 | 8uULMEz14mn8qXANnwHt7uhQE+Ab0n6VgCPUK8FFO5dqhVNjgDW4lbOU4G3S+0qc
15 | C+WBbctkAeacPwfu1dPjR9FoCktx6Im/VL5zw6n6M75n54RHLu37Foy+2DPmYz+1
16 | qknJmhBITlMJuIOZcF+PcQoaiTECgYEA458GPZQGdfv+thRqJSMi0MCaSDnJiNdo
17 | Jdyz3NYw1c4yI8cjRhLUnG6r5zqfUlr0kqtiLu4HYzUQCFqeEgzYV5ruw6m4Br30
18 | ivJGqMjMy6t7aW7c23ozO/9hYzdiuC916JSJWnn+W+v+1xZJJ1hGNtDlOT/Qkvv3
19 | n10v63j8aB0CgYBu3FgvlcZeCC2V02PdB5hWEWnAHDxHdTDVXx0Yj36LNEKo2X/n
20 | gPdTQz8qde1JuDTsKp9TzJ2n9Patp+1hgyIttcbFeSVVFaZ/+lsdLXPwUcVmxKmD
21 | D1aWjOjlfzFmt+W+5deuhgvcS8UtZuzPIzjfPXegqXd0AjE4nsuvNQPKcQKBgCyM
22 | ANKoV6Nbj/vefu+JstSb/RXJiXGoho9yZBkCKkiNtC5gWLzsDoQW/LmiNXAOsPLL
23 | a8m3d+aoidy4r1rk/KoYfkX4vzVCk8tlowKBWeM6SkrWEY86mTBSyKJ8Qmu9jhvY
24 | hhEY8vjWdOdvSx3SHtu3gkT0AkPh4BJmUGyLHwrZAoGBAJeYwOhNuxZe8Bh4Rm6N
25 | 6g3fOezBUqk3RE/XIQbdh1ONEQV2P3bGdsuCNgn/6qSP9jto4O7OV8UetJhc/Sou
26 | PmQFgN60IBztvSLWUk9JI2va0PSupbvnOOdxL3nsi5mwED6Ck8v91x83fS3LdVVR
27 | PHvwNIjbx7J6hjqswN8fF/7X
28 | -----END PRIVATE KEY-----
29 |
--------------------------------------------------------------------------------
/src/Compose/ComposeFactory.php:
--------------------------------------------------------------------------------
1 | Compose\DeveloperCompose::class,
30 | self::COMPOSE_PRODUCTION => Compose\ProductionCompose::class,
31 | /** Internal CI configurations. */
32 | self::COMPOSE_FUNCTIONAL => Compose\FunctionalCompose::class
33 | ];
34 |
35 | /**
36 | * @var ContainerInterface
37 | */
38 | private $container;
39 |
40 | /**
41 | * @param ContainerInterface $container
42 | */
43 | public function __construct(ContainerInterface $container)
44 | {
45 | $this->container = $container;
46 | }
47 |
48 | /**
49 | * @param string $strategy
50 | * @return ComposeInterface
51 | * @throws ConfigurationMismatchException
52 | */
53 | public function create(string $strategy): ComposeInterface
54 | {
55 | if (!array_key_exists($strategy, self::$map)) {
56 | throw new ConfigurationMismatchException(
57 | sprintf('Wrong strategy "%s" passed', $strategy)
58 | );
59 | }
60 |
61 | return $this->container->get(self::$map[$strategy]);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/images/php/cli/bin/run-hooks:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import yaml
4 | import os
5 | import sys
6 | import subprocess
7 |
8 | # Disable output buffering.
9 | os.environ['PYTHONUNBUFFERED'] = "1"
10 |
11 | # The list of available hooks.
12 | available_hooks = ["build", "deploy", "post_deploy"]
13 |
14 |
15 | # Prints a message and returns an exit code.
16 | def error_exit(msg, code=1):
17 | print(msg)
18 | sys.exit(code)
19 |
20 |
21 | # Gets Magento root path.
22 | def get_magento_root():
23 | try:
24 | return str(os.environ['MAGENTO_ROOT'])
25 | except KeyError:
26 | error_exit('Environment variable MAGENTO_ROOT is not available')
27 |
28 |
29 | # Gets set hooks by hook name.
30 | def get_hooks(hook_name):
31 | with open(get_magento_root() + "/.magento.app.yaml", 'r') as stream:
32 | try:
33 | content = yaml.safe_load(stream)
34 | return content["hooks"][hook_name]
35 | except yaml.YAMLError as exc:
36 | error_exit(exc)
37 | except KeyError:
38 | error_exit("The hook \"" + hook_name + "\" is not in the .magento.app.yaml file. Skipped", 0)
39 |
40 |
41 | # Main function.
42 | def main():
43 | if len(sys.argv) != 2:
44 | error_exit("Usage: run-hooks ")
45 |
46 | hook_name = str(sys.argv[1])
47 | if hook_name not in available_hooks:
48 | error_exit("The hook \"" + hook_name + "\" is not available. The list of available hooks: " + ", ".join(available_hooks))
49 |
50 | try:
51 | subprocess.check_call(
52 | get_hooks(hook_name),
53 | shell=True,
54 | cwd=get_magento_root()
55 | )
56 | except subprocess.CalledProcessError as exc:
57 | error_exit("returned non-zero exit status " + str(exc.returncode))
58 |
59 |
60 | if __name__ == '__main__':
61 | main()
62 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/bin/run-hooks:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import yaml
4 | import os
5 | import sys
6 | import subprocess
7 |
8 | # Disable output buffering.
9 | os.environ['PYTHONUNBUFFERED'] = "1"
10 |
11 | # The list of available hooks.
12 | available_hooks = ["build", "deploy", "post_deploy"]
13 |
14 |
15 | # Prints a message and returns an exit code.
16 | def error_exit(msg, code=1):
17 | print(msg)
18 | sys.exit(code)
19 |
20 |
21 | # Gets Magento root path.
22 | def get_magento_root():
23 | try:
24 | return str(os.environ['MAGENTO_ROOT'])
25 | except KeyError:
26 | error_exit('Environment variable MAGENTO_ROOT is not available')
27 |
28 |
29 | # Gets set hooks by hook name.
30 | def get_hooks(hook_name):
31 | with open(get_magento_root() + "/.magento.app.yaml", 'r') as stream:
32 | try:
33 | content = yaml.safe_load(stream)
34 | return content["hooks"][hook_name]
35 | except yaml.YAMLError as exc:
36 | error_exit(exc)
37 | except KeyError:
38 | error_exit("The hook \"" + hook_name + "\" is not in the .magento.app.yaml file. Skipped", 0)
39 |
40 |
41 | # Main function.
42 | def main():
43 | if len(sys.argv) != 2:
44 | error_exit("Usage: run-hooks ")
45 |
46 | hook_name = str(sys.argv[1])
47 | if hook_name not in available_hooks:
48 | error_exit("The hook \"" + hook_name + "\" is not available. The list of available hooks: " + ", ".join(available_hooks))
49 |
50 | try:
51 | subprocess.check_call(
52 | get_hooks(hook_name),
53 | shell=True,
54 | cwd=get_magento_root()
55 | )
56 | except subprocess.CalledProcessError as exc:
57 | error_exit("returned non-zero exit status " + str(exc.returncode))
58 |
59 |
60 | if __name__ == '__main__':
61 | main()
62 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/bin/run-hooks:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import yaml
4 | import os
5 | import sys
6 | import subprocess
7 |
8 | # Disable output buffering.
9 | os.environ['PYTHONUNBUFFERED'] = "1"
10 |
11 | # The list of available hooks.
12 | available_hooks = ["build", "deploy", "post_deploy"]
13 |
14 |
15 | # Prints a message and returns an exit code.
16 | def error_exit(msg, code=1):
17 | print(msg)
18 | sys.exit(code)
19 |
20 |
21 | # Gets Magento root path.
22 | def get_magento_root():
23 | try:
24 | return str(os.environ['MAGENTO_ROOT'])
25 | except KeyError:
26 | error_exit('Environment variable MAGENTO_ROOT is not available')
27 |
28 |
29 | # Gets set hooks by hook name.
30 | def get_hooks(hook_name):
31 | with open(get_magento_root() + "/.magento.app.yaml", 'r') as stream:
32 | try:
33 | content = yaml.safe_load(stream)
34 | return content["hooks"][hook_name]
35 | except yaml.YAMLError as exc:
36 | error_exit(exc)
37 | except KeyError:
38 | error_exit("The hook \"" + hook_name + "\" is not in the .magento.app.yaml file. Skipped", 0)
39 |
40 |
41 | # Main function.
42 | def main():
43 | if len(sys.argv) != 2:
44 | error_exit("Usage: run-hooks ")
45 |
46 | hook_name = str(sys.argv[1])
47 | if hook_name not in available_hooks:
48 | error_exit("The hook \"" + hook_name + "\" is not available. The list of available hooks: " + ", ".join(available_hooks))
49 |
50 | try:
51 | subprocess.check_call(
52 | get_hooks(hook_name),
53 | shell=True,
54 | cwd=get_magento_root()
55 | )
56 | except subprocess.CalledProcessError as exc:
57 | error_exit("returned non-zero exit status " + str(exc.returncode))
58 |
59 |
60 | if __name__ == '__main__':
61 | main()
62 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/bin/run-hooks:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import yaml
4 | import os
5 | import sys
6 | import subprocess
7 |
8 | # Disable output buffering.
9 | os.environ['PYTHONUNBUFFERED'] = "1"
10 |
11 | # The list of available hooks.
12 | available_hooks = ["build", "deploy", "post_deploy"]
13 |
14 |
15 | # Prints a message and returns an exit code.
16 | def error_exit(msg, code=1):
17 | print(msg)
18 | sys.exit(code)
19 |
20 |
21 | # Gets Magento root path.
22 | def get_magento_root():
23 | try:
24 | return str(os.environ['MAGENTO_ROOT'])
25 | except KeyError:
26 | error_exit('Environment variable MAGENTO_ROOT is not available')
27 |
28 |
29 | # Gets set hooks by hook name.
30 | def get_hooks(hook_name):
31 | with open(get_magento_root() + "/.magento.app.yaml", 'r') as stream:
32 | try:
33 | content = yaml.safe_load(stream)
34 | return content["hooks"][hook_name]
35 | except yaml.YAMLError as exc:
36 | error_exit(exc)
37 | except KeyError:
38 | error_exit("The hook \"" + hook_name + "\" is not in the .magento.app.yaml file. Skipped", 0)
39 |
40 |
41 | # Main function.
42 | def main():
43 | if len(sys.argv) != 2:
44 | error_exit("Usage: run-hooks ")
45 |
46 | hook_name = str(sys.argv[1])
47 | if hook_name not in available_hooks:
48 | error_exit("The hook \"" + hook_name + "\" is not available. The list of available hooks: " + ", ".join(available_hooks))
49 |
50 | try:
51 | subprocess.check_call(
52 | get_hooks(hook_name),
53 | shell=True,
54 | cwd=get_magento_root()
55 | )
56 | except subprocess.CalledProcessError as exc:
57 | error_exit("returned non-zero exit status " + str(exc.returncode))
58 |
59 |
60 | if __name__ == '__main__':
61 | main()
62 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/bin/run-hooks:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import yaml
4 | import os
5 | import sys
6 | import subprocess
7 |
8 | # Disable output buffering.
9 | os.environ['PYTHONUNBUFFERED'] = "1"
10 |
11 | # The list of available hooks.
12 | available_hooks = ["build", "deploy", "post_deploy"]
13 |
14 |
15 | # Prints a message and returns an exit code.
16 | def error_exit(msg, code=1):
17 | print(msg)
18 | sys.exit(code)
19 |
20 |
21 | # Gets Magento root path.
22 | def get_magento_root():
23 | try:
24 | return str(os.environ['MAGENTO_ROOT'])
25 | except KeyError:
26 | error_exit('Environment variable MAGENTO_ROOT is not available')
27 |
28 |
29 | # Gets set hooks by hook name.
30 | def get_hooks(hook_name):
31 | with open(get_magento_root() + "/.magento.app.yaml", 'r') as stream:
32 | try:
33 | content = yaml.safe_load(stream)
34 | return content["hooks"][hook_name]
35 | except yaml.YAMLError as exc:
36 | error_exit(exc)
37 | except KeyError:
38 | error_exit("The hook \"" + hook_name + "\" is not in the .magento.app.yaml file. Skipped", 0)
39 |
40 |
41 | # Main function.
42 | def main():
43 | if len(sys.argv) != 2:
44 | error_exit("Usage: run-hooks ")
45 |
46 | hook_name = str(sys.argv[1])
47 | if hook_name not in available_hooks:
48 | error_exit("The hook \"" + hook_name + "\" is not available. The list of available hooks: " + ", ".join(available_hooks))
49 |
50 | try:
51 | subprocess.check_call(
52 | get_hooks(hook_name),
53 | shell=True,
54 | cwd=get_magento_root()
55 | )
56 | except subprocess.CalledProcessError as exc:
57 | error_exit("returned non-zero exit status " + str(exc.returncode))
58 |
59 |
60 | if __name__ == '__main__':
61 | main()
62 |
--------------------------------------------------------------------------------
/src/Compose/DeveloperCompose.php:
--------------------------------------------------------------------------------
1 | self::SYNC_ENGINE_DOCKER_SYNC === $config[self::SYNC_ENGINE] ? ['external' => true] : []
36 | ];
37 |
38 | return $compose;
39 | }
40 |
41 | /**
42 | * @param bool $isReadOnly
43 | * @return array
44 | */
45 | protected function getMagentoBuildVolumes(bool $isReadOnly): array
46 | {
47 | return [
48 | 'magento-sync:' . self::DIR_MAGENTO . ':nocopy'
49 | ];
50 | }
51 |
52 | /**
53 | * @inheritDoc
54 | */
55 | protected function getMagentoVolumes(bool $isReadOnly): array
56 | {
57 | return [
58 | 'magento-sync:' . self::DIR_MAGENTO . ':nocopy'
59 | ];
60 | }
61 |
62 | /**
63 | * @inheritDoc
64 | */
65 | protected function getVariables(): array
66 | {
67 | $variables = parent::getVariables();
68 | $variables['MAGENTO_RUN_MODE'] = 'developer';
69 |
70 | return $variables;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/images/php/cli/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:{%version%}-cli-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT=2G \
4 | MAGENTO_ROOT=/app \
5 | DEBUG=false \
6 | MAGENTO_RUN_MODE=production \
7 | COMPOSER_ALLOW_SUPERUSER=1
8 | {%env_php_extensions%}
9 |
10 | # Configure Node.js version
11 | RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
12 |
13 | # Install dependencies
14 | RUN apt-get update \
15 | && apt-get upgrade -y \
16 | && apt-get install -y --no-install-recommends \
17 | {%packages%} \
18 | && rm -rf /var/lib/apt/lists/*
19 |
20 | # Install PyYAML
21 | RUN pip3 install --upgrade setuptools \
22 | && pip3 install pyyaml
23 |
24 | # Install Grunt
25 | RUN npm install -g grunt-cli
26 |
27 | # Configure the gd library
28 | {%docker-php-ext-configure%}
29 |
30 | # Install required PHP extensions
31 | {%docker-php-ext-install%}
32 |
33 | {%php-pecl-extensions%}
34 |
35 | {%installation_scripts%}
36 |
37 | {%docker-php-ext-enable%}
38 |
39 | ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
40 | ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
41 | ADD etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
42 |
43 | VOLUME /root/.composer/cache
44 | # Get composer installed to /usr/local/bin/composer
45 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
46 |
47 | ADD bin/* /usr/local/bin/
48 | ADD docker-entrypoint.sh /docker-entrypoint.sh
49 |
50 | RUN ["chmod", "+x", \
51 | "/docker-entrypoint.sh", \
52 | "/usr/local/bin/magento-installer", \
53 | "/usr/local/bin/magento-command", \
54 | "/usr/local/bin/ece-command", \
55 | "/usr/local/bin/cloud-build", \
56 | "/usr/local/bin/cloud-deploy", \
57 | "/usr/local/bin/cloud-post-deploy", \
58 | "/usr/local/bin/run-cron", \
59 | "/usr/local/bin/run-hooks" \
60 | ]
61 |
62 | ENTRYPOINT ["/docker-entrypoint.sh"]
63 |
64 | WORKDIR ${MAGENTO_ROOT}
65 |
66 | CMD ["bash"]
67 |
--------------------------------------------------------------------------------
/src/Config/Environment/Reader.php:
--------------------------------------------------------------------------------
1 | directoryList = $directoryList;
40 | $this->filesystem = $filesystem;
41 | }
42 |
43 | /**
44 | * @inheritDoc
45 | */
46 | public function read(): array
47 | {
48 | $sourcePath = $this->directoryList->getDockerRoot() . '/config.php';
49 |
50 | if (!$this->filesystem->exists($sourcePath)) {
51 | $sourcePath .= '.dist';
52 | }
53 |
54 | try {
55 | if ($this->filesystem->exists($sourcePath)) {
56 | return $this->filesystem->getRequire($sourcePath);
57 | }
58 | } catch (FileNotFoundException $exception) {
59 | throw new FilesystemException($exception->getMessage(), $exception->getCode(), $exception);
60 | }
61 |
62 | throw new FilesystemException(sprintf(
63 | 'Source file %s does not exists',
64 | $sourcePath
65 | ));
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "magento/magento-cloud-docker",
3 | "description": "Magento Cloud Docker",
4 | "type": "magento2-component",
5 | "version": "1.0.0",
6 | "license": [
7 | "OSL-3.0",
8 | "AFL-3.0"
9 | ],
10 | "require": {
11 | "php": "^7.0",
12 | "ext-json": "*",
13 | "composer/semver": "^1.0",
14 | "illuminate/config": "^5.5",
15 | "illuminate/filesystem": "^5.5",
16 | "symfony/config": "^3.4||^4.0",
17 | "symfony/console": "^2.6||^4.0",
18 | "symfony/dependency-injection": "^3.1||^4.0",
19 | "symfony/yaml": "^3.3||^4.0"
20 | },
21 | "require-dev": {
22 | "phpunit/phpunit": "^6.2"
23 | },
24 | "bin": [
25 | "bin/ece-docker"
26 | ],
27 | "autoload": {
28 | "psr-4": {
29 | "Magento\\CloudDocker\\": "src/"
30 | }
31 | },
32 | "scripts": {
33 | "test": [
34 | "phpunit"
35 | ]
36 | },
37 | "config": {
38 | "sort-packages": true
39 | },
40 | "prefer-stable": true,
41 | "extra": {
42 | "map": [
43 | [
44 | "dist/docker-sync.yml",
45 | "docker-sync.yml"
46 | ],
47 | [
48 | "dist/mutagen.sh",
49 | "mutagen.sh"
50 | ],
51 | [
52 | "dist/mnt",
53 | ".docker/mnt"
54 | ],
55 | [
56 | "dist/tmp",
57 | ".docker/tmp"
58 | ],
59 | [
60 | "dist/mysql",
61 | ".docker/mysql"
62 | ],
63 | [
64 | "dist/bin/magento-docker",
65 | "bin/magento-docker"
66 | ]
67 | ],
68 | "chmod": [
69 | {
70 | "mask": "0755",
71 | "path": "bin/magento-docker"
72 | }
73 | ]
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/images/tls/pound.cfg:
--------------------------------------------------------------------------------
1 | ## Basic pound configuration for TLS termination.
2 | ##
3 | ## see pound(8) for details
4 |
5 |
6 | ######################################################################
7 | ## global options:
8 |
9 | User "www-data"
10 | Group "www-data"
11 | #RootJail "/chroot/pound"
12 |
13 | # Run in foreground otherwise docker container would exit immediately
14 | Daemon 0
15 |
16 | ## Logging: (goes to syslog by default)
17 | ## 0 no logging
18 | ## 1 normal
19 | ## 2 extended
20 | ## 3 Apache-style (common log format)
21 | LogLevel 2
22 | # Log to stdout/stderr
23 | LogFacility -
24 |
25 | ## check backend every X secs:
26 | Alive 30
27 |
28 | ## set timeout (defaults to 15 seconds):
29 | TimeOut ${TIMEOUT}
30 |
31 | ## use hardware-accelleration card supported by openssl(1):
32 | #SSLEngine ""
33 |
34 | # poundctl control socket
35 | Control "/var/run/pound/poundctl.socket"
36 |
37 |
38 | ######################################################################
39 | ## listen, redirect and ... to:
40 |
41 | ListenHTTPS
42 | Address 0.0.0.0
43 | Port 443
44 |
45 | ## allow PUT and DELETE also (by default only GET, POST and HEAD)?:
46 | xHTTP 1
47 |
48 | HeadRemove "X-Forwarded-Proto"
49 | AddHeader "X-Forwarded-Proto: https"
50 |
51 | ## Stop rewriting location header, breaks the CIDP redirect
52 | RewriteLocation ${REWRITE_LOCATION}
53 |
54 | # File that contains the server private key, the server
55 | # certificate and (optionally) ca-certificates. The order does
56 | # seem to be relevant!
57 | Cert "${CERT_PATH}"
58 |
59 | Service
60 | BackEnd
61 | # Numeric IP address, or a symbolic host name
62 | # that must be resolvable at run-time. If the
63 | # name cannot be resolved to a valid address,
64 | # Pound will assume that it represents the
65 | # path for a Unix-domain socket.
66 | # (In such cases the following error message
67 | # is displayed: "Port is supported only for
68 | # INET/INET6 back-ends".)
69 | Address ${HTTPS_UPSTREAM_SERVER_ADDRESS}
70 | Port ${HTTPS_UPSTREAM_SERVER_PORT}
71 | End
72 | End
73 | End
74 |
--------------------------------------------------------------------------------
/src/Test/Unit/Config/RelationshipTest.php:
--------------------------------------------------------------------------------
1 | configMock = $this->createMock(Config::class);
37 |
38 | $this->relationship = new Relationship($this->configMock);
39 | }
40 |
41 | /**
42 | * @throws ConfigurationMismatchException
43 | */
44 | public function testGet()
45 | {
46 | $this->configMock->expects($this->exactly(4))
47 | ->method('getServiceVersion')
48 | ->willReturnMap([
49 | ['mysql', '10'],
50 | ['redis', '8'],
51 | ['elasticsearch', null],
52 | ['rabbitmq', '10'],
53 | ]);
54 |
55 | $relationships = $this->relationship->get();
56 |
57 | $this->assertArrayHasKey('database', $relationships);
58 | $this->assertArrayHasKey('redis', $relationships);
59 | $this->assertArrayHasKey('rabbitmq', $relationships);
60 | }
61 |
62 | /**
63 | * @expectedExceptionMessage Configuration error
64 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
65 | */
66 | public function testGetWithException()
67 | {
68 | $this->configMock->expects($this->any())
69 | ->method('getServiceVersion')
70 | ->willThrowException(new ConfigurationMismatchException('Configuration error'));
71 |
72 | $this->relationship->get();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/Config/Relationship.php:
--------------------------------------------------------------------------------
1 | [
32 | [
33 | 'host' => 'db',
34 | 'path' => 'magento2',
35 | 'password' => 'magento2',
36 | 'username' => 'magento2',
37 | 'port' => '3306'
38 | ],
39 | ],
40 | 'redis' => [
41 | [
42 | 'host' => 'redis',
43 | 'port' => '6379'
44 | ]
45 | ],
46 | 'elasticsearch' => [
47 | [
48 | 'host' => 'elasticsearch',
49 | 'port' => '9200',
50 | ],
51 | ],
52 | 'rabbitmq' => [
53 | [
54 | 'host' => 'rabbitmq',
55 | 'port' => '5672',
56 | 'username' => 'guest',
57 | 'password' => 'guest',
58 | ]
59 | ],
60 | ];
61 |
62 | /**
63 | * @param Config $config
64 | */
65 | public function __construct(Config $config)
66 | {
67 | $this->config = $config;
68 | }
69 |
70 | /**
71 | * Generates relationship data for current configuration
72 | *
73 | * @throws ConfigurationMismatchException
74 | */
75 | public function get(): array
76 | {
77 | $relationships = [];
78 | foreach (self::$defaultConfiguration as $serviceName => $serviceConfig) {
79 | if ($this->config->getServiceVersion($this->convertServiceName($serviceName))) {
80 | $relationships[$serviceName] = $serviceConfig;
81 | }
82 | }
83 |
84 | return $relationships;
85 | }
86 |
87 | /**
88 | * Convert services names for compatibility with `getServiceVersion` method.
89 | *
90 | * @param string $serviceName
91 | * @return string
92 | */
93 | private function convertServiceName(string $serviceName): string
94 | {
95 | $map = [
96 | 'database' => ServiceInterface::NAME_DB
97 | ];
98 |
99 | return $map[$serviceName] ?? $serviceName;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/images/tls/certs/magento2.docker.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDljCCAn4CCQDnRn3DzcK9LDANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UEBhMC
3 | VVMxDjAMBgNVBAgMBVRleGFzMQ8wDQYDVQQHDAZBdXN0aW4xEDAOBgNVBAoMB01h
4 | Z2VudG8xDjAMBgNVBAsMBUNsb3VkMRgwFgYDVQQDDA9tYWdlbnRvMi5kb2NrZXIx
5 | IDAeBgkqhkiG9w0BCQEWEWNsb3VkQG1hZ2VudG8uY29tMB4XDTE5MDMyMTE2MDQz
6 | MloXDTIwMDMyMDE2MDQzMlowgYwxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhh
7 | czEPMA0GA1UEBwwGQXVzdGluMRAwDgYDVQQKDAdNYWdlbnRvMQ4wDAYDVQQLDAVD
8 | bG91ZDEYMBYGA1UEAwwPbWFnZW50bzIuZG9ja2VyMSAwHgYJKoZIhvcNAQkBFhFj
9 | bG91ZEBtYWdlbnRvLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
10 | AMtRwjGlgJTxDc9uWIopXDYaFJBzzZ7sc1sM5Bcd/T9ES3964KpHemY+5fYjXGk7
11 | tWrE1GKcpfC2NOQrCi4T4EcIE81U0NNr3OUy2l769J9CXo4RG5BBAsO4Tr5H+vZv
12 | Voh38WfCSamJ7Rdnvxmd2x3x5R4mTS3tJRCytxEJujUg376CT5LMoPgHEp9tH1Vx
13 | 1jf0pmYzbEz4JwOoQyvy0wBb/2f91Z0ak4gXFman06yW6fcJf5Hugv5mDnE4Bz+g
14 | xr0QP0csTQBw3EV6mC3wZP9YQf16r8dyo9wx+JCKWl1opvFJ4byDFW4L+JVwTBws
15 | nNjPCphdiaUWKHR9UfD5co0CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEACXRJPY97
16 | 93oNMYtKXnwa9r1+9eMvp2kITRiYI2kKejPQcvDAFN/V7NVkz8x6sZJgLpje6NTP
17 | n64cyTll1tbe2WYznoDn9VkRN7NNC9XgE5yH/ceOyrSVZBNv0strK1B375fWHjN6
18 | r5pvLg3yAgxU0xaWHqTMqwTYIFZLmBnBu3j7HfGtuI8Ic0gMJXWIY/S4eSE2Wzbu
19 | Icnf+ToRa4AKf+3otYqrrQ9zT6GZqrYDzQVmm173OLmvsQMqlo3+0G27Pxb6/KGW
20 | MEG3SslulnNqDwi7bgqa+ZZ/7L+T1ruh6gNUHXAUUAampUrsXJZenThAwhY7UiHk
21 | GjnO5Hagvij1hA==
22 | -----END CERTIFICATE-----
23 | -----BEGIN PRIVATE KEY-----
24 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDLUcIxpYCU8Q3P
25 | bliKKVw2GhSQc82e7HNbDOQXHf0/REt/euCqR3pmPuX2I1xpO7VqxNRinKXwtjTk
26 | KwouE+BHCBPNVNDTa9zlMtpe+vSfQl6OERuQQQLDuE6+R/r2b1aId/Fnwkmpie0X
27 | Z78Zndsd8eUeJk0t7SUQsrcRCbo1IN++gk+SzKD4BxKfbR9VcdY39KZmM2xM+CcD
28 | qEMr8tMAW/9n/dWdGpOIFxZmp9Oslun3CX+R7oL+Zg5xOAc/oMa9ED9HLE0AcNxF
29 | epgt8GT/WEH9eq/HcqPcMfiQilpdaKbxSeG8gxVuC/iVcEwcLJzYzwqYXYmlFih0
30 | fVHw+XKNAgMBAAECggEBAKfaaqEECoBr9cPPTIdbmAYOR/XttM7EVIPRw6iWGJIX
31 | tuCauEm70wAAY2duUAeMxLxNnS2AN7rfIhFQuwnJXPonX/m/UNuKjAYokoGhWzzz
32 | 1Q4ib4gLM9YTHecXk8fJqT3nD8RicN/nv3X4L5tdaB1zq3zVkBgfVN9RO7N0PWdH
33 | sNxlA9cE5UmfJoIFdL7EBoMGC+o6tJEB0DbS/Nu9FCuq7L1/GDSyM3cldc+3EegX
34 | RwiTW3+11xqct9grWmVy/lb2/DoIZQdg8JjuJDrhuDbx2g+bBOIFmxxhQpk4OkmD
35 | GloP5Hoc0GHtuFi2Pa/8gCODEqEFddQR6pMe3zUFr0ECgYEA5KsYFQ+jeFaH4Dr9
36 | 8uULMEz14mn8qXANnwHt7uhQE+Ab0n6VgCPUK8FFO5dqhVNjgDW4lbOU4G3S+0qc
37 | C+WBbctkAeacPwfu1dPjR9FoCktx6Im/VL5zw6n6M75n54RHLu37Foy+2DPmYz+1
38 | qknJmhBITlMJuIOZcF+PcQoaiTECgYEA458GPZQGdfv+thRqJSMi0MCaSDnJiNdo
39 | Jdyz3NYw1c4yI8cjRhLUnG6r5zqfUlr0kqtiLu4HYzUQCFqeEgzYV5ruw6m4Br30
40 | ivJGqMjMy6t7aW7c23ozO/9hYzdiuC916JSJWnn+W+v+1xZJJ1hGNtDlOT/Qkvv3
41 | n10v63j8aB0CgYBu3FgvlcZeCC2V02PdB5hWEWnAHDxHdTDVXx0Yj36LNEKo2X/n
42 | gPdTQz8qde1JuDTsKp9TzJ2n9Patp+1hgyIttcbFeSVVFaZ/+lsdLXPwUcVmxKmD
43 | D1aWjOjlfzFmt+W+5deuhgvcS8UtZuzPIzjfPXegqXd0AjE4nsuvNQPKcQKBgCyM
44 | ANKoV6Nbj/vefu+JstSb/RXJiXGoho9yZBkCKkiNtC5gWLzsDoQW/LmiNXAOsPLL
45 | a8m3d+aoidy4r1rk/KoYfkX4vzVCk8tlowKBWeM6SkrWEY86mTBSyKJ8Qmu9jhvY
46 | hhEY8vjWdOdvSx3SHtu3gkT0AkPh4BJmUGyLHwrZAoGBAJeYwOhNuxZe8Bh4Rm6N
47 | 6g3fOezBUqk3RE/XIQbdh1ONEQV2P3bGdsuCNgn/6qSP9jto4O7OV8UetJhc/Sou
48 | PmQFgN60IBztvSLWUk9JI2va0PSupbvnOOdxL3nsi5mwED6Ck8v91x83fS3LdVVR
49 | PHvwNIjbx7J6hjqswN8fF/7X
50 | -----END PRIVATE KEY-----
51 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Magento Cloud Docker
2 |
3 | [![Docker Build Status][ico-dockerbuild]][link-dockerhub]
4 | [![Docker Pulls][ico-downloads]][link-dockerhub]
5 | [![Docker Stars][ico-dockerstars]][link-dockerhub]
6 |
7 | ## Welcome
8 | Magento Cloud Docker is a package—part of the [Magento Cloud Suite](#magento-cloud-suite)—designed to develop, test, and deploy your Magento Commerce store. The Magento Cloud Docker implementation deploys Cloud projects to a local workstation so that you can develop and test your code in a simulated Cloud environment.
9 |
10 | ## Contributing to Magento Cloud Docker Code Base
11 | You can submit issues and pull requests to extend functionality or fix potential bugs. Improvements to Magento Cloud Docker can include work such as improving the developer experience or optimizing the deployment process. If you find a bug or have a suggestion, let us know by creating a Github issue.
12 |
13 | *Note:* This repository is not an official support channel. To get project-specific help, submit a [Magento Support ticket](https://support.magento.com). Any support-related issues opened in this repository will be closed with a request to open a support ticket.
14 |
15 | # Magento Cloud Suite
16 | The Magento Cloud Suite includes a set of packages designed to deploy and manage Magento Commerce installations on the Cloud platform.
17 | - The [ece-tools package](https://github.com/magento/ece-tools) - A set of scripts and tools designed to manage and deploy Cloud projects
18 | - [Magento Cloud Components](https://github.com/magento/magento-cloud-components) package - Extended Magento Commerce core functionality for sites deployed on the Cloud platform
19 | - [Magento Cloud Docker](https://github.com/magento/magento-cloud-docker) package - Functionality and Docker images to deploy Magento Commerce to a local Cloud environment
20 |
21 | ## Documentation
22 | - [Magento Cloud Docker DevDocs](https://devdocs.magento.com/guides/v2.3/cloud/docker/docker-config.html)
23 | - [Magento Cloud Guide DevDocs](https://devdocs.magento.com/guides/v2.3/cloud/bk-cloud.html)
24 | - [ECE-Tools Release Notes](https://github.com/magento/ece-tools/releases)
25 |
26 | ## Other Useful Resources
27 | - [Cloud Knowledge Base and Support](https://support.magento.com)
28 | - [Cloud Slack Channel](https://magentocommeng.slack.com) (join #cloud and #cloud-docker)
29 | - [Docker Hub](https://hub.docker.com/r/magento/)
30 |
31 | # Credits and License
32 | Inspired by [meanbee/docker-magento2](https://github.com/meanbee/docker-magento2)
33 |
34 | ## License
35 | Each Magento source file included in this distribution is licensed under OSL-3.0 license.
36 |
37 | Please see [LICENSE.txt](https://github.com/magento/ece-tools/blob/develop/LICENSE.txt) for the full text of the [Open Software License v. 3.0 (OSL-3.0)](http://opensource.org/licenses/osl-3.0.php).
38 |
39 | [ico-dockerbuild]: https://img.shields.io/docker/build/magento/magento-cloud-docker-php.svg?style=flat-square
40 | [ico-downloads]: https://img.shields.io/docker/pulls/magento/magento-cloud-docker-php.svg?style=flat-square
41 | [ico-dockerstars]: https://img.shields.io/docker/stars/magento/magento-cloud-docker-php.svg?style=flat-square
42 |
43 | [link-dockerhub]: https://hub.docker.com/r/magento/magento-cloud-docker-php
44 |
--------------------------------------------------------------------------------
/src/Config/Reader.php:
--------------------------------------------------------------------------------
1 | fileList = $fileList;
37 | $this->filesystem = $filesystem;
38 | }
39 |
40 | /**
41 | * @inheritdoc
42 | */
43 | public function read(): array
44 | {
45 | try {
46 | $appConfig = Yaml::parse(
47 | $this->filesystem->get($this->fileList->getAppConfig())
48 | );
49 | $servicesConfig = Yaml::parse(
50 | $this->filesystem->get($this->fileList->getServicesConfig())
51 | );
52 | } catch (\Exception $exception) {
53 | throw new FilesystemException($exception->getMessage(), $exception->getCode(), $exception);
54 | }
55 |
56 | if (!isset($appConfig['type'])) {
57 | throw new FilesystemException('PHP version could not be parsed.');
58 | }
59 |
60 | if (!isset($appConfig['relationships'])) {
61 | throw new FilesystemException('Relationships could not be parsed.');
62 | }
63 |
64 | $config = [
65 | 'type' => $appConfig['type'],
66 | 'crons' => $appConfig['crons'] ?? [],
67 | 'services' => [],
68 | 'runtime' => [
69 | 'extensions' => $appConfig['runtime']['extensions'] ?? [],
70 | 'disabled_extensions' => $appConfig['runtime']['disabled_extensions'] ?? []
71 | ]
72 | ];
73 |
74 | foreach ($appConfig['relationships'] as $constraint) {
75 | list($name) = explode(':', $constraint);
76 |
77 | if (!isset($servicesConfig[$name]['type'])) {
78 | throw new FilesystemException(sprintf(
79 | 'Service with name "%s" could not be parsed',
80 | $name
81 | ));
82 | }
83 |
84 | list($service, $version) = explode(':', $servicesConfig[$name]['type']);
85 |
86 | if (array_key_exists($service, $config['services'])) {
87 | throw new FilesystemException(sprintf(
88 | 'Only one instance of service "%s" supported',
89 | $service
90 | ));
91 | }
92 |
93 | $config['services'][$service] = [
94 | 'service' => $service,
95 | 'version' => $version
96 | ];
97 | }
98 |
99 | return $config;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/src/Config/Dist/Generator.php:
--------------------------------------------------------------------------------
1 | [
45 | 'http://magento2.docker/' => [
46 | 'type' => 'upstream',
47 | 'original_url' => 'http://{default}'
48 | ],
49 | 'https://magento2.docker/' => [
50 | 'type' => 'upstream',
51 | 'original_url' => 'https://{default}'
52 | ],
53 | ],
54 | 'MAGENTO_CLOUD_VARIABLES' => [
55 | 'ADMIN_EMAIL' => 'admin@example.com',
56 | 'ADMIN_PASSWORD' => '123123q',
57 | 'ADMIN_URL' => 'admin'
58 | ],
59 | ];
60 |
61 | /**
62 | * @param DirectoryList $directoryList
63 | * @param Filesystem $filesystem
64 | * @param Relationship $relationship
65 | * @param Formatter $phpFormatter
66 | */
67 | public function __construct(
68 | DirectoryList $directoryList,
69 | Filesystem $filesystem,
70 | Relationship $relationship,
71 | Formatter $phpFormatter
72 | ) {
73 | $this->directoryList = $directoryList;
74 | $this->filesystem = $filesystem;
75 | $this->phpFormatter = $phpFormatter;
76 | $this->relationship = $relationship;
77 | }
78 |
79 | /**
80 | * Create docker/config.php.dist file
81 | * generate MAGENTO_CLOUD_RELATIONSHIPS according to services enablements.
82 | *
83 | * @throws ConfigurationMismatchException if can't obtain relationships
84 | */
85 | public function generate()
86 | {
87 | $configPath = $this->directoryList->getDockerRoot() . '/config.php.dist';
88 |
89 | $config = array_merge(
90 | ['MAGENTO_CLOUD_RELATIONSHIPS' => $this->relationship->get()],
91 | self::$baseConfig
92 | );
93 |
94 | $this->saveConfig($configPath, $config);
95 | }
96 |
97 | /**
98 | * Formats and save configuration to file.
99 | *
100 | * @param string $filePath
101 | * @param array $config
102 | */
103 | private function saveConfig(string $filePath, array $config)
104 | {
105 | $result = " $value) {
107 | $result .= "\n '{$key}' => ";
108 | $result .= 'base64_encode(json_encode(' . $this->phpFormatter->varExport($value, 2) . ')),';
109 | }
110 | $result .= "\n];\n";
111 |
112 | $this->filesystem->put($filePath, $result);
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/images/php/7.0-fpm/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.0-fpm-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT 2G
4 | ENV MAGENTO_ROOT /app
5 | ENV DEBUG false
6 | ENV MAGENTO_RUN_MODE production
7 | ENV UPLOAD_MAX_FILESIZE 64M
8 | ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mcrypt mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
9 |
10 | # Install dependencies
11 | RUN apt-get update \
12 | && apt-get upgrade -y \
13 | && apt-get install -y --no-install-recommends \
14 | apt-utils \
15 | sendmail-bin \
16 | sendmail \
17 | sudo \
18 | libbz2-dev \
19 | libjpeg62-turbo-dev \
20 | libpng-dev \
21 | libfreetype6-dev \
22 | libgeoip-dev \
23 | wget \
24 | libgmp-dev \
25 | libmagickwand-dev \
26 | libmagickcore-dev \
27 | libc-client-dev \
28 | libkrb5-dev \
29 | libicu-dev \
30 | libldap2-dev \
31 | libmcrypt-dev \
32 | libpspell-dev \
33 | librecode0 \
34 | librecode-dev \
35 | libssh2-1 \
36 | libssh2-1-dev \
37 | libtidy-dev \
38 | libxslt1-dev \
39 | libyaml-dev \
40 | libzip-dev \
41 | zip \
42 | && rm -rf /var/lib/apt/lists/*
43 |
44 | # Configure the gd library
45 | RUN docker-php-ext-configure \
46 | gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
47 | RUN docker-php-ext-configure \
48 | imap --with-kerberos --with-imap-ssl
49 | RUN docker-php-ext-configure \
50 | ldap --with-libdir=lib/x86_64-linux-gnu
51 | RUN docker-php-ext-configure \
52 | opcache --enable-opcache
53 | RUN docker-php-ext-configure \
54 | zip --with-libzip
55 |
56 | # Install required PHP extensions
57 | RUN docker-php-ext-install -j$(nproc) \
58 | bcmath \
59 | bz2 \
60 | calendar \
61 | exif \
62 | gd \
63 | gettext \
64 | gmp \
65 | imap \
66 | intl \
67 | ldap \
68 | mcrypt \
69 | mysqli \
70 | opcache \
71 | pdo_mysql \
72 | pspell \
73 | recode \
74 | shmop \
75 | soap \
76 | sockets \
77 | sysvmsg \
78 | sysvsem \
79 | sysvshm \
80 | tidy \
81 | xmlrpc \
82 | xsl \
83 | zip \
84 | pcntl
85 |
86 | RUN pecl install -o -f \
87 | geoip-1.1.1 \
88 | igbinary \
89 | imagick \
90 | mailparse \
91 | msgpack \
92 | oauth \
93 | propro \
94 | raphf \
95 | redis \
96 | ssh2-1.1.2 \
97 | xdebug-2.6.1 \
98 | yaml
99 |
100 | RUN mkdir -p /tmp/libsodium \
101 | && curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
102 | && cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
103 | && ./configure \
104 | && make && make check \
105 | && make install \
106 | && cd / \
107 | && rm -rf /tmp/libsodium \
108 | && pecl install -o -f libsodium
109 |
110 | RUN docker-php-ext-enable \
111 | bcmath \
112 | bz2 \
113 | calendar \
114 | exif \
115 | gd \
116 | geoip \
117 | gettext \
118 | gmp \
119 | igbinary \
120 | imagick \
121 | imap \
122 | intl \
123 | ldap \
124 | mailparse \
125 | mcrypt \
126 | msgpack \
127 | mysqli \
128 | oauth \
129 | opcache \
130 | pdo_mysql \
131 | propro \
132 | pspell \
133 | raphf \
134 | recode \
135 | redis \
136 | shmop \
137 | soap \
138 | sockets \
139 | sodium \
140 | ssh2 \
141 | sysvmsg \
142 | sysvsem \
143 | sysvshm \
144 | tidy \
145 | xdebug \
146 | xmlrpc \
147 | xsl \
148 | yaml \
149 | zip \
150 | pcntl
151 |
152 | COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini
153 | COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
154 | COPY etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
155 | COPY etc/php-fpm.conf /usr/local/etc/
156 |
157 | COPY docker-entrypoint.sh /docker-entrypoint.sh
158 | RUN ["chmod", "+x", "/docker-entrypoint.sh"]
159 | ENTRYPOINT ["/docker-entrypoint.sh"]
160 |
161 | CMD ["php-fpm", "-R"]
162 |
--------------------------------------------------------------------------------
/images/php/7.1-fpm/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.1-fpm-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT 2G
4 | ENV MAGENTO_ROOT /app
5 | ENV DEBUG false
6 | ENV MAGENTO_RUN_MODE production
7 | ENV UPLOAD_MAX_FILESIZE 64M
8 | ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mcrypt mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
9 |
10 | # Install dependencies
11 | RUN apt-get update \
12 | && apt-get upgrade -y \
13 | && apt-get install -y --no-install-recommends \
14 | apt-utils \
15 | sendmail-bin \
16 | sendmail \
17 | sudo \
18 | libbz2-dev \
19 | libjpeg62-turbo-dev \
20 | libpng-dev \
21 | libfreetype6-dev \
22 | libgeoip-dev \
23 | wget \
24 | libgmp-dev \
25 | libmagickwand-dev \
26 | libmagickcore-dev \
27 | libc-client-dev \
28 | libkrb5-dev \
29 | libicu-dev \
30 | libldap2-dev \
31 | libmcrypt-dev \
32 | libpspell-dev \
33 | librecode0 \
34 | librecode-dev \
35 | libssh2-1 \
36 | libssh2-1-dev \
37 | libtidy-dev \
38 | libxslt1-dev \
39 | libyaml-dev \
40 | libzip-dev \
41 | zip \
42 | && rm -rf /var/lib/apt/lists/*
43 |
44 | # Configure the gd library
45 | RUN docker-php-ext-configure \
46 | gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
47 | RUN docker-php-ext-configure \
48 | imap --with-kerberos --with-imap-ssl
49 | RUN docker-php-ext-configure \
50 | ldap --with-libdir=lib/x86_64-linux-gnu
51 | RUN docker-php-ext-configure \
52 | opcache --enable-opcache
53 | RUN docker-php-ext-configure \
54 | zip --with-libzip
55 |
56 | # Install required PHP extensions
57 | RUN docker-php-ext-install -j$(nproc) \
58 | bcmath \
59 | bz2 \
60 | calendar \
61 | exif \
62 | gd \
63 | gettext \
64 | gmp \
65 | imap \
66 | intl \
67 | ldap \
68 | mcrypt \
69 | mysqli \
70 | opcache \
71 | pdo_mysql \
72 | pspell \
73 | recode \
74 | shmop \
75 | soap \
76 | sockets \
77 | sysvmsg \
78 | sysvsem \
79 | sysvshm \
80 | tidy \
81 | xmlrpc \
82 | xsl \
83 | zip \
84 | pcntl
85 |
86 | RUN pecl install -o -f \
87 | geoip-1.1.1 \
88 | igbinary \
89 | imagick \
90 | mailparse \
91 | msgpack \
92 | oauth \
93 | propro \
94 | raphf \
95 | redis \
96 | ssh2-1.1.2 \
97 | xdebug-2.6.1 \
98 | yaml
99 |
100 | RUN mkdir -p /tmp/libsodium \
101 | && curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
102 | && cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
103 | && ./configure \
104 | && make && make check \
105 | && make install \
106 | && cd / \
107 | && rm -rf /tmp/libsodium \
108 | && pecl install -o -f libsodium
109 |
110 | RUN docker-php-ext-enable \
111 | bcmath \
112 | bz2 \
113 | calendar \
114 | exif \
115 | gd \
116 | geoip \
117 | gettext \
118 | gmp \
119 | igbinary \
120 | imagick \
121 | imap \
122 | intl \
123 | ldap \
124 | mailparse \
125 | mcrypt \
126 | msgpack \
127 | mysqli \
128 | oauth \
129 | opcache \
130 | pdo_mysql \
131 | propro \
132 | pspell \
133 | raphf \
134 | recode \
135 | redis \
136 | shmop \
137 | soap \
138 | sockets \
139 | sodium \
140 | ssh2 \
141 | sysvmsg \
142 | sysvsem \
143 | sysvshm \
144 | tidy \
145 | xdebug \
146 | xmlrpc \
147 | xsl \
148 | yaml \
149 | zip \
150 | pcntl
151 |
152 | COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini
153 | COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
154 | COPY etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
155 | COPY etc/php-fpm.conf /usr/local/etc/
156 |
157 | COPY docker-entrypoint.sh /docker-entrypoint.sh
158 | RUN ["chmod", "+x", "/docker-entrypoint.sh"]
159 | ENTRYPOINT ["/docker-entrypoint.sh"]
160 |
161 | CMD ["php-fpm", "-R"]
162 |
--------------------------------------------------------------------------------
/images/php/7.3-fpm/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.3-fpm-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT 2G
4 | ENV MAGENTO_ROOT /app
5 | ENV DEBUG false
6 | ENV MAGENTO_RUN_MODE production
7 | ENV UPLOAD_MAX_FILESIZE 64M
8 | ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
9 |
10 | # Install dependencies
11 | RUN apt-get update \
12 | && apt-get upgrade -y \
13 | && apt-get install -y --no-install-recommends \
14 | apt-utils \
15 | sendmail-bin \
16 | sendmail \
17 | sudo \
18 | libbz2-dev \
19 | libjpeg62-turbo-dev \
20 | libpng-dev \
21 | libfreetype6-dev \
22 | libgeoip-dev \
23 | wget \
24 | libgmp-dev \
25 | libmagickwand-dev \
26 | libmagickcore-dev \
27 | libc-client-dev \
28 | libkrb5-dev \
29 | libicu-dev \
30 | libldap2-dev \
31 | libpspell-dev \
32 | librecode0 \
33 | librecode-dev \
34 | libtidy-dev \
35 | libxslt1-dev \
36 | libyaml-dev \
37 | libzip-dev \
38 | zip \
39 | && rm -rf /var/lib/apt/lists/*
40 |
41 | # Configure the gd library
42 | RUN docker-php-ext-configure \
43 | gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
44 | RUN docker-php-ext-configure \
45 | imap --with-kerberos --with-imap-ssl
46 | RUN docker-php-ext-configure \
47 | ldap --with-libdir=lib/x86_64-linux-gnu
48 | RUN docker-php-ext-configure \
49 | opcache --enable-opcache
50 | RUN docker-php-ext-configure \
51 | zip --with-libzip
52 |
53 | # Install required PHP extensions
54 | RUN docker-php-ext-install -j$(nproc) \
55 | bcmath \
56 | bz2 \
57 | calendar \
58 | exif \
59 | gd \
60 | gettext \
61 | gmp \
62 | imap \
63 | intl \
64 | ldap \
65 | mysqli \
66 | opcache \
67 | pdo_mysql \
68 | pspell \
69 | recode \
70 | shmop \
71 | soap \
72 | sockets \
73 | sysvmsg \
74 | sysvsem \
75 | sysvshm \
76 | tidy \
77 | xmlrpc \
78 | xsl \
79 | zip \
80 | pcntl
81 |
82 | RUN pecl install -o -f \
83 | geoip-1.1.1 \
84 | igbinary \
85 | imagick \
86 | mailparse \
87 | msgpack \
88 | oauth \
89 | propro \
90 | raphf \
91 | redis \
92 | xdebug-2.7.1 \
93 | yaml
94 |
95 | RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
96 | && rm -f /usr/local/lib/php/extensions/*/*sodium.so \
97 | && apt-get remove libsodium* -y \
98 | && mkdir -p /tmp/libsodium \
99 | && curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
100 | && cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
101 | && ./configure \
102 | && make && make check \
103 | && make install \
104 | && cd / \
105 | && rm -rf /tmp/libsodium \
106 | && pecl install -o -f libsodium
107 |
108 | RUN docker-php-ext-enable \
109 | bcmath \
110 | bz2 \
111 | calendar \
112 | exif \
113 | gd \
114 | geoip \
115 | gettext \
116 | gmp \
117 | igbinary \
118 | imagick \
119 | imap \
120 | intl \
121 | ldap \
122 | mailparse \
123 | msgpack \
124 | mysqli \
125 | oauth \
126 | opcache \
127 | pdo_mysql \
128 | propro \
129 | pspell \
130 | raphf \
131 | recode \
132 | redis \
133 | shmop \
134 | soap \
135 | sockets \
136 | sodium \
137 | sysvmsg \
138 | sysvsem \
139 | sysvshm \
140 | tidy \
141 | xdebug \
142 | xmlrpc \
143 | xsl \
144 | yaml \
145 | zip \
146 | pcntl
147 |
148 | COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini
149 | COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
150 | COPY etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
151 | COPY etc/php-fpm.conf /usr/local/etc/
152 |
153 | COPY docker-entrypoint.sh /docker-entrypoint.sh
154 | RUN ["chmod", "+x", "/docker-entrypoint.sh"]
155 | ENTRYPOINT ["/docker-entrypoint.sh"]
156 |
157 | CMD ["php-fpm", "-R"]
158 |
--------------------------------------------------------------------------------
/images/php/7.2-fpm/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.2-fpm-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT 2G
4 | ENV MAGENTO_ROOT /app
5 | ENV DEBUG false
6 | ENV MAGENTO_RUN_MODE production
7 | ENV UPLOAD_MAX_FILESIZE 64M
8 | ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
9 |
10 | # Install dependencies
11 | RUN apt-get update \
12 | && apt-get upgrade -y \
13 | && apt-get install -y --no-install-recommends \
14 | apt-utils \
15 | sendmail-bin \
16 | sendmail \
17 | sudo \
18 | libbz2-dev \
19 | libjpeg62-turbo-dev \
20 | libpng-dev \
21 | libfreetype6-dev \
22 | libgeoip-dev \
23 | wget \
24 | libgmp-dev \
25 | libmagickwand-dev \
26 | libmagickcore-dev \
27 | libc-client-dev \
28 | libkrb5-dev \
29 | libicu-dev \
30 | libldap2-dev \
31 | libpspell-dev \
32 | librecode0 \
33 | librecode-dev \
34 | libssh2-1 \
35 | libssh2-1-dev \
36 | libtidy-dev \
37 | libxslt1-dev \
38 | libyaml-dev \
39 | libzip-dev \
40 | zip \
41 | && rm -rf /var/lib/apt/lists/*
42 |
43 | # Configure the gd library
44 | RUN docker-php-ext-configure \
45 | gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
46 | RUN docker-php-ext-configure \
47 | imap --with-kerberos --with-imap-ssl
48 | RUN docker-php-ext-configure \
49 | ldap --with-libdir=lib/x86_64-linux-gnu
50 | RUN docker-php-ext-configure \
51 | opcache --enable-opcache
52 | RUN docker-php-ext-configure \
53 | zip --with-libzip
54 |
55 | # Install required PHP extensions
56 | RUN docker-php-ext-install -j$(nproc) \
57 | bcmath \
58 | bz2 \
59 | calendar \
60 | exif \
61 | gd \
62 | gettext \
63 | gmp \
64 | imap \
65 | intl \
66 | ldap \
67 | mysqli \
68 | opcache \
69 | pdo_mysql \
70 | pspell \
71 | recode \
72 | shmop \
73 | soap \
74 | sockets \
75 | sysvmsg \
76 | sysvsem \
77 | sysvshm \
78 | tidy \
79 | xmlrpc \
80 | xsl \
81 | zip \
82 | pcntl
83 |
84 | RUN pecl install -o -f \
85 | geoip-1.1.1 \
86 | igbinary \
87 | imagick \
88 | mailparse \
89 | msgpack \
90 | oauth \
91 | propro \
92 | raphf \
93 | redis \
94 | ssh2-1.1.2 \
95 | xdebug-2.6.1 \
96 | yaml
97 |
98 | RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
99 | && rm -f /usr/local/lib/php/extensions/*/*sodium.so \
100 | && apt-get remove libsodium* -y \
101 | && mkdir -p /tmp/libsodium \
102 | && curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
103 | && cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
104 | && ./configure \
105 | && make && make check \
106 | && make install \
107 | && cd / \
108 | && rm -rf /tmp/libsodium \
109 | && pecl install -o -f libsodium
110 |
111 | RUN docker-php-ext-enable \
112 | bcmath \
113 | bz2 \
114 | calendar \
115 | exif \
116 | gd \
117 | geoip \
118 | gettext \
119 | gmp \
120 | igbinary \
121 | imagick \
122 | imap \
123 | intl \
124 | ldap \
125 | mailparse \
126 | msgpack \
127 | mysqli \
128 | oauth \
129 | opcache \
130 | pdo_mysql \
131 | propro \
132 | pspell \
133 | raphf \
134 | recode \
135 | redis \
136 | shmop \
137 | soap \
138 | sockets \
139 | sodium \
140 | ssh2 \
141 | sysvmsg \
142 | sysvsem \
143 | sysvshm \
144 | tidy \
145 | xdebug \
146 | xmlrpc \
147 | xsl \
148 | yaml \
149 | zip \
150 | pcntl
151 |
152 | COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini
153 | COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
154 | COPY etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
155 | COPY etc/php-fpm.conf /usr/local/etc/
156 |
157 | COPY docker-entrypoint.sh /docker-entrypoint.sh
158 | RUN ["chmod", "+x", "/docker-entrypoint.sh"]
159 | ENTRYPOINT ["/docker-entrypoint.sh"]
160 |
161 | CMD ["php-fpm", "-R"]
162 |
--------------------------------------------------------------------------------
/src/Test/Unit/Config/Environment/ReaderTest.php:
--------------------------------------------------------------------------------
1 | directoryListMock = $this->createMock(DirectoryList::class);
43 | $this->filesystemMock = $this->createMock(Filesystem::class);
44 |
45 | $this->reader = new Reader($this->directoryListMock, $this->filesystemMock);
46 | }
47 |
48 | /**
49 | * @throws FilesystemException
50 | */
51 | public function testExecute()
52 | {
53 | $this->directoryListMock->method('getDockerRoot')
54 | ->willReturn('docker_root');
55 | $this->filesystemMock->expects($this->exactly(2))
56 | ->method('exists')
57 | ->with('docker_root/config.php')
58 | ->willReturn(true);
59 | $this->filesystemMock->expects($this->once())
60 | ->method('getRequire')
61 | ->willReturn([
62 | 'MAGENTO_CLOUD_VARIABLES' => base64_encode(json_encode(
63 | [
64 | 'ADMIN_EMAIL' => 'test2@email.com',
65 | 'ADMIN_USERNAME' => 'admin2',
66 | 'SCD_COMPRESSION_LEVEL' => '0',
67 | 'MIN_LOGGING_LEVEL' => 'debug',
68 | ]
69 | )),
70 | ]);
71 |
72 | $this->reader->read();
73 | }
74 |
75 | /**
76 | * @throws FilesystemException
77 | */
78 | public function testExecuteUsingDist()
79 | {
80 | $this->directoryListMock->method('getDockerRoot')
81 | ->willReturn('docker_root');
82 | $this->filesystemMock->expects($this->exactly(2))
83 | ->method('exists')
84 | ->willReturnMap([
85 | ['docker_root/config.php', false],
86 | ['docker_root/config.php.dist', true],
87 | ]);
88 | $this->filesystemMock->expects($this->once())
89 | ->method('getRequire')
90 | ->willReturn([
91 | 'MAGENTO_CLOUD_VARIABLES' => base64_encode(json_encode(
92 | [
93 | 'ADMIN_EMAIL' => 'test2@email.com',
94 | 'ADMIN_USERNAME' => 'admin2',
95 | 'SCD_COMPRESSION_LEVEL' => '0',
96 | 'MIN_LOGGING_LEVEL' => 'debug',
97 | ]
98 | )),
99 | ]);
100 |
101 | $this->reader->read();
102 | }
103 |
104 | /**
105 | * @expectedException \Magento\CloudDocker\Filesystem\FilesystemException
106 | * @expectedExceptionMessage Source file docker_root/config.php.dist does not exists
107 | * @throws FilesystemException
108 | */
109 | public function testExecuteNoSource()
110 | {
111 | $this->directoryListMock->method('getDockerRoot')
112 | ->willReturn('docker_root');
113 | $this->filesystemMock->expects($this->exactly(2))
114 | ->method('exists')
115 | ->willReturnMap([
116 | ['docker_root/config.php', false],
117 | ['docker_root/config.php.dist', false],
118 | ]);
119 |
120 | $this->reader->read();
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/src/Service/ServiceFactory.php:
--------------------------------------------------------------------------------
1 | [
30 | 'image' => 'magento/magento-cloud-docker-php:%s-cli'
31 | ],
32 | self::SERVICE_FPM => [
33 | 'image' => 'magento/magento-cloud-docker-php:%s-fpm'
34 | ],
35 | self::SERVICE_DB => [
36 | 'image' => 'mariadb:%s',
37 | 'config' => [
38 | 'volumes' => [
39 | '/var/lib/mysql',
40 | './.docker/mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d',
41 | ],
42 | 'environment' => [
43 | 'MYSQL_ROOT_PASSWORD=magento2',
44 | 'MYSQL_DATABASE=magento2',
45 | 'MYSQL_USER=magento2',
46 | 'MYSQL_PASSWORD=magento2',
47 | ]
48 | ]
49 | ],
50 | self::SERVICE_NGINX => [
51 | 'image' => 'magento/magento-cloud-docker-nginx:%s'
52 | ],
53 | self::SERVICE_VARNISH => [
54 | 'image' => 'magento/magento-cloud-docker-varnish:%s',
55 | 'config' => [
56 | 'environment' => [
57 | 'VIRTUAL_HOST=magento2.docker',
58 | 'VIRTUAL_PORT=80',
59 | 'HTTPS_METHOD=noredirect',
60 | ],
61 | 'ports' => [
62 | '80:80'
63 | ],
64 | ]
65 | ],
66 | self::SERVICE_TLS => [
67 | 'image' => 'magento/magento-cloud-docker-tls:%s',
68 | 'versions' => ['latest'],
69 | 'config' => [
70 | 'ports' => [
71 | '443:443'
72 | ],
73 | 'external_links' => [
74 | 'varnish:varnish'
75 | ]
76 | ]
77 | ],
78 | self::SERVICE_REDIS => [
79 | 'image' => 'redis:%s',
80 | 'config' => [
81 | 'volumes' => [
82 | '/data',
83 | ],
84 | 'ports' => [6379],
85 | ]
86 | ],
87 | self::SERVICE_ELASTICSEARCH => [
88 | 'image' => 'magento/magento-cloud-docker-elasticsearch:%s'
89 | ],
90 | self::SERVICE_RABBIT_MQ => [
91 | 'image' => 'rabbitmq:%s',
92 | ],
93 | self::SERVICE_NODE => [
94 | 'image' => 'node:%s',
95 | ],
96 | ];
97 |
98 | /**
99 | * @param string $name
100 | * @param string $version
101 | * @param array $extendedConfig
102 | * @return array
103 | * @throws ConfigurationMismatchException
104 | */
105 | public function create(string $name, string $version, array $extendedConfig = []): array
106 | {
107 | if (!array_key_exists($name, self::CONFIG)) {
108 | throw new ConfigurationMismatchException(sprintf(
109 | 'Service "%s" is not supported',
110 | $name
111 | ));
112 | }
113 |
114 | $metaConfig = self::CONFIG[$name];
115 | $defaultConfig = $metaConfig['config'] ?? [];
116 |
117 | return array_replace(
118 | ['image' => sprintf($metaConfig['image'], $version)],
119 | $defaultConfig,
120 | $extendedConfig
121 | );
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/src/Compose/FunctionalCompose.php:
--------------------------------------------------------------------------------
1 | 'production',
77 | 'PHP_MEMORY_LIMIT' => '2048M',
78 | 'DEBUG' => 'false',
79 | 'ENABLE_SENDMAIL' => 'false',
80 | 'UPLOAD_MAX_FILESIZE' => '64M',
81 | 'MAGENTO_ROOT' => self::DIR_MAGENTO,
82 | ];
83 | }
84 |
85 | /**
86 | * @inheritDoc
87 | */
88 | protected function getServiceVersion(string $serviceName)
89 | {
90 | $mapDefaultVersion = [
91 | ServiceInterface::NAME_DB => '10.2',
92 | ServiceInterface::NAME_PHP => '7.2',
93 | ServiceInterface::NAME_NGINX => self::DEFAULT_NGINX_VERSION,
94 | ServiceInterface::NAME_VARNISH => self::DEFAULT_VARNISH_VERSION,
95 | ServiceInterface::NAME_ELASTICSEARCH => null,
96 | ServiceInterface::NAME_NODE => null,
97 | ServiceInterface::NAME_RABBITMQ => null,
98 | ServiceInterface::NAME_REDIS => null,
99 | ];
100 |
101 | if (!array_key_exists($serviceName, $mapDefaultVersion)) {
102 | throw new ConfigurationMismatchException(sprintf('Type "%s" is not supported', $serviceName));
103 | }
104 |
105 | return $mapDefaultVersion[$serviceName];
106 | }
107 |
108 | /**
109 | * @inheritDoc
110 | */
111 | protected function getPhpVersion(): string
112 | {
113 | return $this->getServiceVersion(ServiceInterface::NAME_PHP);
114 | }
115 |
116 | /**
117 | * @inheritDoc
118 | */
119 | public function getPath(): string
120 | {
121 | return $this->fileList->getEceToolsCompose();
122 | }
123 |
124 | /**
125 | * @inheritDoc
126 | */
127 | protected function getPhpExtensions(string $phpVersion): array
128 | {
129 | return array_unique(array_merge(
130 | ExtensionResolver::DEFAULT_PHP_EXTENSIONS,
131 | ['xsl', 'redis'],
132 | in_array($phpVersion, ['7.0', '7.1']) ? ['mcrypt'] : []
133 | ));
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/images/php/7.3-cli/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.3-cli-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT=2G \
4 | MAGENTO_ROOT=/app \
5 | DEBUG=false \
6 | MAGENTO_RUN_MODE=production \
7 | COMPOSER_ALLOW_SUPERUSER=1
8 | ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
9 |
10 | # Configure Node.js version
11 | RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
12 |
13 | # Install dependencies
14 | RUN apt-get update \
15 | && apt-get upgrade -y \
16 | && apt-get install -y --no-install-recommends \
17 | apt-utils \
18 | cron \
19 | git \
20 | mariadb-client \
21 | nano \
22 | nodejs \
23 | python3 \
24 | python3-pip \
25 | redis-tools \
26 | rsyslog \
27 | sendmail \
28 | sendmail-bin \
29 | sudo \
30 | unzip \
31 | vim \
32 | libbz2-dev \
33 | libjpeg62-turbo-dev \
34 | libpng-dev \
35 | libfreetype6-dev \
36 | libgeoip-dev \
37 | wget \
38 | libgmp-dev \
39 | libmagickwand-dev \
40 | libmagickcore-dev \
41 | libc-client-dev \
42 | libkrb5-dev \
43 | libicu-dev \
44 | libldap2-dev \
45 | libpspell-dev \
46 | librecode0 \
47 | librecode-dev \
48 | libtidy-dev \
49 | libxslt1-dev \
50 | libyaml-dev \
51 | libzip-dev \
52 | zip \
53 | && rm -rf /var/lib/apt/lists/*
54 |
55 | # Install PyYAML
56 | RUN pip3 install --upgrade setuptools \
57 | && pip3 install pyyaml
58 |
59 | # Install Grunt
60 | RUN npm install -g grunt-cli
61 |
62 | # Configure the gd library
63 | RUN docker-php-ext-configure \
64 | gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
65 | RUN docker-php-ext-configure \
66 | imap --with-kerberos --with-imap-ssl
67 | RUN docker-php-ext-configure \
68 | ldap --with-libdir=lib/x86_64-linux-gnu
69 | RUN docker-php-ext-configure \
70 | opcache --enable-opcache
71 | RUN docker-php-ext-configure \
72 | zip --with-libzip
73 |
74 | # Install required PHP extensions
75 | RUN docker-php-ext-install -j$(nproc) \
76 | bcmath \
77 | bz2 \
78 | calendar \
79 | exif \
80 | gd \
81 | gettext \
82 | gmp \
83 | imap \
84 | intl \
85 | ldap \
86 | mysqli \
87 | opcache \
88 | pdo_mysql \
89 | pspell \
90 | recode \
91 | shmop \
92 | soap \
93 | sockets \
94 | sysvmsg \
95 | sysvsem \
96 | sysvshm \
97 | tidy \
98 | xmlrpc \
99 | xsl \
100 | zip \
101 | pcntl
102 |
103 | RUN pecl install -o -f \
104 | geoip-1.1.1 \
105 | igbinary \
106 | imagick \
107 | mailparse \
108 | msgpack \
109 | oauth \
110 | propro \
111 | raphf \
112 | redis \
113 | xdebug-2.7.1 \
114 | yaml
115 |
116 | RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
117 | && rm -f /usr/local/lib/php/extensions/*/*sodium.so \
118 | && apt-get remove libsodium* -y \
119 | && mkdir -p /tmp/libsodium \
120 | && curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
121 | && cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
122 | && ./configure \
123 | && make && make check \
124 | && make install \
125 | && cd / \
126 | && rm -rf /tmp/libsodium \
127 | && pecl install -o -f libsodium
128 |
129 | RUN docker-php-ext-enable \
130 | bcmath \
131 | bz2 \
132 | calendar \
133 | exif \
134 | gd \
135 | geoip \
136 | gettext \
137 | gmp \
138 | igbinary \
139 | imagick \
140 | imap \
141 | intl \
142 | ldap \
143 | mailparse \
144 | msgpack \
145 | mysqli \
146 | oauth \
147 | opcache \
148 | pdo_mysql \
149 | propro \
150 | pspell \
151 | raphf \
152 | recode \
153 | redis \
154 | shmop \
155 | soap \
156 | sockets \
157 | sodium \
158 | sysvmsg \
159 | sysvsem \
160 | sysvshm \
161 | tidy \
162 | xdebug \
163 | xmlrpc \
164 | xsl \
165 | yaml \
166 | zip \
167 | pcntl
168 |
169 | ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
170 | ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
171 | ADD etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
172 |
173 | VOLUME /root/.composer/cache
174 | # Get composer installed to /usr/local/bin/composer
175 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
176 |
177 | ADD bin/* /usr/local/bin/
178 | ADD docker-entrypoint.sh /docker-entrypoint.sh
179 |
180 | RUN ["chmod", "+x", \
181 | "/docker-entrypoint.sh", \
182 | "/usr/local/bin/magento-installer", \
183 | "/usr/local/bin/magento-command", \
184 | "/usr/local/bin/ece-command", \
185 | "/usr/local/bin/cloud-build", \
186 | "/usr/local/bin/cloud-deploy", \
187 | "/usr/local/bin/run-cron", \
188 | "/usr/local/bin/run-hooks" \
189 | ]
190 |
191 | ENTRYPOINT ["/docker-entrypoint.sh"]
192 |
193 | WORKDIR ${MAGENTO_ROOT}
194 |
195 | CMD ["bash"]
196 |
--------------------------------------------------------------------------------
/images/php/7.0-cli/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.0-cli-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT=2G \
4 | MAGENTO_ROOT=/app \
5 | DEBUG=false \
6 | MAGENTO_RUN_MODE=production \
7 | COMPOSER_ALLOW_SUPERUSER=1
8 | ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mcrypt mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
9 |
10 | # Configure Node.js version
11 | RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
12 |
13 | # Install dependencies
14 | RUN apt-get update \
15 | && apt-get upgrade -y \
16 | && apt-get install -y --no-install-recommends \
17 | apt-utils \
18 | cron \
19 | git \
20 | mariadb-client \
21 | nano \
22 | nodejs \
23 | python3 \
24 | python3-pip \
25 | redis-tools \
26 | rsyslog \
27 | sendmail \
28 | sendmail-bin \
29 | sudo \
30 | unzip \
31 | vim \
32 | libbz2-dev \
33 | libjpeg62-turbo-dev \
34 | libpng-dev \
35 | libfreetype6-dev \
36 | libgeoip-dev \
37 | wget \
38 | libgmp-dev \
39 | libmagickwand-dev \
40 | libmagickcore-dev \
41 | libc-client-dev \
42 | libkrb5-dev \
43 | libicu-dev \
44 | libldap2-dev \
45 | libmcrypt-dev \
46 | libpspell-dev \
47 | librecode0 \
48 | librecode-dev \
49 | libssh2-1 \
50 | libssh2-1-dev \
51 | libtidy-dev \
52 | libxslt1-dev \
53 | libyaml-dev \
54 | libzip-dev \
55 | zip \
56 | && rm -rf /var/lib/apt/lists/*
57 |
58 | # Install PyYAML
59 | RUN pip3 install --upgrade setuptools \
60 | && pip3 install pyyaml
61 |
62 | # Install Grunt
63 | RUN npm install -g grunt-cli
64 |
65 | # Configure the gd library
66 | RUN docker-php-ext-configure \
67 | gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
68 | RUN docker-php-ext-configure \
69 | imap --with-kerberos --with-imap-ssl
70 | RUN docker-php-ext-configure \
71 | ldap --with-libdir=lib/x86_64-linux-gnu
72 | RUN docker-php-ext-configure \
73 | opcache --enable-opcache
74 | RUN docker-php-ext-configure \
75 | zip --with-libzip
76 |
77 | # Install required PHP extensions
78 | RUN docker-php-ext-install -j$(nproc) \
79 | bcmath \
80 | bz2 \
81 | calendar \
82 | exif \
83 | gd \
84 | gettext \
85 | gmp \
86 | imap \
87 | intl \
88 | ldap \
89 | mcrypt \
90 | mysqli \
91 | opcache \
92 | pdo_mysql \
93 | pspell \
94 | recode \
95 | shmop \
96 | soap \
97 | sockets \
98 | sysvmsg \
99 | sysvsem \
100 | sysvshm \
101 | tidy \
102 | xmlrpc \
103 | xsl \
104 | zip \
105 | pcntl
106 |
107 | RUN pecl install -o -f \
108 | geoip-1.1.1 \
109 | igbinary \
110 | imagick \
111 | mailparse \
112 | msgpack \
113 | oauth \
114 | propro \
115 | raphf \
116 | redis \
117 | ssh2-1.1.2 \
118 | xdebug-2.6.1 \
119 | yaml
120 |
121 | RUN mkdir -p /tmp/libsodium \
122 | && curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
123 | && cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
124 | && ./configure \
125 | && make && make check \
126 | && make install \
127 | && cd / \
128 | && rm -rf /tmp/libsodium \
129 | && pecl install -o -f libsodium
130 |
131 | RUN docker-php-ext-enable \
132 | bcmath \
133 | bz2 \
134 | calendar \
135 | exif \
136 | gd \
137 | geoip \
138 | gettext \
139 | gmp \
140 | igbinary \
141 | imagick \
142 | imap \
143 | intl \
144 | ldap \
145 | mailparse \
146 | mcrypt \
147 | msgpack \
148 | mysqli \
149 | oauth \
150 | opcache \
151 | pdo_mysql \
152 | propro \
153 | pspell \
154 | raphf \
155 | recode \
156 | redis \
157 | shmop \
158 | soap \
159 | sockets \
160 | sodium \
161 | ssh2 \
162 | sysvmsg \
163 | sysvsem \
164 | sysvshm \
165 | tidy \
166 | xdebug \
167 | xmlrpc \
168 | xsl \
169 | yaml \
170 | zip \
171 | pcntl
172 |
173 | ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
174 | ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
175 | ADD etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
176 |
177 | VOLUME /root/.composer/cache
178 | # Get composer installed to /usr/local/bin/composer
179 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
180 |
181 | ADD bin/* /usr/local/bin/
182 | ADD docker-entrypoint.sh /docker-entrypoint.sh
183 |
184 | RUN ["chmod", "+x", \
185 | "/docker-entrypoint.sh", \
186 | "/usr/local/bin/magento-installer", \
187 | "/usr/local/bin/magento-command", \
188 | "/usr/local/bin/ece-command", \
189 | "/usr/local/bin/cloud-build", \
190 | "/usr/local/bin/cloud-deploy", \
191 | "/usr/local/bin/cloud-post-deploy", \
192 | "/usr/local/bin/run-cron", \
193 | "/usr/local/bin/run-hooks" \
194 | ]
195 |
196 | ENTRYPOINT ["/docker-entrypoint.sh"]
197 |
198 | WORKDIR ${MAGENTO_ROOT}
199 |
200 | CMD ["bash"]
201 |
--------------------------------------------------------------------------------
/images/php/7.1-cli/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.1-cli-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT=2G \
4 | MAGENTO_ROOT=/app \
5 | DEBUG=false \
6 | MAGENTO_RUN_MODE=production \
7 | COMPOSER_ALLOW_SUPERUSER=1
8 | ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mcrypt mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
9 |
10 | # Configure Node.js version
11 | RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
12 |
13 | # Install dependencies
14 | RUN apt-get update \
15 | && apt-get upgrade -y \
16 | && apt-get install -y --no-install-recommends \
17 | apt-utils \
18 | cron \
19 | git \
20 | mariadb-client \
21 | nano \
22 | nodejs \
23 | python3 \
24 | python3-pip \
25 | redis-tools \
26 | rsyslog \
27 | sendmail \
28 | sendmail-bin \
29 | sudo \
30 | unzip \
31 | vim \
32 | libbz2-dev \
33 | libjpeg62-turbo-dev \
34 | libpng-dev \
35 | libfreetype6-dev \
36 | libgeoip-dev \
37 | wget \
38 | libgmp-dev \
39 | libmagickwand-dev \
40 | libmagickcore-dev \
41 | libc-client-dev \
42 | libkrb5-dev \
43 | libicu-dev \
44 | libldap2-dev \
45 | libmcrypt-dev \
46 | libpspell-dev \
47 | librecode0 \
48 | librecode-dev \
49 | libssh2-1 \
50 | libssh2-1-dev \
51 | libtidy-dev \
52 | libxslt1-dev \
53 | libyaml-dev \
54 | libzip-dev \
55 | zip \
56 | && rm -rf /var/lib/apt/lists/*
57 |
58 | # Install PyYAML
59 | RUN pip3 install --upgrade setuptools \
60 | && pip3 install pyyaml
61 |
62 | # Install Grunt
63 | RUN npm install -g grunt-cli
64 |
65 | # Configure the gd library
66 | RUN docker-php-ext-configure \
67 | gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
68 | RUN docker-php-ext-configure \
69 | imap --with-kerberos --with-imap-ssl
70 | RUN docker-php-ext-configure \
71 | ldap --with-libdir=lib/x86_64-linux-gnu
72 | RUN docker-php-ext-configure \
73 | opcache --enable-opcache
74 | RUN docker-php-ext-configure \
75 | zip --with-libzip
76 |
77 | # Install required PHP extensions
78 | RUN docker-php-ext-install -j$(nproc) \
79 | bcmath \
80 | bz2 \
81 | calendar \
82 | exif \
83 | gd \
84 | gettext \
85 | gmp \
86 | imap \
87 | intl \
88 | ldap \
89 | mcrypt \
90 | mysqli \
91 | opcache \
92 | pdo_mysql \
93 | pspell \
94 | recode \
95 | shmop \
96 | soap \
97 | sockets \
98 | sysvmsg \
99 | sysvsem \
100 | sysvshm \
101 | tidy \
102 | xmlrpc \
103 | xsl \
104 | zip \
105 | pcntl
106 |
107 | RUN pecl install -o -f \
108 | geoip-1.1.1 \
109 | igbinary \
110 | imagick \
111 | mailparse \
112 | msgpack \
113 | oauth \
114 | propro \
115 | raphf \
116 | redis \
117 | ssh2-1.1.2 \
118 | xdebug-2.6.1 \
119 | yaml
120 |
121 | RUN mkdir -p /tmp/libsodium \
122 | && curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
123 | && cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
124 | && ./configure \
125 | && make && make check \
126 | && make install \
127 | && cd / \
128 | && rm -rf /tmp/libsodium \
129 | && pecl install -o -f libsodium
130 |
131 | RUN docker-php-ext-enable \
132 | bcmath \
133 | bz2 \
134 | calendar \
135 | exif \
136 | gd \
137 | geoip \
138 | gettext \
139 | gmp \
140 | igbinary \
141 | imagick \
142 | imap \
143 | intl \
144 | ldap \
145 | mailparse \
146 | mcrypt \
147 | msgpack \
148 | mysqli \
149 | oauth \
150 | opcache \
151 | pdo_mysql \
152 | propro \
153 | pspell \
154 | raphf \
155 | recode \
156 | redis \
157 | shmop \
158 | soap \
159 | sockets \
160 | sodium \
161 | ssh2 \
162 | sysvmsg \
163 | sysvsem \
164 | sysvshm \
165 | tidy \
166 | xdebug \
167 | xmlrpc \
168 | xsl \
169 | yaml \
170 | zip \
171 | pcntl
172 |
173 | ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
174 | ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
175 | ADD etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
176 |
177 | VOLUME /root/.composer/cache
178 | # Get composer installed to /usr/local/bin/composer
179 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
180 |
181 | ADD bin/* /usr/local/bin/
182 | ADD docker-entrypoint.sh /docker-entrypoint.sh
183 |
184 | RUN ["chmod", "+x", \
185 | "/docker-entrypoint.sh", \
186 | "/usr/local/bin/magento-installer", \
187 | "/usr/local/bin/magento-command", \
188 | "/usr/local/bin/ece-command", \
189 | "/usr/local/bin/cloud-build", \
190 | "/usr/local/bin/cloud-deploy", \
191 | "/usr/local/bin/cloud-post-deploy", \
192 | "/usr/local/bin/run-cron", \
193 | "/usr/local/bin/run-hooks" \
194 | ]
195 |
196 | ENTRYPOINT ["/docker-entrypoint.sh"]
197 |
198 | WORKDIR ${MAGENTO_ROOT}
199 |
200 | CMD ["bash"]
201 |
--------------------------------------------------------------------------------
/images/php/7.2-cli/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.2-cli-stretch
2 |
3 | ENV PHP_MEMORY_LIMIT=2G \
4 | MAGENTO_ROOT=/app \
5 | DEBUG=false \
6 | MAGENTO_RUN_MODE=production \
7 | COMPOSER_ALLOW_SUPERUSER=1
8 | ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
9 |
10 | # Configure Node.js version
11 | RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
12 |
13 | # Install dependencies
14 | RUN apt-get update \
15 | && apt-get upgrade -y \
16 | && apt-get install -y --no-install-recommends \
17 | apt-utils \
18 | cron \
19 | git \
20 | mariadb-client \
21 | nano \
22 | nodejs \
23 | python3 \
24 | python3-pip \
25 | redis-tools \
26 | rsyslog \
27 | sendmail \
28 | sendmail-bin \
29 | sudo \
30 | unzip \
31 | vim \
32 | libbz2-dev \
33 | libjpeg62-turbo-dev \
34 | libpng-dev \
35 | libfreetype6-dev \
36 | libgeoip-dev \
37 | wget \
38 | libgmp-dev \
39 | libmagickwand-dev \
40 | libmagickcore-dev \
41 | libc-client-dev \
42 | libkrb5-dev \
43 | libicu-dev \
44 | libldap2-dev \
45 | libpspell-dev \
46 | librecode0 \
47 | librecode-dev \
48 | libssh2-1 \
49 | libssh2-1-dev \
50 | libtidy-dev \
51 | libxslt1-dev \
52 | libyaml-dev \
53 | libzip-dev \
54 | zip \
55 | && rm -rf /var/lib/apt/lists/*
56 |
57 | # Install PyYAML
58 | RUN pip3 install --upgrade setuptools \
59 | && pip3 install pyyaml
60 |
61 | # Install Grunt
62 | RUN npm install -g grunt-cli
63 |
64 | # Configure the gd library
65 | RUN docker-php-ext-configure \
66 | gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
67 | RUN docker-php-ext-configure \
68 | imap --with-kerberos --with-imap-ssl
69 | RUN docker-php-ext-configure \
70 | ldap --with-libdir=lib/x86_64-linux-gnu
71 | RUN docker-php-ext-configure \
72 | opcache --enable-opcache
73 | RUN docker-php-ext-configure \
74 | zip --with-libzip
75 |
76 | # Install required PHP extensions
77 | RUN docker-php-ext-install -j$(nproc) \
78 | bcmath \
79 | bz2 \
80 | calendar \
81 | exif \
82 | gd \
83 | gettext \
84 | gmp \
85 | imap \
86 | intl \
87 | ldap \
88 | mysqli \
89 | opcache \
90 | pdo_mysql \
91 | pspell \
92 | recode \
93 | shmop \
94 | soap \
95 | sockets \
96 | sysvmsg \
97 | sysvsem \
98 | sysvshm \
99 | tidy \
100 | xmlrpc \
101 | xsl \
102 | zip \
103 | pcntl
104 |
105 | RUN pecl install -o -f \
106 | geoip-1.1.1 \
107 | igbinary \
108 | imagick \
109 | mailparse \
110 | msgpack \
111 | oauth \
112 | propro \
113 | raphf \
114 | redis \
115 | ssh2-1.1.2 \
116 | xdebug-2.6.1 \
117 | yaml
118 |
119 | RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
120 | && rm -f /usr/local/lib/php/extensions/*/*sodium.so \
121 | && apt-get remove libsodium* -y \
122 | && mkdir -p /tmp/libsodium \
123 | && curl -sL https://github.com/jedisct1/libsodium/archive/1.0.18-RELEASE.tar.gz | tar xzf - -C /tmp/libsodium \
124 | && cd /tmp/libsodium/libsodium-1.0.18-RELEASE/ \
125 | && ./configure \
126 | && make && make check \
127 | && make install \
128 | && cd / \
129 | && rm -rf /tmp/libsodium \
130 | && pecl install -o -f libsodium
131 |
132 | RUN docker-php-ext-enable \
133 | bcmath \
134 | bz2 \
135 | calendar \
136 | exif \
137 | gd \
138 | geoip \
139 | gettext \
140 | gmp \
141 | igbinary \
142 | imagick \
143 | imap \
144 | intl \
145 | ldap \
146 | mailparse \
147 | msgpack \
148 | mysqli \
149 | oauth \
150 | opcache \
151 | pdo_mysql \
152 | propro \
153 | pspell \
154 | raphf \
155 | recode \
156 | redis \
157 | shmop \
158 | soap \
159 | sockets \
160 | sodium \
161 | ssh2 \
162 | sysvmsg \
163 | sysvsem \
164 | sysvshm \
165 | tidy \
166 | xdebug \
167 | xmlrpc \
168 | xsl \
169 | yaml \
170 | zip \
171 | pcntl
172 |
173 | ADD etc/php-cli.ini /usr/local/etc/php/conf.d/zz-magento.ini
174 | ADD etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
175 | ADD etc/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
176 |
177 | VOLUME /root/.composer/cache
178 | # Get composer installed to /usr/local/bin/composer
179 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
180 |
181 | ADD bin/* /usr/local/bin/
182 | ADD docker-entrypoint.sh /docker-entrypoint.sh
183 |
184 | RUN ["chmod", "+x", \
185 | "/docker-entrypoint.sh", \
186 | "/usr/local/bin/magento-installer", \
187 | "/usr/local/bin/magento-command", \
188 | "/usr/local/bin/ece-command", \
189 | "/usr/local/bin/cloud-build", \
190 | "/usr/local/bin/cloud-deploy", \
191 | "/usr/local/bin/cloud-post-deploy", \
192 | "/usr/local/bin/run-cron", \
193 | "/usr/local/bin/run-hooks" \
194 | ]
195 |
196 | ENTRYPOINT ["/docker-entrypoint.sh"]
197 |
198 | WORKDIR ${MAGENTO_ROOT}
199 |
200 | CMD ["bash"]
201 |
--------------------------------------------------------------------------------
/src/Test/Unit/Config/Dist/GeneratorTest.php:
--------------------------------------------------------------------------------
1 | directoryListMock = $this->createMock(DirectoryList::class);
55 | $this->filesystemMock = $this->createMock(Filesystem::class);
56 | $this->relationshipMock = $this->createMock(Relationship::class);
57 | $this->formatterMock = $this->createMock(Formatter::class);
58 |
59 | $this->distGenerator = new Generator(
60 | $this->directoryListMock,
61 | $this->filesystemMock,
62 | $this->relationshipMock,
63 | $this->formatterMock
64 | );
65 | }
66 |
67 | /**
68 | * @throws ConfigurationMismatchException
69 | */
70 | public function testGenerate()
71 | {
72 | $rootDir = '/path/to/docker';
73 | $this->directoryListMock->expects($this->once())
74 | ->method('getDockerRoot')
75 | ->willReturn($rootDir);
76 | $this->relationshipMock->expects($this->once())
77 | ->method('get')
78 | ->willReturn([
79 | 'database' => ['config'],
80 | 'redis' => ['config'],
81 | ]);
82 | $this->formatterMock->expects($this->exactly(3))
83 | ->method('varExport')
84 | ->willReturnMap([
85 | [
86 | [
87 | 'database' => ['config'],
88 | 'redis' => ['config'],
89 | ],
90 | 2,
91 | 'exported_relationship_value',
92 | ],
93 | [
94 | [
95 | 'http://magento2.docker/' => [
96 | 'type' => 'upstream',
97 | 'original_url' => 'http://{default}'
98 | ],
99 | 'https://magento2.docker/' => [
100 | 'type' => 'upstream',
101 | 'original_url' => 'https://{default}'
102 | ],
103 | ],
104 | 2,
105 | 'exported_routes_value',
106 | ],
107 | [
108 | [
109 | 'ADMIN_EMAIL' => 'admin@example.com',
110 | 'ADMIN_PASSWORD' => '123123q',
111 | 'ADMIN_URL' => 'admin'
112 | ],
113 | 2,
114 | 'exported_variables_value'
115 | ]
116 | ]);
117 | $this->filesystemMock->expects($this->once())
118 | ->method('put')
119 | ->with($rootDir . '/config.php.dist', $this->getConfigForUpdate());
120 |
121 | $this->distGenerator->generate();
122 | }
123 |
124 | /**
125 | * @return string
126 | */
127 | private function getConfigForUpdate(): string
128 | {
129 | return << base64_encode(json_encode(exported_relationship_value)),
134 | 'MAGENTO_CLOUD_ROUTES' => base64_encode(json_encode(exported_routes_value)),
135 | 'MAGENTO_CLOUD_VARIABLES' => base64_encode(json_encode(exported_variables_value)),
136 | ];
137 |
138 | TEXT;
139 | }
140 |
141 | /**
142 | * @expectedExceptionMessage file system error
143 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
144 | *
145 | * @throws ConfigurationMismatchException
146 | */
147 | public function testGenerateFileSystemException()
148 | {
149 | $this->filesystemMock->expects($this->once())
150 | ->method('put')
151 | ->willThrowException(new ConfigurationMismatchException('file system error'));
152 |
153 | $this->distGenerator->generate();
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/images/nginx/1.9/etc/vhost.conf:
--------------------------------------------------------------------------------
1 | upstream fastcgi_backend {
2 | server !FPM_HOST!:!FPM_PORT!; # Variables: FPM_HOST and FPM_PORT
3 | }
4 |
5 | server {
6 | listen 80;
7 | listen 443 ssl;
8 |
9 | server_name localhost;
10 |
11 | set $MAGE_ROOT !MAGENTO_ROOT!; # Variable: MAGENTO_ROOT
12 | set $MAGE_MODE !MAGENTO_RUN_MODE!; # Variable: MAGENTO_RUN_MODE
13 |
14 | # Support for SSL termination.
15 | set $my_http "http";
16 | set $my_ssl "off";
17 | set $my_port "80";
18 | if ($http_x_forwarded_proto = "https") {
19 | set $my_http "https";
20 | set $my_ssl "on";
21 | set $my_port "443";
22 | }
23 |
24 | ssl_certificate /etc/nginx/ssl/magento.crt;
25 | ssl_certificate_key /etc/nginx/ssl/magento.key;
26 |
27 | root $MAGE_ROOT/pub;
28 |
29 | index index.php;
30 | autoindex off;
31 | charset UTF-8;
32 | client_max_body_size !UPLOAD_MAX_FILESIZE!; # Variable: UPLOAD_MAX_FILESIZE
33 | error_page 404 403 = /errors/404.php;
34 | #add_header "X-UA-Compatible" "IE=Edge";
35 |
36 | # Deny access to sensitive files
37 | location /.user.ini {
38 | deny all;
39 | }
40 |
41 | location / {
42 | try_files $uri $uri/ /index.php$is_args$args;
43 | }
44 |
45 | location /pub/ {
46 | location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
47 | deny all;
48 | }
49 | alias $MAGE_ROOT/pub/;
50 | add_header X-Frame-Options "SAMEORIGIN";
51 | }
52 |
53 | location /static/ {
54 | if ($MAGE_MODE = "production") {
55 | expires max;
56 | }
57 |
58 | # Remove signature of the static files that is used to overcome the browser cache
59 | location ~ ^/static/version {
60 | rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
61 | }
62 |
63 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
64 | add_header Cache-Control "public";
65 | add_header X-Frame-Options "SAMEORIGIN";
66 | expires +1y;
67 |
68 | if (!-f $request_filename) {
69 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
70 | }
71 | }
72 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
73 | add_header Cache-Control "no-store";
74 | add_header X-Frame-Options "SAMEORIGIN";
75 | expires off;
76 |
77 | if (!-f $request_filename) {
78 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
79 | }
80 | }
81 | if (!-f $request_filename) {
82 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
83 | }
84 | add_header X-Frame-Options "SAMEORIGIN";
85 | }
86 |
87 | location /media/ {
88 | try_files $uri $uri/ /get.php$is_args$args;
89 |
90 | location ~ ^/media/theme_customization/.*\.xml {
91 | deny all;
92 | }
93 |
94 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
95 | add_header Cache-Control "public";
96 | add_header X-Frame-Options "SAMEORIGIN";
97 | expires +1y;
98 | try_files $uri $uri/ /get.php$is_args$args;
99 | }
100 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
101 | add_header Cache-Control "no-store";
102 | add_header X-Frame-Options "SAMEORIGIN";
103 | expires off;
104 | try_files $uri $uri/ /get.php$is_args$args;
105 | }
106 | add_header X-Frame-Options "SAMEORIGIN";
107 | }
108 |
109 | location /media/customer/ {
110 | deny all;
111 | }
112 |
113 | location /media/downloadable/ {
114 | deny all;
115 | }
116 |
117 | location /media/import/ {
118 | deny all;
119 | }
120 |
121 | location /errors/ {
122 | location ~* \.xml$ {
123 | deny all;
124 | }
125 | }
126 |
127 | # PHP entry point for main application
128 | location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
129 | try_files $uri =404;
130 | fastcgi_pass fastcgi_backend;
131 | fastcgi_buffers 1024 4k;
132 |
133 | fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
134 | fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=18000";
135 | fastcgi_read_timeout 600s;
136 | fastcgi_connect_timeout 600s;
137 | fastcgi_param MAGE_MODE $MAGE_MODE;
138 |
139 | # Magento uses the HTTPS env var to detrimine if it is using SSL or not.
140 | fastcgi_param HTTPS $my_ssl;
141 |
142 | fastcgi_index index.php;
143 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
144 | include fastcgi_params;
145 | }
146 |
147 | gzip on;
148 | gzip_disable "msie6";
149 |
150 | gzip_comp_level 6;
151 | gzip_min_length 1100;
152 | gzip_buffers 16 8k;
153 | gzip_proxied any;
154 | gzip_types
155 | text/plain
156 | text/css
157 | text/js
158 | text/xml
159 | text/javascript
160 | application/javascript
161 | application/x-javascript
162 | application/json
163 | application/xml
164 | application/xml+rss
165 | image/svg+xml;
166 | gzip_vary on;
167 |
168 | # Banned locations (only reached if the earlier PHP entry point regexes don't match)
169 | location ~* (\.php$|\.htaccess$|\.git) {
170 | deny all;
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/src/Service/Config.php:
--------------------------------------------------------------------------------
1 | 'php',
27 | ServiceInterface::NAME_DB => 'mysql',
28 | ServiceInterface::NAME_NGINX => 'nginx',
29 | ServiceInterface::NAME_REDIS => 'redis',
30 | ServiceInterface::NAME_ELASTICSEARCH => 'elasticsearch',
31 | ServiceInterface::NAME_RABBITMQ => 'rabbitmq',
32 | ServiceInterface::NAME_NODE => 'node'
33 | ];
34 |
35 | /**
36 | * @var Reader
37 | */
38 | private $reader;
39 |
40 | /**
41 | * @param Reader $reader
42 | */
43 | public function __construct(Reader $reader)
44 | {
45 | $this->reader = $reader;
46 | }
47 |
48 | /**
49 | * Retrieves service versions set in configuration files.
50 | * Returns null if neither of services is configured or provided in $customVersions.
51 | *
52 | * Example of return:
53 | *
54 | * ```php
55 | * [
56 | * 'elasticsearch' => '5.6',
57 | * 'db' => '10.0'
58 | * ];
59 | * ```
60 | *
61 | * @param Repository $customVersions custom version which overwrite values from configuration files
62 | * @return array List of services
63 | * @throws ConfigurationMismatchException
64 | */
65 | public function getAllServiceVersions(Repository $customVersions): array
66 | {
67 | $configuredVersions = [];
68 |
69 | foreach (self::$configurableServices as $serviceName) {
70 | $version = $customVersions->get($serviceName) ?: $this->getServiceVersion($serviceName);
71 | if ($version) {
72 | $configuredVersions[$serviceName] = $version;
73 | }
74 | }
75 |
76 | return $configuredVersions;
77 | }
78 |
79 | /**
80 | * Retrieves service version set in configuration files.
81 | * Returns null if service was not configured.
82 | *
83 | * @param string $serviceName Name of service version need to retrieve
84 | * @return string|null
85 | * @throws ConfigurationMismatchException
86 | */
87 | public function getServiceVersion(string $serviceName)
88 | {
89 | try {
90 | $version = $serviceName === ServiceInterface::NAME_PHP
91 | ? $this->getPhpVersion()
92 | : $this->reader->read()['services'][$serviceName]['version'] ?? null;
93 |
94 | return $version;
95 | } catch (FilesystemException $exception) {
96 | throw new ConfigurationMismatchException($exception->getMessage(), $exception->getCode(), $exception);
97 | }
98 | }
99 |
100 | /**
101 | * Retrieve version of PHP
102 | *
103 | * @return string
104 | * @throws ConfigurationMismatchException when PHP is not configured
105 | */
106 | public function getPhpVersion(): string
107 | {
108 | try {
109 | $config = $this->reader->read();
110 | list($type, $version) = explode(':', $config['type']);
111 | } catch (FilesystemException $exception) {
112 | throw new ConfigurationMismatchException($exception->getMessage(), $exception->getCode(), $exception);
113 | }
114 |
115 | if ($type !== ServiceInterface::NAME_PHP) {
116 | throw new ConfigurationMismatchException(sprintf(
117 | 'Type "%s" is not supported',
118 | $type
119 | ));
120 | }
121 |
122 | /**
123 | * We don't support release candidates.
124 | */
125 | return rtrim($version, '-rc');
126 | }
127 |
128 | /**
129 | * Retrieves cron configuration.
130 | *
131 | * @return array
132 | * @throws ConfigurationMismatchException
133 | */
134 | public function getCron(): array
135 | {
136 | try {
137 | return $this->reader->read()['crons'] ?? [];
138 | } catch (FilesystemException $exception) {
139 | throw new ConfigurationMismatchException($exception->getMessage(), $exception->getCode(), $exception);
140 | }
141 | }
142 |
143 | /**
144 | * @return array
145 | * @throws ConfigurationMismatchException
146 | */
147 | public function getEnabledPhpExtensions(): array
148 | {
149 | try {
150 | return $this->reader->read()['runtime']['extensions'];
151 | } catch (FilesystemException $exception) {
152 | throw new ConfigurationMismatchException($exception->getMessage(), $exception->getCode(), $exception);
153 | }
154 | }
155 |
156 | /**
157 | * @return array
158 | * @throws ConfigurationMismatchException
159 | */
160 | public function getDisabledPhpExtensions(): array
161 | {
162 | try {
163 | return $this->reader->read()['runtime']['disabled_extensions'];
164 | } catch (FilesystemException $exception) {
165 | throw new ConfigurationMismatchException($exception->getMessage(), $exception->getCode(), $exception);
166 | }
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/images/varnish/4.0/etc/varnish.vcl:
--------------------------------------------------------------------------------
1 | vcl 4.0;
2 |
3 | import std;
4 |
5 | # The minimal Varnish version is 4.0
6 | # For SSL offloading, pass the following header in your proxy server or load balancer: 'SSL-OFFLOADED: https'
7 |
8 | backend default {
9 | .host = "web";
10 | .port = "80";
11 | }
12 |
13 | sub vcl_recv {
14 | # Ensure the true IP is sent onwards.
15 | # This was an issue getting xdebug working through varnish
16 | # whilst having a proxy infront of varnish (for local docker dev)
17 | if (req.http.X-Real-Ip) {
18 | set req.http.X-Forwarded-For = req.http.X-Real-Ip;
19 | }
20 |
21 | if (req.method == "PURGE") {
22 | if (!req.http.X-Magento-Tags-Pattern) {
23 | return (synth(400, "X-Magento-Tags-Pattern header required"));
24 | }
25 | ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
26 | return (synth(200, "Purged"));
27 | }
28 |
29 | if (req.method != "GET" &&
30 | req.method != "HEAD" &&
31 | req.method != "PUT" &&
32 | req.method != "POST" &&
33 | req.method != "TRACE" &&
34 | req.method != "OPTIONS" &&
35 | req.method != "DELETE") {
36 | /* Non-RFC2616 or CONNECT which is weird. */
37 | return (pipe);
38 | }
39 |
40 | # We only deal with GET and HEAD by default
41 | if (req.method != "GET" && req.method != "HEAD") {
42 | return (pass);
43 | }
44 |
45 | # Bypass shopping cart, checkout and search requests
46 | if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") {
47 | return (pass);
48 | }
49 |
50 | # normalize url in case of leading HTTP scheme and domain
51 | set req.url = regsub(req.url, "^http[s]?://", "");
52 |
53 | # collect all cookies
54 | std.collect(req.http.Cookie);
55 |
56 | # Compression filter. See https://www.varnish-cache.org/trac/wiki/FAQ/Compression
57 | if (req.http.Accept-Encoding) {
58 | if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
59 | # No point in compressing these
60 | unset req.http.Accept-Encoding;
61 | } elsif (req.http.Accept-Encoding ~ "gzip") {
62 | set req.http.Accept-Encoding = "gzip";
63 | } elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
64 | set req.http.Accept-Encoding = "deflate";
65 | } else {
66 | # unkown algorithm
67 | unset req.http.Accept-Encoding;
68 | }
69 | }
70 |
71 | # Remove Google gclid parameters to minimize the cache objects
72 | set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
73 | set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
74 | set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
75 |
76 | # static files are always cacheable. remove SSL flag and cookie
77 | if (req.url ~ "^/(pub/)?(media|static)/.*\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)$") {
78 | unset req.http.Https;
79 | unset req.http.SSL-OFFLOADED;
80 | unset req.http.Cookie;
81 | }
82 |
83 | return (hash);
84 | }
85 |
86 | sub vcl_hash {
87 | if (req.http.cookie ~ "X-Magento-Vary=") {
88 | hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
89 | }
90 |
91 | # For multi site configurations to not cache each other's content
92 | if (req.http.host) {
93 | hash_data(req.http.host);
94 | } else {
95 | hash_data(server.ip);
96 | }
97 |
98 | # To make sure http users don't see ssl warning
99 | if (req.http.SSL-OFFLOADED) {
100 | hash_data(req.http.SSL-OFFLOADED);
101 | }
102 |
103 | # Cache https seperately
104 | if (req.http.X-Forwarded-Proto) {
105 | hash_data(req.http.X-Forwarded-Proto);
106 | }
107 | }
108 |
109 | sub vcl_backend_response {
110 | if (beresp.http.content-type ~ "text") {
111 | set beresp.do_esi = true;
112 | }
113 |
114 | if (bereq.url ~ "\.js$" || beresp.http.content-type ~ "text") {
115 | set beresp.do_gzip = true;
116 | }
117 |
118 | # cache only successfully responses and 404s
119 | if (beresp.status != 200 && beresp.status != 404) {
120 | set beresp.ttl = 0s;
121 | set beresp.uncacheable = true;
122 | return (deliver);
123 | } elsif (beresp.http.Cache-Control ~ "private") {
124 | set beresp.uncacheable = true;
125 | set beresp.ttl = 86400s;
126 | return (deliver);
127 | }
128 |
129 | if (beresp.http.X-Magento-Debug) {
130 | set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control;
131 | }
132 |
133 | # validate if we need to cache it and prevent from setting cookie
134 | # images, css and js are cacheable by default so we have to remove cookie also
135 | if (beresp.ttl > 0s && (bereq.method == "GET" || bereq.method == "HEAD")) {
136 | unset beresp.http.set-cookie;
137 | if (bereq.url !~ "\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|gz|tgz|bz2|tbz|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)(\?|$)") {
138 | set beresp.http.Pragma = "no-cache";
139 | set beresp.http.Expires = "-1";
140 | set beresp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
141 | set beresp.grace = 1m;
142 | }
143 | }
144 |
145 | # If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass
146 | if (beresp.ttl <= 0s ||
147 | beresp.http.Surrogate-control ~ "no-store" ||
148 | (!beresp.http.Surrogate-Control && beresp.http.Vary == "*")) {
149 | # Mark as Hit-For-Pass for the next 2 minutes
150 | set beresp.ttl = 120s;
151 | set beresp.uncacheable = true;
152 | }
153 | return (deliver);
154 | }
155 |
156 | sub vcl_deliver {
157 | if (resp.http.x-varnish ~ " ") {
158 | set resp.http.X-Magento-Cache-Debug = "HIT";
159 | } else {
160 | set resp.http.X-Magento-Cache-Debug = "MISS";
161 | }
162 |
163 | unset resp.http.X-Magento-Debug;
164 | unset resp.http.X-Magento-Tags;
165 | unset resp.http.X-Powered-By;
166 | unset resp.http.Server;
167 | unset resp.http.X-Varnish;
168 | unset resp.http.Via;
169 | unset resp.http.Link;
170 | }
171 |
--------------------------------------------------------------------------------
/images/varnish/6.2/etc/default.vcl:
--------------------------------------------------------------------------------
1 | vcl 4.0;
2 |
3 | import std;
4 |
5 | # The minimal Varnish version is 4.0
6 | # For SSL offloading, pass the following header in your proxy server or load balancer: 'SSL-OFFLOADED: https'
7 |
8 | backend default {
9 | .host = "web";
10 | .port = "80";
11 | }
12 |
13 | sub vcl_recv {
14 | # Ensure the true IP is sent onwards.
15 | # This was an issue getting xdebug working through varnish
16 | # whilst having a proxy infront of varnish (for local docker dev)
17 | if (req.http.X-Real-Ip) {
18 | set req.http.X-Forwarded-For = req.http.X-Real-Ip;
19 | }
20 |
21 | if (req.method == "PURGE") {
22 | if (!req.http.X-Magento-Tags-Pattern) {
23 | return (synth(400, "X-Magento-Tags-Pattern header required"));
24 | }
25 | ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
26 | return (synth(200, "Purged"));
27 | }
28 |
29 | if (req.method != "GET" &&
30 | req.method != "HEAD" &&
31 | req.method != "PUT" &&
32 | req.method != "POST" &&
33 | req.method != "TRACE" &&
34 | req.method != "OPTIONS" &&
35 | req.method != "DELETE") {
36 | /* Non-RFC2616 or CONNECT which is weird. */
37 | return (pipe);
38 | }
39 |
40 | # We only deal with GET and HEAD by default
41 | if (req.method != "GET" && req.method != "HEAD") {
42 | return (pass);
43 | }
44 |
45 | # Bypass shopping cart, checkout and search requests
46 | if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") {
47 | return (pass);
48 | }
49 |
50 | # normalize url in case of leading HTTP scheme and domain
51 | set req.url = regsub(req.url, "^http[s]?://", "");
52 |
53 | # collect all cookies
54 | std.collect(req.http.Cookie);
55 |
56 | # Compression filter. See https://www.varnish-cache.org/trac/wiki/FAQ/Compression
57 | if (req.http.Accept-Encoding) {
58 | if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
59 | # No point in compressing these
60 | unset req.http.Accept-Encoding;
61 | } elsif (req.http.Accept-Encoding ~ "gzip") {
62 | set req.http.Accept-Encoding = "gzip";
63 | } elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
64 | set req.http.Accept-Encoding = "deflate";
65 | } else {
66 | # unkown algorithm
67 | unset req.http.Accept-Encoding;
68 | }
69 | }
70 |
71 | # Remove Google gclid parameters to minimize the cache objects
72 | set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
73 | set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
74 | set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
75 |
76 | # static files are always cacheable. remove SSL flag and cookie
77 | if (req.url ~ "^/(pub/)?(media|static)/.*\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)$") {
78 | unset req.http.Https;
79 | unset req.http.SSL-OFFLOADED;
80 | unset req.http.Cookie;
81 | }
82 |
83 | return (hash);
84 | }
85 |
86 | sub vcl_hash {
87 | if (req.http.cookie ~ "X-Magento-Vary=") {
88 | hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
89 | }
90 |
91 | # For multi site configurations to not cache each other's content
92 | if (req.http.host) {
93 | hash_data(req.http.host);
94 | } else {
95 | hash_data(server.ip);
96 | }
97 |
98 | # To make sure http users don't see ssl warning
99 | if (req.http.SSL-OFFLOADED) {
100 | hash_data(req.http.SSL-OFFLOADED);
101 | }
102 |
103 | # Cache https seperately
104 | if (req.http.X-Forwarded-Proto) {
105 | hash_data(req.http.X-Forwarded-Proto);
106 | }
107 | }
108 |
109 | sub vcl_backend_response {
110 | if (beresp.http.content-type ~ "text") {
111 | set beresp.do_esi = true;
112 | }
113 |
114 | if (bereq.url ~ "\.js$" || beresp.http.content-type ~ "text") {
115 | set beresp.do_gzip = true;
116 | }
117 |
118 | # cache only successfully responses and 404s
119 | if (beresp.status != 200 && beresp.status != 404) {
120 | set beresp.ttl = 0s;
121 | set beresp.uncacheable = true;
122 | return (deliver);
123 | } elsif (beresp.http.Cache-Control ~ "private") {
124 | set beresp.uncacheable = true;
125 | set beresp.ttl = 86400s;
126 | return (deliver);
127 | }
128 |
129 | if (beresp.http.X-Magento-Debug) {
130 | set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control;
131 | }
132 |
133 | # validate if we need to cache it and prevent from setting cookie
134 | # images, css and js are cacheable by default so we have to remove cookie also
135 | if (beresp.ttl > 0s && (bereq.method == "GET" || bereq.method == "HEAD")) {
136 | unset beresp.http.set-cookie;
137 | if (bereq.url !~ "\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|gz|tgz|bz2|tbz|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)(\?|$)") {
138 | set beresp.http.Pragma = "no-cache";
139 | set beresp.http.Expires = "-1";
140 | set beresp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
141 | set beresp.grace = 1m;
142 | }
143 | }
144 |
145 | # If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass
146 | if (beresp.ttl <= 0s ||
147 | beresp.http.Surrogate-control ~ "no-store" ||
148 | (!beresp.http.Surrogate-Control && beresp.http.Vary == "*")) {
149 | # Mark as Hit-For-Pass for the next 2 minutes
150 | set beresp.ttl = 120s;
151 | set beresp.uncacheable = true;
152 | }
153 | return (deliver);
154 | }
155 |
156 | sub vcl_deliver {
157 | if (resp.http.x-varnish ~ " ") {
158 | set resp.http.X-Magento-Cache-Debug = "HIT";
159 | } else {
160 | set resp.http.X-Magento-Cache-Debug = "MISS";
161 | }
162 |
163 | unset resp.http.X-Magento-Debug;
164 | unset resp.http.X-Magento-Tags;
165 | unset resp.http.X-Powered-By;
166 | unset resp.http.Server;
167 | unset resp.http.X-Varnish;
168 | unset resp.http.Via;
169 | unset resp.http.Link;
170 | }
171 |
--------------------------------------------------------------------------------
/src/Command/BuildCompose.php:
--------------------------------------------------------------------------------
1 | ServiceInterface::NAME_PHP,
49 | self::OPTION_DB => ServiceInterface::NAME_DB,
50 | self::OPTION_NGINX => ServiceInterface::NAME_NGINX,
51 | self::OPTION_REDIS => ServiceInterface::NAME_REDIS,
52 | self::OPTION_ES => ServiceInterface::NAME_ELASTICSEARCH,
53 | self::OPTION_NODE => ServiceInterface::NAME_NODE,
54 | self::OPTION_RABBIT_MQ => ServiceInterface::NAME_RABBITMQ,
55 | ];
56 |
57 | /**
58 | * @var ComposeFactory
59 | */
60 | private $composeFactory;
61 |
62 | /**
63 | * @var Generator
64 | */
65 | private $distGenerator;
66 |
67 | /**
68 | * @var ConfigFactory
69 | */
70 | private $configFactory;
71 |
72 | /**
73 | * @var Filesystem
74 | */
75 | private $filesystem;
76 |
77 | /**
78 | * @param ComposeFactory $composeFactory
79 | * @param Generator $distGenerator
80 | * @param ConfigFactory $configFactory
81 | * @param Filesystem $filesystem
82 | */
83 | public function __construct(
84 | ComposeFactory $composeFactory,
85 | Generator $distGenerator,
86 | ConfigFactory $configFactory,
87 | Filesystem $filesystem
88 | ) {
89 | $this->composeFactory = $composeFactory;
90 | $this->distGenerator = $distGenerator;
91 | $this->configFactory = $configFactory;
92 | $this->filesystem = $filesystem;
93 |
94 | parent::__construct();
95 | }
96 |
97 | /**
98 | * @inheritdoc
99 | */
100 | protected function configure()
101 | {
102 | $this->setName(self::NAME)
103 | ->setDescription('Build docker configuration')
104 | ->addOption(
105 | self::OPTION_PHP,
106 | null,
107 | InputOption::VALUE_REQUIRED,
108 | 'PHP version'
109 | )->addOption(
110 | self::OPTION_NGINX,
111 | null,
112 | InputOption::VALUE_REQUIRED,
113 | 'Nginx version'
114 | )->addOption(
115 | self::OPTION_DB,
116 | null,
117 | InputOption::VALUE_REQUIRED,
118 | 'DB version'
119 | )->addOption(
120 | self::OPTION_REDIS,
121 | null,
122 | InputOption::VALUE_REQUIRED,
123 | 'Redis version'
124 | )->addOption(
125 | self::OPTION_ES,
126 | null,
127 | InputOption::VALUE_REQUIRED,
128 | 'Elasticsearch version'
129 | )->addOption(
130 | self::OPTION_RABBIT_MQ,
131 | null,
132 | InputOption::VALUE_REQUIRED,
133 | 'RabbitMQ version'
134 | )->addOption(
135 | self::OPTION_NODE,
136 | null,
137 | InputOption::VALUE_REQUIRED,
138 | 'Node.js version'
139 | )->addOption(
140 | self::OPTION_MODE,
141 | 'm',
142 | InputOption::VALUE_REQUIRED,
143 | sprintf(
144 | 'Mode of environment (%s)',
145 | implode(
146 | ', ',
147 | [
148 | ComposeFactory::COMPOSE_DEVELOPER,
149 | ComposeFactory::COMPOSE_PRODUCTION,
150 | ComposeFactory::COMPOSE_FUNCTIONAL,
151 | ]
152 | )
153 | ),
154 | ComposeFactory::COMPOSE_PRODUCTION
155 | )->addOption(
156 | self::OPTION_SYNC_ENGINE,
157 | null,
158 | InputOption::VALUE_REQUIRED,
159 | sprintf(
160 | 'File sync engine. Works only with developer mode. Available: (%s)',
161 | implode(', ', DeveloperCompose::SYNC_ENGINES_LIST)
162 | ),
163 | DeveloperCompose::SYNC_ENGINE_DOCKER_SYNC
164 | );
165 |
166 | parent::configure();
167 | }
168 |
169 | /**
170 | * {@inheritDoc}
171 | *
172 | * @throws GenericException
173 | */
174 | public function execute(InputInterface $input, OutputInterface $output)
175 | {
176 | $type = $input->getOption(self::OPTION_MODE);
177 | $syncEngine = $input->getOption(self::OPTION_SYNC_ENGINE);
178 |
179 | $compose = $this->composeFactory->create($type);
180 | $config = $this->configFactory->create();
181 |
182 | if (ComposeFactory::COMPOSE_DEVELOPER === $type
183 | && !in_array($syncEngine, DeveloperCompose::SYNC_ENGINES_LIST, true)
184 | ) {
185 | throw new GenericException(sprintf(
186 | "File sync engine '%s' is not supported. Available: %s",
187 | $syncEngine,
188 | implode(', ', DeveloperCompose::SYNC_ENGINES_LIST)
189 | ));
190 | }
191 |
192 | array_walk(self::$optionsMap, static function ($key, $option) use ($config, $input) {
193 | if ($value = $input->getOption($option)) {
194 | $config->set($key, $value);
195 | }
196 | });
197 |
198 | $config->set(DeveloperCompose::SYNC_ENGINE, $syncEngine);
199 |
200 | if (in_array(
201 | $input->getOption(self::OPTION_MODE),
202 | [ComposeFactory::COMPOSE_DEVELOPER, ComposeFactory::COMPOSE_PRODUCTION],
203 | false
204 | )) {
205 | $this->distGenerator->generate();
206 | }
207 |
208 | $this->filesystem->put(
209 | $compose->getPath(),
210 | Yaml::dump($compose->build($config), 4, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)
211 | );
212 |
213 | $output->writeln('Configuration was built.');
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/src/Test/Unit/Service/ConfigTest.php:
--------------------------------------------------------------------------------
1 | readerMock = $this->createMock(Reader::class);
40 |
41 | $this->version = new Config($this->readerMock);
42 | }
43 |
44 | /**
45 | * @throws ConfigurationMismatchException
46 | */
47 | public function testGetAllServiceVersions()
48 | {
49 | $customVersions = [
50 | ServiceInterface::NAME_DB => 'db.version1',
51 | ServiceInterface::NAME_ELASTICSEARCH => 'es.version1',
52 | ];
53 | $configVersions = [
54 | 'services' => [
55 | ServiceInterface::NAME_ELASTICSEARCH => ['version' => 'es.version2'],
56 | ServiceInterface::NAME_RABBITMQ => ['version' => 'rabbitmq.version2'],
57 | ],
58 | 'type' => 'php:7.0',
59 | ];
60 | $result = [
61 | ServiceInterface::NAME_DB => 'db.version1',
62 | ServiceInterface::NAME_ELASTICSEARCH => 'es.version1',
63 | ServiceInterface::NAME_RABBITMQ => 'rabbitmq.version2',
64 | ServiceInterface::NAME_PHP => '7.0'
65 |
66 | ];
67 | $customConfigs = new Repository($customVersions);
68 |
69 | $this->readerMock->expects($this->any())
70 | ->method('read')
71 | ->willReturn($configVersions);
72 |
73 | $this->assertEquals($result, $this->version->getAllServiceVersions($customConfigs));
74 | }
75 |
76 | /**
77 | * @param array $config
78 | * @param string $serviceName
79 | * @param string|null $result
80 | * @throws ConfigurationMismatchException
81 | *
82 | * @dataProvider getServiceVersionFromConfigDataProvider
83 | */
84 | public function testGetServiceVersionFromConfig(array $config, string $serviceName, $result)
85 | {
86 | $this->readerMock->expects($this->once())
87 | ->method('read')
88 | ->willReturn($config);
89 | $this->assertEquals($result, $this->version->getServiceVersion($serviceName));
90 | }
91 |
92 | /**
93 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
94 | * @expectedExceptionMessage Type "notphp" is not supported
95 | */
96 | public function testGetServiceVersionFromConfigException()
97 | {
98 | $this->readerMock->expects($this->once())
99 | ->method('read')
100 | ->willReturn(['type' => 'notphp:1']);
101 | $this->version->getServiceVersion(ServiceInterface::NAME_PHP);
102 | }
103 |
104 | /**
105 | * @throws ConfigurationMismatchException
106 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
107 | */
108 | public function testGetServiceVersionException()
109 | {
110 | $exception = new FilesystemException('reader exception');
111 | $this->readerMock->expects($this->once())
112 | ->method('read')
113 | ->willThrowException($exception);
114 | $this->version->getServiceVersion(ServiceInterface::NAME_RABBITMQ);
115 | }
116 |
117 | /**
118 | * @param array $config
119 | * @param string $result
120 | * @throws \Magento\CloudDocker\App\ConfigurationMismatchException
121 | *
122 | * @dataProvider getPhpVersionDataProvider
123 | */
124 | public function testGetPhpVersion(array $config, string $result)
125 | {
126 | $this->readerMock->expects($this->once())
127 | ->method('read')
128 | ->willReturn($config);
129 | $this->assertEquals($result, $this->version->getPhpVersion());
130 | }
131 |
132 | /**
133 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
134 | * @expectedExceptionMessage Some exception
135 | */
136 | public function testGetPhpVersionReaderException()
137 | {
138 | $exception = new ConfigurationMismatchException('Some exception');
139 | $this->readerMock->expects($this->once())
140 | ->method('read')
141 | ->willThrowException($exception);
142 | $this->version->getPhpVersion();
143 | }
144 |
145 | /**
146 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
147 | * @expectedExceptionMessage Type "notphp" is not supported
148 | */
149 | public function testGetPhpVersionWrongType()
150 | {
151 | $this->readerMock->expects($this->once())
152 | ->method('read')
153 | ->willReturn(['type' => 'notphp:7.1']);
154 | $this->version->getPhpVersion();
155 | }
156 |
157 | /**
158 | * @throws ConfigurationMismatchException
159 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
160 | */
161 | public function testGetPhpVersionException()
162 | {
163 | $exception = new FileSystemException('reader exception');
164 | $this->readerMock->expects($this->once())
165 | ->method('read')
166 | ->willThrowException($exception);
167 | $this->version->getPhpVersion();
168 | }
169 |
170 | /**
171 | * @param array $config
172 | * @param string $result
173 | * @throws ConfigurationMismatchException
174 | *
175 | * @dataProvider getCronDataProvider
176 | */
177 | public function testGetCron($config, $result)
178 | {
179 | $this->readerMock->expects($this->once())
180 | ->method('read')
181 | ->willReturn($config);
182 | $this->assertEquals($result, $this->version->getCron());
183 | }
184 |
185 | /**
186 | * @throws ConfigurationMismatchException
187 | * @expectedException \Magento\CloudDocker\App\ConfigurationMismatchException
188 | */
189 | public function testGetCronException()
190 | {
191 | $exception = new FileSystemException('reader exception');
192 | $this->readerMock->expects($this->once())
193 | ->method('read')
194 | ->willThrowException($exception);
195 | $this->version->getCron();
196 | }
197 |
198 | /**
199 | * Data provider for testGetCron
200 | *
201 | * @return array
202 | */
203 | public function getCronDataProvider()
204 | {
205 | $cronData = ['some cron data'];
206 |
207 | return [
208 | [
209 | ['crons' => $cronData],
210 | $cronData
211 | ],
212 | [
213 | ['notCron' => 'some data'],
214 | []
215 | ],
216 | ];
217 | }
218 |
219 | public function getPhpVersionDataProvider(): array
220 | {
221 | return [
222 | [
223 | ['type' => 'php:7.1'],
224 | '7.1'
225 | ],
226 | [
227 | ['type' => 'php:7.3.0-rc'],
228 | '7.3.0'
229 | ],
230 | ];
231 | }
232 |
233 | /**
234 | * @return array
235 | */
236 | public function getServiceVersionFromConfigDataProvider(): array
237 | {
238 | return [
239 | [
240 | ['type' => 'php:7.1'],
241 | ServiceInterface::NAME_PHP,
242 | 7.1
243 | ],
244 | [
245 | [
246 | 'type' => 'php:7.1',
247 | 'services' => [
248 | ServiceInterface::NAME_ELASTICSEARCH => [
249 | 'version' => '6.7'
250 | ]
251 | ]
252 | ],
253 | ServiceInterface::NAME_ELASTICSEARCH,
254 | 6.7
255 | ],
256 | [
257 | [
258 | 'services' => [
259 | ServiceInterface::NAME_ELASTICSEARCH => [
260 | 'version' => '6.7'
261 | ]
262 | ]
263 | ],
264 | 'nonexistent',
265 | null
266 | ],
267 | ];
268 | }
269 | }
270 |
--------------------------------------------------------------------------------
/src/Test/Unit/Config/ReaderTest.php:
--------------------------------------------------------------------------------
1 | fileListMock = $this->createMock(FileList::class);
44 | $this->filesystemMock = $this->createMock(Filesystem::class);
45 |
46 | $this->fileListMock->method('getAppConfig')
47 | ->willReturn('/root/.magento.app.yaml');
48 | $this->fileListMock->method('getServicesConfig')
49 | ->willReturn('/root/.magento/services.yaml');
50 |
51 | $this->reader = new Reader(
52 | $this->fileListMock,
53 | $this->filesystemMock
54 | );
55 | }
56 |
57 | /**
58 | * @expectedException \Magento\CloudDocker\Filesystem\FilesystemException
59 | * @expectedExceptionMessage PHP version could not be parsed.
60 | *
61 | * @throws FilesystemException
62 | */
63 | public function testReadEmpty()
64 | {
65 | $this->filesystemMock->expects($this->exactly(2))
66 | ->method('get')
67 | ->willReturn(Yaml::dump([]));
68 |
69 | $this->reader->read();
70 | }
71 |
72 | /**
73 | * @expectedException \Magento\CloudDocker\Filesystem\FilesystemException
74 | * @expectedExceptionMessage Relationships could not be parsed.
75 | *
76 | * @throws FileSystemException
77 | */
78 | public function testReadWithPhp()
79 | {
80 | $this->filesystemMock->expects($this->exactly(2))
81 | ->method('get')
82 | ->willReturnMap([
83 | ['/root/.magento.app.yaml', false, Yaml::dump(['type' => 'php:7.1'])],
84 | ['/root/.magento/services.yaml', false, Yaml::dump([])]
85 | ]);
86 |
87 | $this->reader->read();
88 | }
89 |
90 | /**
91 | * @expectedExceptionMessage Only one instance of service "elasticsearch" supported
92 | * @expectedException \Magento\CloudDocker\Filesystem\FilesystemException
93 | *
94 | * @throws FileSystemException
95 | */
96 | public function testReadWithMultipleSameServices()
97 | {
98 | $this->filesystemMock->expects($this->exactly(2))
99 | ->method('get')
100 | ->willReturnMap([
101 | [
102 | '/root/.magento.app.yaml',
103 | false,
104 | Yaml::dump([
105 | 'type' => 'php:7.1',
106 | 'relationships' => [
107 | 'database' => 'mysql:mysql',
108 | 'elasticsearch' => 'elasticsearch:elasticsearch',
109 | 'elasticsearch5' => 'elasticsearch5:elasticsearch'
110 | ]
111 | ]),
112 | ],
113 | [
114 | '/root/.magento/services.yaml',
115 | false,
116 | Yaml::dump([
117 | 'mysql' => [
118 | 'type' => 'mysql:10.0',
119 | 'disk' => '2048'
120 | ],
121 | 'elasticsearch' => [
122 | 'type' => 'elasticsearch:1.4',
123 | 'disk' => '1024'
124 | ],
125 | 'elasticsearch5' => [
126 | 'type' => 'elasticsearch:5.2',
127 | 'disk' => '1024'
128 | ]
129 | ])
130 | ]
131 | ]);
132 |
133 | $this->assertSame([
134 | 'type' => 'php:7.1',
135 | 'crons' => [],
136 | 'services' => [
137 | 'mysql' => [
138 | 'service' => 'mysql',
139 | 'version' => '10.0'
140 | ],
141 | 'redis' => [
142 | 'service' => 'redis',
143 | 'version' => '3.0'
144 | ],
145 | 'elasticsearch' => [
146 | 'service' => 'elasticsearch',
147 | 'version' => '1.4'
148 | ],
149 | 'rabbitmq' => [
150 | 'service' => 'rabbitmq',
151 | 'version' => '3.5'
152 | ]
153 | ]
154 | ], $this->reader->read());
155 | }
156 |
157 | /**
158 | * @expectedExceptionMessage Service with name "myrabbitmq" could not be parsed
159 | * @expectedException \Magento\CloudDocker\Filesystem\FilesystemException
160 | *
161 | * @throws FileSystemException
162 | */
163 | public function testReadWithMissedService()
164 | {
165 | $this->filesystemMock->expects($this->exactly(2))
166 | ->method('get')
167 | ->willReturnMap([
168 | [
169 | '/root/.magento.app.yaml',
170 | false,
171 | Yaml::dump([
172 | 'type' => 'php:7.1',
173 | 'relationships' => [
174 | 'database' => 'mysql:mysql',
175 | 'elasticsearch' => 'elasticsearch:elasticsearch',
176 | 'mq' => 'myrabbitmq:rabbitmq'
177 | ]
178 | ]),
179 | ],
180 | [
181 | '/root/.magento/services.yaml',
182 | false,
183 | Yaml::dump([
184 | 'mysql' => [
185 | 'type' => 'mysql:10.0',
186 | 'disk' => '2048'
187 | ],
188 | 'elasticsearch' => [
189 | 'type' => 'elasticsearch:1.4',
190 | 'disk' => '1024'
191 | ],
192 | ])
193 | ]
194 | ]);
195 |
196 | $this->reader->read();
197 | }
198 |
199 | /**
200 | * @expectedException \Magento\CloudDocker\Filesystem\FilesystemException
201 | * @expectedExceptionMessage Some error
202 | *
203 | * @throws FileSystemException
204 | */
205 | public function testReadBroken()
206 | {
207 | $this->fileListMock->expects($this->once())
208 | ->method('getAppConfig')
209 | ->willThrowException(new \Exception('Some error'));
210 |
211 | $this->reader->read();
212 | }
213 |
214 | /**
215 | * @throws FileSystemException
216 | */
217 | public function testRead()
218 | {
219 | $this->filesystemMock->expects($this->exactly(2))
220 | ->method('get')
221 | ->willReturnMap([
222 | [
223 | '/root/.magento.app.yaml',
224 | false,
225 | Yaml::dump([
226 | 'type' => 'php:7.1',
227 | 'relationships' => [
228 | 'database' => 'mysql:mysql',
229 | 'redis' => 'redis:redis',
230 | 'elasticsearch' => 'elasticsearch:elasticsearch',
231 | 'mq' => 'myrabbitmq:rabbitmq'
232 | ],
233 | ]),
234 | ],
235 | [
236 | '/root/.magento/services.yaml',
237 | false,
238 | Yaml::dump([
239 | 'mysql' => [
240 | 'type' => 'mysql:10.0',
241 | 'disk' => '2048'
242 | ],
243 | 'redis' => [
244 | 'type' => 'redis:3.0'
245 | ],
246 | 'elasticsearch' => [
247 | 'type' => 'elasticsearch:1.4',
248 | 'disk' => '1024'
249 | ],
250 | 'myrabbitmq' => [
251 | 'type' => 'rabbitmq:3.5',
252 | 'disk' => '1024'
253 | ]
254 | ])
255 | ]
256 | ]);
257 |
258 | $this->assertSame([
259 | 'type' => 'php:7.1',
260 | 'crons' => [],
261 | 'services' => [
262 | 'mysql' => [
263 | 'service' => 'mysql',
264 | 'version' => '10.0'
265 | ],
266 | 'redis' => [
267 | 'service' => 'redis',
268 | 'version' => '3.0'
269 | ],
270 | 'elasticsearch' => [
271 | 'service' => 'elasticsearch',
272 | 'version' => '1.4'
273 | ],
274 | 'rabbitmq' => [
275 | 'service' => 'rabbitmq',
276 | 'version' => '3.5'
277 | ]
278 | ],
279 | 'runtime' => [
280 | 'extensions' => [],
281 | 'disabled_extensions' => [],
282 | ]
283 | ], $this->reader->read());
284 | }
285 | }
286 |
--------------------------------------------------------------------------------