浏览代码

Merge branch 'master' into add-php-spx-profiler

Mark Shust 1 年之前
父节点
当前提交
22b1b1a036
共有 8 个文件被更改,包括 68 次插入5 次删除
  1. 6 0
      .github/dependabot.yml
  2. 5 3
      README.md
  3. 1 0
      compose/Makefile
  4. 10 0
      compose/bin/deploy
  5. 10 2
      compose/bin/download
  6. 34 0
      compose/bin/phpcbf
  7. 1 0
      images/php/8.1/Dockerfile
  8. 1 0
      images/php/8.2/Dockerfile

+ 6 - 0
.github/dependabot.yml

@@ -0,0 +1,6 @@
+version: 2
+updates:
+  - package-ecosystem: github-actions
+    directory: /
+    schedule:
+      interval: daily

+ 5 - 3
README.md

@@ -184,8 +184,8 @@ bin/download 2.4.6-p3 community
 #  --opensearch-port="$OPENSEARCH_PORT" \
 #  --search-engine=opensearch \
 # with:
-#  --elasticsearch-host="$OPENSEARCH_HOST" \
-#  --elasticsearch-port="$OPENSEARCH_PORT" \
+#  --elasticsearch-host="$ES_HOST" \
+#  --elasticsearch-port="$ES_PORT" \
 #  --search-engine=elasticsearch7 \
 
 # Run the setup installer for Magento:
@@ -285,6 +285,7 @@ It is recommended to keep your root docker config files in one repository, and y
 - `bin/download`: Download specific Magento version from Composer to the container, with optional arguments of the version (2.4.6-p3 [default]) and type ("community" [default], "enterprise", or "mageos"). Ex. `bin/download 2.4.6-p3 enterprise`
 - `bin/debug-cli`: Enable Xdebug for bin/magento, with an optional argument of the IDE key. Defaults to PHPSTORM Ex. `bin/debug-cli enable PHPSTORM`
 - `bin/deploy`: Runs the standard Magento deployment process commands. Pass extra locales besides `en_US` via an optional argument. Ex. `bin/deploy nl_NL`
+- `bin/docker-stats`: Display status for CPU, memory usage, and memory limit of currently-running Docker containers.
 - `bin/fixowns`: This will fix filesystem ownerships within the container.
 - `bin/fixperms`: This will fix filesystem permissions within the container.
 - `bin/grunt`: Run the grunt binary. Ex. `bin/grunt exec`
@@ -311,7 +312,8 @@ It is recommended to keep your root docker config files in one repository, and y
 - `bin/setup-composer-auth`: Setup authentication credentials for Composer.
 - `bin/setup-domain`: Setup Magento domain name. Ex: `bin/setup-domain magento.test`
 - `bin/setup-grunt`: Install and configure Grunt JavaScript task runner to compile .less files
-- `bin/setup-pwa-studio`: (BETA) Install PWA Studio (requires NodeJS and Yarn to be installed on the host machine). Pass in your base site domain, otherwise the default `master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud` will be used. Ex: `bin/setup-pwa-studio magento.test`
+- `bin/setup-pwa-studio`: (BETA) Install PWA Studio (requires NodeJS and Yarn to be installed on the host machine). Pass in your base site domain, otherwise the default `master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud` will be used. Ex: `bin/setup-pwa-studio magento.test`.
+- `bin/setup-pwa-studio-sampledata`: This script makes it easier to install Venia sample data. Pass in your base site domain, otherwise the default `master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud` will be used. Ex: `bin/setup-pwa-studio-sampledata magento.test`.
 - `bin/setup-ssl`: Generate an SSL certificate for one or more domains. Ex. `bin/setup-ssl magento.test foo.test`
 - `bin/setup-ssl-ca`: Generate a certificate authority and copy it to the host.
 - `bin/start`: Start all containers, good practice to use this instead of `docker-compose up -d`, as it may contain additional helpers.

+ 1 - 0
compose/Makefile

@@ -31,6 +31,7 @@ help:
 	@echo "$(call format,dev-urn-catalog-generate,'Generate URNs for PHPStorm and remap paths to local host.')"
 	@echo "$(call format,devconsole,'Alias for n98-magerun2 dev:console.')"
 	@echo "$(call format,devtools-cli-check,'Check & install the CLI devtools if missing from system.')"
+	@echo "$(call format,docker-stats,'Display status for CPU, memory usage, and memory limit of currently-running Docker containers.')"
 	@echo "$(call format,download,'Download & extract specific Magento version to the src directory.')"
 	@echo "$(call format,fixowns,'This will fix filesystem ownerships within the container.')"
 	@echo "$(call format,fixperms,'This will fix filesystem permissions within the container.')"

+ 10 - 0
compose/bin/deploy

@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+container_ids=$(bin/docker-compose ps -q)
+
+if [ -z "$container_ids" ]; then
+    echo "No active containers found"
+    exit 1
+fi
+
+docker stats "$container_ids"

+ 10 - 2
compose/bin/download

@@ -3,6 +3,11 @@
 VERSION=${1:-2.4.6-p3}
 EDITION=${2:-community}
 
+# Define ANSI escape codes for colors
+YELLOW='\033[0;33m'
+BLUE='\033[0;34m'
+NC='\033[0m' # No Color
+
 bin/stop
 
 bin/start --no-dev
@@ -24,5 +29,8 @@ else
   bin/clinotty composer create-project --repository=https://repo.magento.com/ magento/project-"${EDITION}"-edition="${VERSION}" .
 fi
 
-bin/clinotty [ ! -f "./var/composer_home/auth.json" ] && bin/clinotty mkdir -p ./var/composer_home && bin/clinotty cp /var/www/.composer/auth.json ./var/composer_home/auth.json
-
+if [ $? != 0 ]; then
+    echo -e "${BLUE}Please check the installation guide at ${YELLOW}https://github.com/markshust/docker-magento#install-fails-because-project-directory-is-not-empty${BLUE} for troubleshooting.${NC}"
+else
+    bin/clinotty [ ! -f "./var/composer_home/auth.json" ] && bin/clinotty mkdir -p ./var/composer_home && bin/clinotty cp /var/www/.composer/auth.json ./var/composer_home/auth.json
+fi

+ 34 - 0
compose/bin/phpcbf

@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+set +e
+
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+NC='\033[0m'
+
+BASE_URL=${1:-master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud}
+
+install_sampledata() {
+    echo -e "${GREEN}Setting up composer repository for Venia sample data.${NC}"
+    bin/composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com
+
+    echo -e "${GREEN}Requiring Venia sample data metapackage.${NC}"
+    bin/composer require --no-interaction --ansi magento/venia-sample-data:*
+
+    echo -e "${GREEN}Installing Venia sample data modules.${NC}"
+    bin/magento setup:upgrade
+
+    echo -e "${GREEN}Reindexing the data from the modules.${NC}"
+    bin/magento indexer:reindex
+}
+
+install_sampledata
+
+ENV_DIST_FILE="packages/venia-concept/.env.dist"
+if [ -f "$ENV_DIST_FILE" ]; then
+    cp "$ENV_DIST_FILE" packages/venia-concept/.env
+else
+    echo -e "${RED}.env.dist file not found. Continuing without copying.${NC}"
+fi
+
+echo -e "${GREEN}Script completed successfully.${NC}"
+echo "You may now access your Magento PWA Studio instance at https://${BASE_URL}/"

+ 1 - 0
images/php/8.1/Dockerfile

@@ -34,6 +34,7 @@ RUN apt-get update && apt-get install -y \
     msmtp \
     nodejs \
     procps \
+    strace \
     vim \
     zip \
     zlib1g-dev \

+ 1 - 0
images/php/8.2/Dockerfile

@@ -34,6 +34,7 @@ RUN apt-get update && apt-get install -y \
     msmtp \
     nodejs \
     procps \
+    strace \
     vim \
     zip \
     zlib1g-dev \