2
0
Эх сурвалжийг харах

Merge pull request #1017 from YevhenZvieriev/feature/container-monitor

Mark Shust 1 жил өмнө
parent
commit
2dfcd75226

+ 1 - 0
README.md

@@ -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`

+ 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/docker-stats

@@ -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"