Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check dependencies script #1018

Merged
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ It is recommended to keep your root docker config files in one repository, and y
- `bin/analyse`: Run `phpstan analyse` within the container to statically analyse code, passing in directory to analyse. Ex. `bin/analyse app/code`
- `bin/bash`: Drop into the bash prompt of your Docker container. The `phpfpm` container should be mainly used to access the filesystem within Docker.
- `bin/cache-clean`: Access the [cache-clean](https://github.com/mage2tv/magento-cache-clean) CLI. Note the watcher is automatically started at startup in `bin/start`. Ex. `bin/cache-clean config full_page`
- `bin/check-dependencies`: Provides helpful recommendations for dependencies tailored to the chosen Magento version.
- `bin/cli`: Run any CLI command without going into the bash prompt. Ex. `bin/cli ls`
- `bin/clinotty`: Run any CLI command with no TTY. Ex. `bin/clinotty chmod u+x bin/magento`
- `bin/cliq`: The same as `bin/cli`, but pipes all output to `/dev/null`. Useful for a quiet CLI, or implementing long-running processes.
Expand Down
4 changes: 4 additions & 0 deletions compose/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ help:
@echo "$(call red,===============================)"
@echo "$(call format,bash,'Drop into the bash prompt of your Docker container.')"
@echo "$(call format,cache-clean,'Access the cache-clean CLI.')"
@echo "$(call format,check-dependencies,'Provides helpful recommendations for dependencies.')"
@echo "$(call format,cli,'Run any CLI command without going into the bash prompt.')"
@echo "$(call format,clinotty,'Run any CLI command with no TTY.')"
@echo "$(call format,cliq,'Run any CLI command but pipe all output to /dev/null.')"
Expand Down Expand Up @@ -68,6 +69,9 @@ bash:

cache-clean:
@./bin/cache-clean $(call args)

check-dependencies:
@./bin/check-dependencies

cli:
@./bin/cli $(call args)
Expand Down
67 changes: 67 additions & 0 deletions compose/bin/check-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env bash

# Define colors for formatting
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

# Declare arrays for storing common dependencies and Magento versions
declare -a common_dependencies
declare -a magento_versions=("2.4.7-beta3" "2.4.7-beta2" "2.4.6-p4" "2.4.6-p3" "2.4.6-p2" "2.4.6-p1" "2.4.6" "2.4.5-p5" "2.4.5-p4" "2.4.5-p3" "2.4.5-p2" "2.4.5-p1" "2.4.5" "2.4.4-p6" "2.4.4-p5" "2.4.4-p4" "2.4.4-p3" "2.4.4-p2" "2.4.4-p1" "2.4.4" "2.4.3-p3" "2.4.2-p2")

# Assign common dependencies to corresponding Magento versions
common_dependencies[0]="Composer:2.6 Elasticsearch:8.11 OpenSearch:2.11 MariaDB:10.6 MySQL:8.0 PHP:8.3,8.2 RabbitMQ:3.12 Redis:7.2 Varnish:7.4 Apache:2.4 nginx:1.24 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.11.20 'AWS-ElastiCache':Redis7.0 'AWS-Elasticsearch':-- 'AWS-OpenSearch':2.11"
common_dependencies[1]="Composer:2.5 Elasticsearch:8.7 OpenSearch:2.5 MariaDB:10.6 MySQL:8.0 PHP:8.2,8.1 RabbitMQ:3.11 Redis:7.0 Varnish:7.3 Apache:2.4 nginx:1.24 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.10.20 'AWS-ElastiCache':Redis7.0 'AWS-Elasticsearch':-- 'AWS-OpenSearch':2.5"
common_dependencies[2]="Composer:2.2 Elasticsearch:8.5,7.17 OpenSearch:2.5 MariaDB:10.6 MySQL:8.0 PHP:8.2,8.1 RabbitMQ:3.11,3.9 Redis:7.0 Varnish:7.3 Apache:2.4 nginx:1.24 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.16 'AWS-ElastiCache':Redis6.2 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[3]="Composer:2.2 Elasticsearch:8.5,7.17 OpenSearch:2.5 MariaDB:10.6 MySQL:8.0 PHP:8.2,8.1 RabbitMQ:3.11,3.9 Redis:7.0 Varnish:7.3 Apache:2.4 nginx:1.24 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.16 'AWS-ElastiCache':Redis6.2 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[4]="Composer:2.2 Elasticsearch:8.5,7.17 OpenSearch:2.5 MariaDB:10.6 MySQL:8.0 PHP:8.2,8.1 RabbitMQ:3.11,3.9 Redis:7.0 Varnish:7.3 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.16 'AWS-ElastiCache':Redis6.2 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[5]="Composer:2.2 Elasticsearch:8.5,7.17 OpenSearch:2.5 MariaDB:10.6 MySQL:8.0 PHP:8.2,8.1 RabbitMQ:3.11,3.9 Redis:7.0 Varnish:7.3 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.16 'AWS-ElastiCache':Redis 6.2 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[6]="Composer:2.2 Elasticsearch:8.4,7.17 OpenSearch:2.5 MariaDB:10.6 MySQL:8.0 PHP:8.2,8.1 RabbitMQ:3.11,3.9 Redis:7.0 Varnish:7.1 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.16 'AWS-ElastiCache':Redis6.2 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[7]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.11,3.9 Redis:6.2 Varnish:7.3 Apache:2.4 nginx:1.24 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[8]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.11,3.9 Redis:6.2 Varnish:7.3 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[9]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.11,3.9 Redis:6.2 Varnish:7.3 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[10]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.1 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[11]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.0 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':7.9 'AWS-OpenSearch':1.2"
common_dependencies[12]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.0 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':7.9 'AWS-OpenSearch':1.2"
common_dependencies[13]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.3 Apache:2.4 nginx:1.24 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[14]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.3 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[15]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.3 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[16]="Composer:2.2 Elasticsearch:7.17 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.1 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':8.0 'AWS-S3':✔️ 'AWS-MQ':3.9.13 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':-- 'AWS-OpenSearch':1.2"
common_dependencies[17]="Composer:2.1 Elasticsearch:7.16 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.0 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':5.7 'AWS-S3':✔️ 'AWS-MQ':3.8.11 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':7.9 'AWS-OpenSearch':--"
common_dependencies[18]="Composer:2.1 Elasticsearch:7.16 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.0 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':5.7 'AWS-S3':✔️ 'AWS-MQ':3.8.11 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':7.9 'AWS-OpenSearch':--"
common_dependencies[19]="Composer:2.1 Elasticsearch:7.16 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:8.1 RabbitMQ:3.9 Redis:6.2 Varnish:7.0 Apache:2.4 nginx:1.22 'AWS-Aurora-(MySQL)':5.7 'AWS-S3':✔️ 'AWS-MQ':3.8.11 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':7.9 'AWS-OpenSearch':--"
common_dependencies[20]="Composer:1 Elasticsearch:7.16 OpenSearch:1.2 MariaDB:10.4 MySQL:8.0 PHP:7.4 RabbitMQ:3.8 Redis:6.0 Varnish:6.5 Apache:2.4 nginx:1.18 'AWS-Aurora-(MySQL)':5.7 'AWS-S3':✔️ 'AWS-MQ':3.8.11 'AWS-ElastiCache':Redis6 'AWS-Elasticsearch':7.9 'AWS-OpenSearch':--"
common_dependencies[21]="Composer:1 Elasticsearch:7.9 OpenSearch:-- MariaDB:10.4 MySQL:8.0 PHP:7.4 RabbitMQ:3.8 Redis:6.0 Varnish:6.4 Apache:2.4 nginx:1.18 'AWS-Aurora-(MySQL)':-- 'AWS-S3':✔️ 'AWS-MQ':-- 'AWS-ElastiCache':-- 'AWS-Elasticsearch':-- 'AWS-OpenSearch':--"

# Function to print available Magento versions
print_magento_versions() {
echo "Available Magento 2 versions:"
for version in "${magento_versions[@]}"; do
echo "$version"
done
}

# Function to print dependencies for a given Magento version
print_dependencies() {
local version=$1
local index
for (( index=0; index<${#magento_versions[@]}; index++ )); do
if [[ "${magento_versions[$index]}" == "$version" ]]; then
echo -e "${GREEN}Recommended software dependencies:${NC}"
local dependencies=${common_dependencies[$index]}
IFS=' ' read -ra deps <<< "$dependencies"
for dep in "${deps[@]}"; do
echo " • $dep"
done
return
fi
done
# If the provided Magento version is not recognized, prompt the user to choose a valid version
echo -e "${RED}Magento version not recognized. Please choose a valid version from the list below:${NC}"
print_magento_versions
}

# Prompt the user to enter a Magento version and print its dependencies
read -r -p "Enter the Magento 2 version you'd like to check dependencies on: " magento_version

print_dependencies "$magento_version"