From b822bbbad457073bd357f980979bfcc1adaa2a16 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 10:59:21 +0200 Subject: [PATCH 01/17] Fixed wrong file extension used in m2d to start containers with bind mount --- bin/m2d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/m2d b/bin/m2d index fbc9403..8cb3d2c 100755 --- a/bin/m2d +++ b/bin/m2d @@ -545,8 +545,8 @@ case $1 in '-b'|'--build') if [[ 'bind' == $(_m2d_env_get_parameter "$M2D_ENV_FILE" M2D_SOURCE_DIRECTORY_SYNC_TYPE) ]]; then docker-compose --project-directory "$M2D_PROJECT_PATH" \ - -f "$M2D_PROJECT_PATH/docker-compose.yaml" \ - -f "$M2D_PROJECT_PATH/docker-compose.bind.yaml" \ + -f "$M2D_PROJECT_PATH/docker-compose.yml" \ + -f "$M2D_PROJECT_PATH/docker-compose.bind.yml" \ up -d --build else docker-compose --project-directory "$M2D_PROJECT_PATH" up -d --build @@ -589,8 +589,8 @@ case $1 in *) if [[ 'bind' == $(_m2d_env_get_parameter "$M2D_ENV_FILE" M2D_SOURCE_DIRECTORY_SYNC_TYPE) ]]; then docker-compose --project-directory "$M2D_PROJECT_PATH" \ - -f "$M2D_PROJECT_PATH/docker-compose.yaml" \ - -f "$M2D_PROJECT_PATH/docker-compose.bind.yaml" \ + -f "$M2D_PROJECT_PATH/docker-compose.yml" \ + -f "$M2D_PROJECT_PATH/docker-compose.bind.yml" \ build else docker-compose --project-directory "$M2D_PROJECT_PATH" build From 2aa8f78028945365667fe9ecb5a5c45f6fe8516d Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 11:00:11 +0200 Subject: [PATCH 02/17] Fixed bad container name for 'm2d go web' command --- bin/m2d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/m2d b/bin/m2d index 8cb3d2c..981009f 100755 --- a/bin/m2d +++ b/bin/m2d @@ -605,7 +605,7 @@ case $1 in _m2d_display_help_go ;; 'web') - docker exec -it --env COLUMNS=`tput cols` --env LINES=`tput lines` --user magento m2d-web bash + docker exec -it --env COLUMNS=`tput cols` --env LINES=`tput lines` --user magento "m2d-web$(_m2d_env_get_parameter $M2D_ENV_FILE M2D_PROJECT_SUFFIX)" bash ;; *) _m2d_exec_container "$2" "$3" From 4444db80086a51299190feab954ffe368ca20971 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 11:09:44 +0200 Subject: [PATCH 03/17] Removed underscore at the end of image name as it was throwing error on Linux host --- services/web-servers/apache/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile index b868bf7..0815501 100644 --- a/services/web-servers/apache/Dockerfile +++ b/services/web-servers/apache/Dockerfile @@ -3,7 +3,7 @@ ARG M2D_ENABLE_BLACKFIRE='no' ARG M2D_HOSTNAME_FOR_MAILCATCHER='m2d-mailcatcher' ## BASE PHP IMAGE - COMMON FOR ALL PHP VERSIONS ## -FROM php:${M2D_WEB_SERVER_PHP_VERSION}-apache-bullseye AS m2d_web_server_apache_php_base_ +FROM php:${M2D_WEB_SERVER_PHP_VERSION}-apache-bullseye AS m2d_web_server_apache_php_base # SETTING UP THE SYSTEM: RUN apt-get update \ @@ -143,10 +143,10 @@ RUN chmod +x /usr/local/bin/* ## BASE IMAGE WITHOUT BLACKFIRE ## -FROM m2d_web_server_apache_php_base_ AS m2d_web_server_apache_php_base_blackfire_no +FROM m2d_web_server_apache_php_base AS m2d_web_server_apache_php_base_blackfire_no ## BASE IMAGE WITH BLACKFIRE ## -FROM m2d_web_server_apache_php_base_ AS m2d_web_server_apache_php_base_blackfire_yes +FROM m2d_web_server_apache_php_base AS m2d_web_server_apache_php_base_blackfire_yes # BLACKFIRE: RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ From cbf78d623bebbab40881caa23422a886a56d6933 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 12:40:58 +0200 Subject: [PATCH 04/17] Fixed spelling and clarity of m2d messages and prompts --- bin/m2d | 67 ++++++++++++---------- services/web-servers/apache/bin/install.sh | 31 ++++++---- 2 files changed, 56 insertions(+), 42 deletions(-) diff --git a/bin/m2d b/bin/m2d index 981009f..de09b4f 100755 --- a/bin/m2d +++ b/bin/m2d @@ -18,7 +18,7 @@ Examples: Options: - -h, --help Disply help for command + -h, --help Display help for command Commands: build Build or rebuild containers @@ -31,7 +31,7 @@ Commands: setup Configure project show Shows configuration value stop Stops containers - sync Manage data sync from between host an containers + sync Manage data sync from between host and containers up Create and start containers " } @@ -48,14 +48,14 @@ Examples: ./bin/m2d set es 8.4 Options: - -h, --help Disply help for command + -h, --help Display help for command Parameters: es Alias for setting Elasticsearch as the search engine. It will set M2D_SEARCH_ENGINE_VENDOR to 'elasticsearch', - and M2D_SEARCH_ENGINE_VERSION to '7' if expected version is not provided as a value + and M2D_SEARCH_ENGINE_VERSION to '7' if the expected version is not provided as a value php Alias for parameter M2D_WEB_SERVER_PHP_VERSION suffix Alias for parameter M2D_PROJECT_SUFFIX - [M2D_*] Parameter name. List of possible parameters and their values is in .env.example + [M2D_*] Parameter name. A list of possible parameters and their values is in the '.env.example' file " } @@ -70,10 +70,10 @@ Example: ./bin/m2d show M2D_SOURCE_DIRECTORY Options: - -h, --help Disply help for command + -h, --help Display help for command Parameters: - [M2D_*] Parameter name. List of possible parameters is in .env.example + [M2D_*] Parameter name. A list of possible parameters is in the '.env.example' file " } @@ -88,7 +88,7 @@ Example: ./bin/m2d setup init Options: - -h, --help Disply help for command + -h, --help Display help for command Commands: init Starts creator of initial configuration for Web container and .env file @@ -111,7 +111,7 @@ Example: ./bin/m2d $command mailcatcher Options: - -h, --help Disply help for command + -h, --help Display help for command Commands: blackfire $Command blackfire container @@ -139,7 +139,7 @@ Usage: ./bin/m2d up [OPTIONS] Create and start containers. Options: - -h, --help Disply help for command + -h, --help Display help for command -b, --build Build images before starting containers. " } @@ -150,7 +150,7 @@ function _m2d_display_help_commad_generic () Usage: ./bin/m2d $1 [OPTIONS] Options: - -h, --help Disply help for command + -h, --help Display help for command " } @@ -165,7 +165,7 @@ Example: ./bin/m2d go web Options: - -h, --help Disply help for command + -h, --help Display help for command Containers: web Alias for m2d-web container @@ -183,7 +183,7 @@ Usage: ./bin/m2d logs [OPTIONS] CONTAINER_NAME View logs from containers. Options: - -h, --help Disply help for command + -h, --help Display help for command Current containers: " @@ -195,17 +195,17 @@ function _m2d_display_help_sync () echo " Usage: ./bin/m2d sync [OPTIONS] ACTION -Manage data sync from between host an containers. +Manage data sync from between host and containers. Options: - -h, --help Disply help for command + -h, --help Display help for command Actions: - start Starts synchronisation if applicable - pause Pause synchronisation if applicable + start Starts synchronization if applicable + pause Pause synchronization if applicable stop Stops synchronization if applicable status Display synchronization status if applicable - restart Restart synchronisation if applicable + restart Restart synchronization if applicable " } @@ -215,7 +215,9 @@ function _m2d_init_source_folder () local current_folder=$(_m2d_env_get_parameter "$env_file" M2D_SOURCE_DIRECTORY) local new_folder - read -p "Set the path where you want to keep Magento source files. Press enter to keep current '$current_folder': " new_folder + echo 'Magento2Docker, depending on the sync type, will sync or bind "/var/www/html" path in a container to a local folder on the host.' + echo 'Please provide a complete or relative path to the folder you want to use for this, e.g., "/Users/adam/src" or "~/src"' + read -p "Type the path to a folder you want to use or leave it empty to keep the current '$current_folder': " new_folder if [[ -z "$new_folder" ]]; then new_folder="$current_folder" @@ -225,7 +227,7 @@ function _m2d_init_source_folder () if [[ ! -d "$new_folder" ]]; then local confirm - read -p "Path '$new_folder' doesn't exist. Create it? [y/n]: " confirm + read -p "Path '$new_folder' doesn't exist. Do you want to create it? [y/n]: " confirm [[ $confirm == 'y' ]] && mkdir -p "$new_folder" fi @@ -237,8 +239,9 @@ function _m2d_init_env() local env_file="$1" local current_value value confirm + echo 'Initializing project...' if [[ -f "$env_file" ]]; then - read -p 'You already have .env file. Do you want to recreate it? [y/n]: ' confirm + read -p 'You already have .env settings file. You can keep it (n) or recreate it (y). Do you want to recreate it? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then cp "$env_file.example" "$env_file" fi @@ -246,7 +249,7 @@ function _m2d_init_env() cp "$env_file.example" "$env_file" fi - read -p 'Do you want to configure main Magento2Docker settings? [y/n]: ' confirm + read -p 'Do you want to provide core Magento2Docker settings (y) or do you want to use current (n)? [y/n]: ' confirm if [[ $confirm != 'y' ]]; then echo "Magento2Docker will use settings from this file: '$env_file'" echo 'Please verify them before further usage!' @@ -259,7 +262,7 @@ function _m2d_init_env() done _m2d_env_set_parameter "$env_file" M2D_SOURCE_DIRECTORY "$value" - read -p 'Are you on Apple M1 chip? [y/n]: ' confirm + read -p 'Are you on Apple M1/M2 chip? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then _m2d_env_set_parameter "$env_file" M2D_CPU_TYPE m1 else @@ -267,13 +270,13 @@ function _m2d_init_env() fi value=$(_m2d_env_get_parameter "$env_file" M2D_XDEBUG_IDE_KEY) - read -p "Provide IDE key for xDebug (e.g.: PHPSTORM, VSCODE). Press enter to keep current '$value': " value + read -p "Provide IDE key to be used by xDebug (e.g.: PHPSTORM, VSCODE) or leave it empty to keep the current '$value': " value if [[ -n $value ]]; then _m2d_env_set_parameter "$env_file" M2D_XDEBUG_IDE_KEY "$value" fi value=$(_m2d_env_get_parameter "$env_file" MAGENTO_CLOUD_CLI_TOKEN) - read -p "Provide Magento Cloud CLI authentication token. Press enter to keep current '$value': " value + read -p "Provide Magento Cloud CLI authentication token or leave it empty to keep the current '$value': " value if [[ -n $value ]]; then _m2d_env_set_parameter "$env_file" MAGENTO_CLOUD_CLI_TOKEN "$value" fi @@ -319,7 +322,7 @@ function _m2d_exec_container () if [[ -n "$allowed" ]]; then docker exec -it --user "$user_name" "$container_name" /bin/bash else - echo "Sorry, container '$container_name' does not exists!" + echo "Sorry, container '$container_name' doesn't exist!" fi } @@ -331,7 +334,7 @@ function _m2d_logs_container () if [[ -n "$allowed" ]]; then docker logs -f "$container_name" else - echo "Sorry, container '$container_name' does not exists!" + echo "Sorry, container '$container_name' doesn't exist!" fi } @@ -346,7 +349,7 @@ function _m2d_sync () case $sync_type in 'bind') - echo "Nothing to do for '$action' in '$sync_type' sync type" + echo "For '$sync_type' sync type there are no sync actions to execute." ;; 'sshfs') local ssh_port=$(_m2d_env_get_parameter "$env_file" M2D_PORT_FOR_WEB_SERVER_SSH) @@ -365,8 +368,12 @@ function _m2d_sync () 'stop'|'pause') umount -f "$sync_dir" ;; + 'restart') + _m2d_sync stop "$env_file" + _m2d_sync start "$env_file" + ;; *) - echo "Nothing to do for '$action' in '$sync_type' sync type" + echo "For '$sync_type' sync type allowed actions are: start, stop, pause, and restart" ;; esac ;; @@ -413,7 +420,7 @@ function _m2d_sync () _m2d_sync start "$env_file" ;; *) - echo "Nothing to do for '$action' in '$sync_type' sync type" + echo "For '$sync_type' sync type allowed actions are: start, stop, pause, restart, and status" ;; esac ;; diff --git a/services/web-servers/apache/bin/install.sh b/services/web-servers/apache/bin/install.sh index 82ea980..fd3a896 100755 --- a/services/web-servers/apache/bin/install.sh +++ b/services/web-servers/apache/bin/install.sh @@ -8,17 +8,18 @@ function _m2d_install_apache_init_ahut_json () target_file="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)/../etc/composer/auth.json" if [[ -f "$target_file" ]]; then - read -p 'You already have auth.json file. Do you want to keep it? [y/n]: ' confirm + read -p 'You already have auth.json file generated for Magento2Docker. Do you want to keep it (y) or recreate it (n)? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then return 0 fi mv "$target_file" "$target_file.backup" + echo "The current auth.json file has been archived to: $target_file.backup" fi if [[ -f ~/.composer/auth.json ]]; then - read -p 'Do you want to use your current auth.json file (from ~/.composer/auth.json)? [y/n]: ' confirm + read -p 'Do you want to use your auth.json file from the host (~/.composer/auth.json)? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then cp ~/.composer/auth.json "$target_file" @@ -26,7 +27,8 @@ function _m2d_install_apache_init_ahut_json () fi fi - read -p 'Do you want to use existing auth.json file? [y/n]: ' confirm + echo 'You can use any existing auth.json file or you will be asked to provide public and private composer keys.' + read -p 'Do you want to use any existing auth.json file? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then local auth_json_path while [[ ! -f "$target_file" ]] @@ -41,7 +43,7 @@ function _m2d_install_apache_init_ahut_json () return 0 fi - read -p "'$auth_json_path' doesn't exists! Do you want to try again? [y/n]: " confirm + read -p "'$auth_json_path' doesn't exist! Do you want to try again? [y/n]: " confirm if [[ $confirm == 'n' ]]; then break @@ -50,8 +52,9 @@ function _m2d_install_apache_init_ahut_json () fi local username password file_content - read -p 'Provide public key to repo.magento.com: ' username - read -p 'Provide private key to repo.magento.com: ' password + echo 'The auth.json file will be generated based on your public and private keys.' + read -p 'Provide a public key to repo.magento.com: ' username + read -p 'Provide a private key to repo.magento.com: ' password file_content=$(cat < /dev/null && pwd)/../etc/git/gitconfig" if [[ -f "$target_file" ]]; then - read -p 'You already have gitconfig file. Do you want to keep it? [y/n]: ' confirm + read -p 'You already have a git config file created for Magento2Docker. Do you want to keep it? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then return 0 fi mv "$target_file" "$target_file.backup" + echo "The current git config file has been archived to: $target_file.backup" fi if [[ -f ~/.gitconfig ]]; then - read -p 'Do you want to use your current gitconfig file (from ~/.gitconfig)? [y/n]: ' confirm + read -p 'Do you want to use your current gitconfig file from the host (from ~/.gitconfig)? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then cp ~/.gitconfig "$target_file" @@ -94,7 +98,8 @@ function _m2d_install_apache_init_git_config () fi local email name file_content - read -p 'Provide your email addres: ' email + echo 'Generating minimal git configuration:' + read -p 'Provide your email address: ' email read -p 'Provide your full name (name and surname): ' name file_content=$(cat < /dev/null && pwd)/../etc/ssh" + echo 'You may want to add your ssh configuration and keys to the web container, so you will be able to connect to external services like e.g. GithHub' + if [[ -f ~/.ssh/config ]]; then - read -p 'Do you want to add SSH config file(s) to the web container? [y/n]: ' confirm + read -p 'Do you want to add SSH config file(s) from the host to the web container? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then cp ~/.ssh/config* "$target_path/" @@ -122,14 +129,14 @@ function _m2d_install_apache_init_certs () fi if [[ -f ~/.ssh/known_hosts ]]; then - read -p 'Do you want to add known_hosts file to the web container? [y/n]: ' confirm + read -p 'Do you want to add known_hosts file from the host to the web container? [y/n]: ' confirm if [[ $confirm == 'y' ]]; then cp ~/.ssh/known_hosts "$target_path/" fi fi - read -p 'Do you want to select the SSH keys to be added to the web container? [y/n]: ' confirm + read -p 'Do you want to add any of your SSH keys to the web container (you will be able to select which keys to add)? [y/n]: ' confirm if [[ $confirm == 'n' ]]; then return 0 From 3a39710f4d278232622b60e8b1fc83c42bea9ed4 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 13:16:58 +0200 Subject: [PATCH 05/17] Fixed spelling and clarity in .env.example file --- .env.example | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.env.example b/.env.example index 1f32994..b74cbee 100644 --- a/.env.example +++ b/.env.example @@ -2,9 +2,9 @@ ## MAIN SETTINGS ## ########################################## -# Set the base path were you want to keep Magento source files +# Set the path on the host that will be mapped to /var/www/html folder in the container # e.g. /var/www/html or ~/src/html -M2D_SOURCE_DIRECTORY='/var/www/html' +M2D_SOURCE_DIRECTORY='~/src/html' # Set the project suffix. It will be used to distinguish different instances of Magento2Docker # If you only work with one instance, you can skip it. M2D_PROJECT_SUFFIX='' @@ -34,21 +34,21 @@ MAGENTO_CLOUD_CLI_TOKEN='' ## MAILCATCHER # Set to 'yes' to enable Mailcatcher or to 'no' to disable it: M2D_ENABLE_MAILCATCHER='no' -# Set the port number on which the Mailcatcher web interface will be hosted: +# Set the port number exposed to the host by the Mailcatcher web interface: M2D_PORT_FOR_MAILCATCHER=1080 ## BLACKFIRE # Set to 'yes' to enable Blackfire or to 'no' to disable it: M2D_ENABLE_BLACKFIRE='no' -## SELENIUUM +## SELENIUM # Set to 'yes' to enable Selenium or to 'no' to disable it: M2D_ENABLE_SELENIUM='no' -# Set Selenium version you want to use: +# Set the Selenium version you want to use: M2D_SELENIUM_VERSION='3.14.0' -# Set port number used by Seleniub HUB: +# Set port number exposed to the host by Selenium HUB: M2D_PORT_FOR_SELENIUM_HUB='4444' -# Set the port number used by VNC in Selenium container: +# Set the port number exposed to the host by VNC in the Selenium container: M2D_PORT_FOR_SELENIUM_VNC='5900' @@ -63,29 +63,29 @@ M2D_WEB_SERVER_VENDOR='apache' # Set which PHP version you want to use: # - PHP versions: 7.3, 7.4, 8.1, 8.2 M2D_WEB_SERVER_PHP_VERSION='8.1' -# Sets amount of memory available for PHP (php.ini: memory_limit) +# Sets the amount of memory available for PHP (php.ini: memory_limit) M2D_WEB_SERVER_PHP_MEMORY_LIMIT='2G' -# Set the port number used by SSH: +# Set the SSH port number exposed to the host: M2D_PORT_FOR_WEB_SERVER_SSH='2222' -# Set the port number used by HTTP: +# Set the HTTP port number exposed to the host: M2D_PORT_FOR_WEB_SERVER_HTTP='80' -# Set the port number used by HTTPS: +# Set the HTTPS port number exposed to the host: M2D_PORT_FOR_WEB_SERVER_HTTPS='443' ## DB ENGINE # Set which DB engine you want to use: # - 'mariadb' for MariaDB [https://www.elastic.co/] -# - 'mysql' for Opensearch [https://opensearch.org/] +# - 'mysql' for MySQL [https://www.mysql.com/] M2D_DB_ENGINE_VENDOR='mariadb' -# Set expected version of the search engine: +# Set the expected version of the DB engine: # - MariaDB versions: 10, 10.2, 10.3, 10.4, 10.6 # - MySQL versions: 5, 5.7, 8, 8.0, 8.0-oracle M2D_DB_ENGINE_VERSION='10' -# Set the port number used by search engine: +# Set the DB port number exposed to the host: M2D_PORT_FOR_DB_ENGINE='3306' ## SEARCH ENGINE -# Set to 'yes' to enable search engine or to 'no' to disable it: +# Set to 'yes' to enable the search engine or to 'no' to disable it: M2D_ENABLE_SEARCH_ENGINE='yes' # Set which search engine you want to use: # - 'elasticsearch' for ElasticSearch [https://www.elastic.co/] @@ -95,39 +95,39 @@ M2D_SEARCH_ENGINE_VENDOR='elasticsearch' # - ElasticSearch versions: 6, 7, 7.6, 7.7, 7.9, 7.10, 7.16, 7.17, 8, 8.4 # - OpenSearch versions: 1, 1.2, 2, 2.5 M2D_SEARCH_ENGINE_VERSION='7' -# Set the port number used by search engine: +# Set the search engine port number exposed to the host: M2D_PORT_FOR_SEARCH_ENGINE='9200' ## MESSAGE-BROKER -# Set to 'yes' to enable Message Broker or to 'no' to disable it: +# Set to 'yes' to enable message broker or to 'no' to disable it: M2D_ENABLE_MESSAGE_BROKER='no' # Set which message broker you want to use: # - 'rabbitmq' for RabbitMQ [https://www.rabbitmq.com/] M2D_MESSAGE_BROKER_VENDOR='rabbitmq' -# Set expected version of the message broker: +# Set the expected version of the message broker: # - RabbitMQ versions: 3.8, 3.9 M2D_MESSAGE_BROKER_VERSION='3.8' -# Set the port number used by a broker: +# Set the broker port number exposed to the host: M2D_PORT_FOR_MESSAGE_BROKER='15672' ## WEB CACHE -# Set to 'yes' to enable Web Cache or to 'no' to disable it +# Set to 'yes' to enable web cache or to 'no' to disable it M2D_ENABLE_WEB_CACHE='no' -# Set witch web cache solution to use: +# Set which web cache solution to use: # - 'varnish' for Varnish HTTP Cache [https://varnish-cache.org/] M2D_WEB_CACHE_VENDOR='varnish' -# Set expected version of the web cache: +# Set the expected version of the web cache: # - Varnish versions: 6, 6.0, 6.2, 6.4, 6.5, 7, 7.0, 7.1 M2D_WEB_CACHE_VERSION='6' -# Set the port number used by web cache: +# Set the web cache port number exposed to the host: M2D_PORT_FOR_WEB_CACHE='8080' ## DB CACHE -# Set to 'yes' to enable DB Cache or to 'no' to disable it +# Set to 'yes' to enable DB cache or to 'no' to disable it M2D_ENABLE_DB_CACHE='no' -# Set witch db cache solution to use: +# Set which db cache solution to use: # - 'redis' for Redis [https://redis.io/] M2D_DB_CACHE_VENDOR='redis' -# Set expected version of the db cache: +# Set the expected version of the db cache: # - Redis versions: 5, 6, 6.2, 7 M2D_DB_CACHE_VERSION='6.2' From 25e577bb4c65fe18d1b2fb0942191527517411bb Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 13:18:38 +0200 Subject: [PATCH 06/17] Removed COMPOSER_AUTH variable as it is overiding other ways of providing composer credentials --- .env.example | 2 -- docker-compose.yml | 1 - 2 files changed, 3 deletions(-) diff --git a/.env.example b/.env.example index b74cbee..c279c3d 100644 --- a/.env.example +++ b/.env.example @@ -22,8 +22,6 @@ M2D_CPU_TYPE='m1' # - 'VSCODE' if you are Microsoft Visual Studio Code user # - '***' you can set any value your IDE requires M2D_XDEBUG_IDE_KEY='PHPSTORM' -# Provide Composer authorisation: -COMPOSER_AUTH='{"http-basic":{"repo.magento.com":{"username": "","password":""}}}' # Provide Magento CLI authentication token: MAGENTO_CLOUD_CLI_TOKEN='' diff --git a/docker-compose.yml b/docker-compose.yml index 7d1bbbf..b34ad7a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,6 @@ services: - BLACKFIRE_CLIENT_ID - BLACKFIRE_CLIENT_TOKEN - MAGENTO_CLOUD_CLI_TOKEN - # - COMPOSER_AUTH ports: - "${M2D_PORT_FOR_WEB_SERVER_HTTP:-80}:80" - "${M2D_PORT_FOR_WEB_SERVER_HTTPS:-443}:443" From a88ed9601c47a9985e427fb93eeae839c959346d Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 15:19:42 +0200 Subject: [PATCH 07/17] Added fix action for mutagen + fine tune mutagen parameters for session --- bin/m2d | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/m2d b/bin/m2d index de09b4f..0048e1f 100755 --- a/bin/m2d +++ b/bin/m2d @@ -402,6 +402,11 @@ function _m2d_sync () --ignore=/**/var/log \ --ignore=/**/.DS_Store \ --symlink-mode=posix-raw \ + --probe-mode=assume \ + --scan-mode=accelerated \ + --stage-mode=internal \ + --watch-mode=portable \ + --watch-polling-interval=20 \ "$sync_dir" \ "docker://magento@$sync_web/var/www/html/" fi @@ -419,8 +424,11 @@ function _m2d_sync () _m2d_sync stop "$env_file" _m2d_sync start "$env_file" ;; + 'fix') + mutagen sync reset $sync_name && mutagen sync flush $sync_name + ;; *) - echo "For '$sync_type' sync type allowed actions are: start, stop, pause, restart, and status" + echo "For '$sync_type' sync type allowed actions are: start, stop, pause, restart, status and fix" ;; esac ;; From 344c645ce47d4c5f9cb80f7394a29d755e1598f7 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 15:21:17 +0200 Subject: [PATCH 08/17] Reorganize Dockerfile for web server --- services/web-servers/apache/Dockerfile | 60 +++++++++++++------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile index 0815501..4ac5512 100644 --- a/services/web-servers/apache/Dockerfile +++ b/services/web-servers/apache/Dockerfile @@ -68,6 +68,10 @@ COPY ./services/web-servers/apache/tools/* /usr/local/bin/ # PHP CONFIG FILES: COPY ./services/web-servers/apache/etc/php/* /usr/local/etc/php/conf.d/ +# CUSTOM CONFIGURATIONS: +COPY ./services/web-servers/apache/etc/apache2 /etc/apache2 +COPY ./services/web-servers/apache/etc/fixtures /etc/fixtures + # MAILCATCHER: ENV M2D_HOSTNAME_FOR_MAILCATCHER=$M2D_HOSTNAME_FOR_MAILCATCHER RUN echo "account default" >> /etc/msmtprc \ @@ -97,48 +101,46 @@ RUN a2enmod ssl \ && chown -R ${_USER}:${_USER} /var/www/html RUN chown -R ${_USER}:${_USER} ${_HOME_DIRECTORY} -# BASH COMPLETION: -USER magento -RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc - -# MAGENTO CLI: -RUN curl -sS https://accounts.magento.cloud/cli/installer | php -USER root - # TUNE ENVIRONMENT: RUN echo "Defaults timestamp_timeout=-1" >> /etc/sudoers # FLAG TO NOT CACHE ANYTHING FROM THIS POINT, details: https://github.com/docker/docker/issues/1996#issuecomment-185872769 ARG CACHEBUST=1 -# CUSTOM CONFIGURATIONS: -COPY ./services/web-servers/apache/etc/apache2 /etc/apache2 -COPY ./services/web-servers/apache/etc/fixtures /etc/fixtures -COPY ./services/web-servers/apache/etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig -COPY ./services/web-servers/apache/etc/composer/auth.json* ${_HOME_DIRECTORY}/.composer/ -COPY ./services/web-servers/apache/etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ -RUN chown -R "${_USER}:${_USER}" ${_HOME_DIRECTORY}/.gitconfig ${_HOME_DIRECTORY}/.composer ${_HOME_DIRECTORY}/.m2install.conf* - # MAGENTO TOOLS: -RUN curl -o /usr/local/bin/m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh \ - && curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion \ - && curl -o /usr/local/bin/n98-magerun2 https://files.magerun.net/n98-magerun2.phar \ - && curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash \ - && curl -o /usr/local/bin/m2-convert-for-composer https://raw.githubusercontent.com/isitnikov/m2-convert-patch-for-composer-install/master/convert-for-composer.php \ - && curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion-enterprise \ - && curl -L -o /tmp/teleport.tar.gz https://github.com/gravitational/teleport/releases/download/v1.3.2/teleport-v1.3.2-linux-amd64-bin.tar.gz \ +RUN curl -o /usr/local/bin/m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh; \ + curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion; \ + curl -o /usr/local/bin/n98-magerun2 https://files.magerun.net/n98-magerun2.phar; \ + curl -o /etc/bash_completion.d/n98-magerun2.phar.bash https://raw.githubusercontent.com/netz98/n98-magerun2/master/res/autocompletion/bash/n98-magerun2.phar.bash; \ + curl -o /usr/local/bin/m2-convert-for-composer https://raw.githubusercontent.com/isitnikov/m2-convert-patch-for-composer-install/master/convert-for-composer.php; \ + curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion-enterprise; \ + curl -L -o /tmp/teleport.tar.gz https://github.com/gravitational/teleport/releases/download/v1.3.2/teleport-v1.3.2-linux-amd64-bin.tar.gz \ && tar -xf /tmp/teleport.tar.gz -C /tmp/ \ - && make -C /tmp/teleport/ \ - && git ls-remote git@github.com:magento-sparta/ee-support-tools.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/ee-support-tools.git /usr/local/src/ee-support-tools; else echo; fi \ - && if [ -d /usr/local/src/ee-support-tools ]; then ln -s /usr/local/src/ee-support-tools/cloud-teleport/cloud-teleport /usr/local/bin/cloud-teleport; else echo; fi \ - && git ls-remote git@github.com:magento-sparta/m-it.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/m-it.git /usr/local/src/m-it; else echo; fi \ + && make -C /tmp/teleport/ + +# ADOBE TOOLS: +RUN git ls-remote git@github.com:magento-sparta/ee-support-tools.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/ee-support-tools.git /usr/local/src/ee-support-tools; else echo; fi \ + && if [ -d /usr/local/src/ee-support-tools ]; then ln -s /usr/local/src/ee-support-tools/cloud-teleport/cloud-teleport /usr/local/bin/cloud-teleport; else echo; fi +RUN git ls-remote git@github.com:magento-sparta/m-it.git 2>&1 | if grep -q HEAD; then git clone git@github.com:magento-sparta/m-it.git /usr/local/src/m-it; else echo; fi \ && if [ -d /usr/local/src/m-it ]; then /usr/local/src/m-it/mit-installer.sh; else echo; fi +# USER CONTEXT CONFIGURATION USER magento + +COPY ./services/web-servers/apache/etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig +COPY ./services/web-servers/apache/etc/composer/auth.json* ${_HOME_DIRECTORY}/.composer/ +COPY ./services/web-servers/apache/etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ + +# BASH COMPLETION: +RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc RUN if [ -d /usr/local/src/m-it ]; then /usr/local/src/m-it/mit-installer.sh; else echo; fi -USER root -RUN chmod +x /usr/local/bin/* +# MAGENTO CLI: +RUN curl -sS https://accounts.magento.cloud/cli/installer | php + +USER root +RUN chown -R "${_USER}:${_USER}" ${_HOME_DIRECTORY}/.gitconfig ${_HOME_DIRECTORY}/.composer ${_HOME_DIRECTORY}/.m2install.conf*; \ + chmod +x /usr/local/bin/* ## END OF BASE IMAGE ## From 2b2c150b16d2fa4347d77d1354b1c30502b3c6ef Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 15:37:20 +0200 Subject: [PATCH 09/17] Configure mailcatcher only if it is enabled --- docker-compose.yml | 2 +- services/web-servers/apache/Dockerfile | 25 ++++++++++++++----------- services/web-servers/apache/etc/msmtprc | 4 ++++ 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 services/web-servers/apache/etc/msmtprc diff --git a/docker-compose.yml b/docker-compose.yml index b34ad7a..7adb135 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,9 +10,9 @@ services: target: web_server args: - M2D_WEB_SERVER_PHP_VERSION=${M2D_WEB_SERVER_PHP_VERSION:-8.1} + - M2D_ENABLE_MAILCATCHER=${M2D_ENABLE_MAILCATCHER:-no} - M2D_ENABLE_BLACKFIRE=${M2D_ENABLE_BLACKFIRE:-no} - M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} - - M2D_HOSTNAME_FOR_MAILCATCHER="m2d-mailcatcher${M2D_PROJECT_SUFFIX:-}" environment: - BLACKFIRE_CLIENT_ID - BLACKFIRE_CLIENT_TOKEN diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile index 4ac5512..0f7a8ad 100644 --- a/services/web-servers/apache/Dockerfile +++ b/services/web-servers/apache/Dockerfile @@ -1,6 +1,6 @@ ARG M2D_WEB_SERVER_PHP_VERSION='8.1' ARG M2D_ENABLE_BLACKFIRE='no' -ARG M2D_HOSTNAME_FOR_MAILCATCHER='m2d-mailcatcher' +ARG M2D_ENABLE_MAILCATCHER='no' ## BASE PHP IMAGE - COMMON FOR ALL PHP VERSIONS ## FROM php:${M2D_WEB_SERVER_PHP_VERSION}-apache-bullseye AS m2d_web_server_apache_php_base @@ -25,7 +25,6 @@ RUN apt-get update \ bash-completion \ openssh-server \ ssl-cert \ - msmtp \ sudo \ dnsutils \ iputils-ping \ @@ -72,13 +71,6 @@ COPY ./services/web-servers/apache/etc/php/* /usr/local/etc/php/conf.d/ COPY ./services/web-servers/apache/etc/apache2 /etc/apache2 COPY ./services/web-servers/apache/etc/fixtures /etc/fixtures -# MAILCATCHER: -ENV M2D_HOSTNAME_FOR_MAILCATCHER=$M2D_HOSTNAME_FOR_MAILCATCHER -RUN echo "account default" >> /etc/msmtprc \ - && echo "host $M2D_HOSTNAME_FOR_MAILCATCHER" >> /etc/msmtprc \ - && echo "port 1025" >> /etc/msmtprc \ - && echo "auto_from on" >> /etc/msmtprc - # SSH: COPY ./services/web-servers/apache/etc/ssh ${_HOME_DIRECTORY}/.ssh ADD ./services/web-servers/apache/etc/ssh/magento2docker.pub ${_HOME_DIRECTORY}/.ssh/authorized_keys @@ -143,12 +135,23 @@ RUN chown -R "${_USER}:${_USER}" ${_HOME_DIRECTORY}/.gitconfig ${_HOME_DIRECTORY chmod +x /usr/local/bin/* ## END OF BASE IMAGE ## +## BASE IMAGE WITHOUT MAILCATCHER ## +FROM m2d_web_server_apache_php_base AS m2d_web_server_apache_php_base_mailcatcher_no + +## BASE IMAGE WITH MAILCATCHER ## +FROM m2d_web_server_apache_php_base AS m2d_web_server_apache_php_base_mailcatcher_yes +RUN apt-get update && apt-get install -y msmtp +COPY ./services/web-servers/apache/etc/msmtprc /etc/msmtprc + +## MAILCATCHER +FROM m2d_web_server_apache_php_base_mailcatcher_${M2D_ENABLE_MAILCATCHER} AS m2d_web_server_apache_php_base_mailcatcher + ## BASE IMAGE WITHOUT BLACKFIRE ## -FROM m2d_web_server_apache_php_base AS m2d_web_server_apache_php_base_blackfire_no +FROM m2d_web_server_apache_php_base_mailcatcher AS m2d_web_server_apache_php_base_blackfire_no ## BASE IMAGE WITH BLACKFIRE ## -FROM m2d_web_server_apache_php_base AS m2d_web_server_apache_php_base_blackfire_yes +FROM m2d_web_server_apache_php_base_mailcatcher AS m2d_web_server_apache_php_base_blackfire_yes # BLACKFIRE: RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ diff --git a/services/web-servers/apache/etc/msmtprc b/services/web-servers/apache/etc/msmtprc new file mode 100644 index 0000000..d56df59 --- /dev/null +++ b/services/web-servers/apache/etc/msmtprc @@ -0,0 +1,4 @@ +account default +host mailcatcher +port 1025 +auto_from on From 6b3e682c5e711db95d6c512ceddf74b8c2d56872 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 16:55:24 +0200 Subject: [PATCH 10/17] Simplyfied search_engine host in .m2install.conf file --- services/web-servers/apache/etc/m2install/.m2install.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/web-servers/apache/etc/m2install/.m2install.conf b/services/web-servers/apache/etc/m2install/.m2install.conf index a9c664f..5a11c58 100644 --- a/services/web-servers/apache/etc/m2install/.m2install.conf +++ b/services/web-servers/apache/etc/m2install/.m2install.conf @@ -13,11 +13,11 @@ MAGENTO_EE_PATH= GIT_CE_REPO=git@github.com:magento/magento2.git GIT_EE_REPO= GIT_BRANCH=2.4-develop -SEARCH_ENGINE_ELASTICSEARCH7_HOST="m2d-searchengine" +SEARCH_ENGINE_ELASTICSEARCH7_HOST="search_engine" SEARCH_ENGINE_ELASTICSEARCH7_PORT="9200" -SEARCH_ENGINE_ELASTICSEARCH6_HOST="m2d-searchengine" +SEARCH_ENGINE_ELASTICSEARCH6_HOST="search_engine" SEARCH_ENGINE_ELASTICSEARCH6_PORT="9200" -SEARCH_ENGINE_ELASTICSEARCH5_HOST="m2d-searchengine" +SEARCH_ENGINE_ELASTICSEARCH5_HOST="search_engine" SEARCH_ENGINE_ELASTICSEARCH5_PORT="9200" -SEARCH_ENGINE_ELASTICSEARCH2_HOST="m2d-searchengine" +SEARCH_ENGINE_ELASTICSEARCH2_HOST="search_engine" SEARCH_ENGINE_ELASTICSEARCH2_PORT="9200" From 17e9c55f50b33a1d3cb909a6f4fff48c391285d9 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 17:33:42 +0200 Subject: [PATCH 11/17] Fixed function return --- bin/m2d | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/m2d b/bin/m2d index 0048e1f..36b2cbe 100755 --- a/bin/m2d +++ b/bin/m2d @@ -215,9 +215,11 @@ function _m2d_init_source_folder () local current_folder=$(_m2d_env_get_parameter "$env_file" M2D_SOURCE_DIRECTORY) local new_folder - echo 'Magento2Docker, depending on the sync type, will sync or bind "/var/www/html" path in a container to a local folder on the host.' - echo 'Please provide a complete or relative path to the folder you want to use for this, e.g., "/Users/adam/src" or "~/src"' - read -p "Type the path to a folder you want to use or leave it empty to keep the current '$current_folder': " new_folder + local prompt="Magento2Docker, depending on the sync type, will sync or bind '/var/www/html' path in a container to a local folder on the host. +Please provide a complete or relative path to the folder you want to use for this, e.g., '/Users/adam/src' or '~/src' +Type the path to a folder you want to use or leave it empty to keep the current '$current_folder': " + + read -p "$prompt" new_folder if [[ -z "$new_folder" ]]; then new_folder="$current_folder" From 78c08b0f71a1d6910a3a2820029413bff91aa980 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 19:48:08 +0200 Subject: [PATCH 12/17] Fixed php memory_limit handling --- docker-compose.yml | 2 ++ services/web-servers/apache/Dockerfile | 8 +++++--- services/web-servers/apache/etc/php/custom.ini | 3 +-- services/web-servers/apache/etc/php/memory_limit.ini | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 services/web-servers/apache/etc/php/memory_limit.ini diff --git a/docker-compose.yml b/docker-compose.yml index 7adb135..d56aee9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,10 +13,12 @@ services: - M2D_ENABLE_MAILCATCHER=${M2D_ENABLE_MAILCATCHER:-no} - M2D_ENABLE_BLACKFIRE=${M2D_ENABLE_BLACKFIRE:-no} - M2D_XDEBUG_IDE_KEY=${M2D_XDEBUG_IDE_KEY:-PHPSTORM} + - M2D_WEB_SERVER_PHP_MEMORY_LIMIT=${M2D_WEB_SERVER_PHP_MEMORY_LIMIT:-2G} environment: - BLACKFIRE_CLIENT_ID - BLACKFIRE_CLIENT_TOKEN - MAGENTO_CLOUD_CLI_TOKEN + - M2D_WEB_SERVER_PHP_MEMORY_LIMIT=${M2D_WEB_SERVER_PHP_MEMORY_LIMIT:-2G} ports: - "${M2D_PORT_FOR_WEB_SERVER_HTTP:-80}:80" - "${M2D_PORT_FOR_WEB_SERVER_HTTPS:-443}:443" diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile index 0f7a8ad..4936827 100644 --- a/services/web-servers/apache/Dockerfile +++ b/services/web-servers/apache/Dockerfile @@ -52,6 +52,11 @@ RUN useradd -m ${_USER} && echo "${_USER}:${_USER}" | chpasswd && chsh ${_USER} RUN docker-php-ext-install -j$(nproc) iconv soap sockets \ && docker-php-ext-install -j$(nproc) bcmath pdo_mysql xsl intl zip +# PHP CONFIG FILES: +ARG M2D_WEB_SERVER_PHP_MEMORY_LIMIT='2G' +ENV M2D_WEB_SERVER_PHP_MEMORY_LIMIT=${M2D_WEB_SERVER_PHP_MEMORY_LIMIT} +COPY ./services/web-servers/apache/etc/php/* /usr/local/etc/php/conf.d/ + # NODEJS: RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \ && apt-get install -y nodejs @@ -64,9 +69,6 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local # TOOLS: COPY ./services/web-servers/apache/tools/* /usr/local/bin/ -# PHP CONFIG FILES: -COPY ./services/web-servers/apache/etc/php/* /usr/local/etc/php/conf.d/ - # CUSTOM CONFIGURATIONS: COPY ./services/web-servers/apache/etc/apache2 /etc/apache2 COPY ./services/web-servers/apache/etc/fixtures /etc/fixtures diff --git a/services/web-servers/apache/etc/php/custom.ini b/services/web-servers/apache/etc/php/custom.ini index c4ecc0b..427a6a0 100644 --- a/services/web-servers/apache/etc/php/custom.ini +++ b/services/web-servers/apache/etc/php/custom.ini @@ -1,2 +1 @@ -memory_limit=${M2D_WEB_SERVER_PHP_MEMORY_LIMIT:-2G} -max_input_vars=10000 \ No newline at end of file +max_input_vars=10000 diff --git a/services/web-servers/apache/etc/php/memory_limit.ini b/services/web-servers/apache/etc/php/memory_limit.ini new file mode 100644 index 0000000..6b75504 --- /dev/null +++ b/services/web-servers/apache/etc/php/memory_limit.ini @@ -0,0 +1 @@ +memory_limit=${M2D_WEB_SERVER_PHP_MEMORY_LIMIT} \ No newline at end of file From 02c62a74e110d7f10f5640cd5bf3473213891e7e Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 19:48:57 +0200 Subject: [PATCH 13/17] Fixed M-IT setup for Magento user --- services/web-servers/apache/Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile index 4936827..05f974f 100644 --- a/services/web-servers/apache/Dockerfile +++ b/services/web-servers/apache/Dockerfile @@ -121,17 +121,24 @@ RUN git ls-remote git@github.com:magento-sparta/m-it.git 2>&1 | if grep -q HEAD; # USER CONTEXT CONFIGURATION USER magento +RUN mkdir -p ${_HOME_DIRECTORY}/.ssh \ + && touch ${_HOME_DIRECTORY}/.ssh/known_hosts \ + && ssh-keygen -F github.com || ssh-keyscan github.com >> ${_HOME_DIRECTORY}/.ssh/known_hosts + COPY ./services/web-servers/apache/etc/git/gitconfig ${_HOME_DIRECTORY}/.gitconfig COPY ./services/web-servers/apache/etc/composer/auth.json* ${_HOME_DIRECTORY}/.composer/ COPY ./services/web-servers/apache/etc/m2install/.m2install.conf* ${_HOME_DIRECTORY}/ # BASH COMPLETION: RUN echo "source /etc/bash_completion" >> ${_HOME_DIRECTORY}/.bashrc -RUN if [ -d /usr/local/src/m-it ]; then /usr/local/src/m-it/mit-installer.sh; else echo; fi # MAGENTO CLI: RUN curl -sS https://accounts.magento.cloud/cli/installer | php +# ADOBE TOOLS: +RUN if [ -d /usr/local/src/m-it ]; then /usr/local/src/m-it/mit-installer.sh; else echo; fi +ENV MIT_CHECK_FOR_UPDATES=no + USER root RUN chown -R "${_USER}:${_USER}" ${_HOME_DIRECTORY}/.gitconfig ${_HOME_DIRECTORY}/.composer ${_HOME_DIRECTORY}/.m2install.conf*; \ chmod +x /usr/local/bin/* From 0436021e73060dff275d15d63a7a13479852f279 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 20:10:06 +0200 Subject: [PATCH 14/17] Move out m2install git repo links to env variables (all credits goes to mmolochko) --- .env.example | 5 +++++ docker-compose.yml | 2 ++ services/web-servers/apache/etc/m2install/.m2install.conf | 6 ++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index c279c3d..97a6bbc 100644 --- a/.env.example +++ b/.env.example @@ -49,6 +49,11 @@ M2D_PORT_FOR_SELENIUM_HUB='4444' # Set the port number exposed to the host by VNC in the Selenium container: M2D_PORT_FOR_SELENIUM_VNC='5900' +## M2INSTALL +# Provide link to the Magento 2 CE repository: +M2INSTALL_GIT_CE_REPO='git@github.com:magento/magento2.git' +# Provide link to the Magento 2 EE repository: +M2INSTALL_GIT_EE_REPO='' ########################################## ## SERVICES CONFIGURATION SECTION ## diff --git a/docker-compose.yml b/docker-compose.yml index d56aee9..279e1bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,8 @@ services: - BLACKFIRE_CLIENT_TOKEN - MAGENTO_CLOUD_CLI_TOKEN - M2D_WEB_SERVER_PHP_MEMORY_LIMIT=${M2D_WEB_SERVER_PHP_MEMORY_LIMIT:-2G} + - "M2INSTALL_GIT_CE_REPO=${M2INSTALL_GIT_CE_REPO:-'git@github.com:magento/magento2.git'}" + - "M2INSTALL_GIT_EE_REPO=${M2INSTALL_GIT_EE_REPO:-''}" ports: - "${M2D_PORT_FOR_WEB_SERVER_HTTP:-80}:80" - "${M2D_PORT_FOR_WEB_SERVER_HTTPS:-443}:443" diff --git a/services/web-servers/apache/etc/m2install/.m2install.conf b/services/web-servers/apache/etc/m2install/.m2install.conf index 5a11c58..dc15467 100644 --- a/services/web-servers/apache/etc/m2install/.m2install.conf +++ b/services/web-servers/apache/etc/m2install/.m2install.conf @@ -8,11 +8,9 @@ BASE_PATH=/ DB_HOST=db DB_USER=root DB_PASSWORD= -COMPOSER_VERSION=2.2 MAGENTO_EE_PATH= -GIT_CE_REPO=git@github.com:magento/magento2.git -GIT_EE_REPO= -GIT_BRANCH=2.4-develop +GIT_CE_REPO=${M2INSTALL_GIT_CE_REPO:-'git@github.com:magento/magento2.git'} +GIT_EE_REPO=${M2INSTALL_GIT_EE_REPO:-''} SEARCH_ENGINE_ELASTICSEARCH7_HOST="search_engine" SEARCH_ENGINE_ELASTICSEARCH7_PORT="9200" SEARCH_ENGINE_ELASTICSEARCH6_HOST="search_engine" From 5dcf19274fcbd1fbfcff5588e1755de98e0eba53 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 20:17:47 +0200 Subject: [PATCH 15/17] Use same M-IT setting for container like for host --- docker-compose.yml | 1 + services/web-servers/apache/Dockerfile | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 279e1bb..3ffb29c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,7 @@ services: environment: - BLACKFIRE_CLIENT_ID - BLACKFIRE_CLIENT_TOKEN + - MIT_CHECK_FOR_UPDATES - MAGENTO_CLOUD_CLI_TOKEN - M2D_WEB_SERVER_PHP_MEMORY_LIMIT=${M2D_WEB_SERVER_PHP_MEMORY_LIMIT:-2G} - "M2INSTALL_GIT_CE_REPO=${M2INSTALL_GIT_CE_REPO:-'git@github.com:magento/magento2.git'}" diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile index 05f974f..572f9fd 100644 --- a/services/web-servers/apache/Dockerfile +++ b/services/web-servers/apache/Dockerfile @@ -137,7 +137,6 @@ RUN curl -sS https://accounts.magento.cloud/cli/installer | php # ADOBE TOOLS: RUN if [ -d /usr/local/src/m-it ]; then /usr/local/src/m-it/mit-installer.sh; else echo; fi -ENV MIT_CHECK_FOR_UPDATES=no USER root RUN chown -R "${_USER}:${_USER}" ${_HOME_DIRECTORY}/.gitconfig ${_HOME_DIRECTORY}/.composer ${_HOME_DIRECTORY}/.m2install.conf*; \ From 6b74a2731dfc6a5947f399c1c04013fc5fb8e0a5 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 20:32:30 +0200 Subject: [PATCH 16/17] Set same M-IT theme for container like for the host --- docker-compose.yml | 1 + services/web-servers/apache/Dockerfile | 1 + 2 files changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 3ffb29c..1606825 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,7 @@ services: - BLACKFIRE_CLIENT_ID - BLACKFIRE_CLIENT_TOKEN - MIT_CHECK_FOR_UPDATES + - BASH_IT_THEME - MAGENTO_CLOUD_CLI_TOKEN - M2D_WEB_SERVER_PHP_MEMORY_LIMIT=${M2D_WEB_SERVER_PHP_MEMORY_LIMIT:-2G} - "M2INSTALL_GIT_CE_REPO=${M2INSTALL_GIT_CE_REPO:-'git@github.com:magento/magento2.git'}" diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile index 572f9fd..c6aea4a 100644 --- a/services/web-servers/apache/Dockerfile +++ b/services/web-servers/apache/Dockerfile @@ -137,6 +137,7 @@ RUN curl -sS https://accounts.magento.cloud/cli/installer | php # ADOBE TOOLS: RUN if [ -d /usr/local/src/m-it ]; then /usr/local/src/m-it/mit-installer.sh; else echo; fi +RUN sed -i.back '/^export BASH_IT_THEME=/ s/^/# /' ${_HOME_DIRECTORY}/.bashrc USER root RUN chown -R "${_USER}:${_USER}" ${_HOME_DIRECTORY}/.gitconfig ${_HOME_DIRECTORY}/.composer ${_HOME_DIRECTORY}/.m2install.conf*; \ From 6180bfd14efba2a41b49700ea84b1db69cf79d41 Mon Sep 17 00:00:00 2001 From: Adam Wojciechowski Date: Fri, 14 Apr 2023 20:36:39 +0200 Subject: [PATCH 17/17] Added crontab and mc --- services/web-servers/apache/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/web-servers/apache/Dockerfile b/services/web-servers/apache/Dockerfile index c6aea4a..81a6b14 100644 --- a/services/web-servers/apache/Dockerfile +++ b/services/web-servers/apache/Dockerfile @@ -40,6 +40,7 @@ RUN apt-get update \ libzip-dev \ parallel \ git \ + mc \ && apt-get update \ && apt-get clean all @@ -142,6 +143,10 @@ RUN sed -i.back '/^export BASH_IT_THEME=/ s/^/# /' ${_HOME_DIRECTORY}/.bashrc USER root RUN chown -R "${_USER}:${_USER}" ${_HOME_DIRECTORY}/.gitconfig ${_HOME_DIRECTORY}/.composer ${_HOME_DIRECTORY}/.m2install.conf*; \ chmod +x /usr/local/bin/* + +# CRONTAB +RUN apt-get install cron && service cron start + ## END OF BASE IMAGE ## ## BASE IMAGE WITHOUT MAILCATCHER ##