소스 검색

Add ability to detect memory usage in bin/start #527

Mark Shust 3 년 전
부모
커밋
019922e7d5
2개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      compose/bin/setup
  2. 4 0
      compose/bin/start

+ 4 - 1
compose/bin/setup

@@ -1,6 +1,10 @@
 #!/bin/bash
 set -o errexit
 
+MEM=$(docker info | grep "Total Memory" | cut -d':' -f2 | xargs | sed s/GiB//)
+# Docker reports RAM 0.2 less than what it is actually set to
+(( $(echo "$MEM < 5.8" | bc -l) )) && echo "There must be at least 6GB of RAM allocated to Docker to continue." && exit
+
 # shellcheck source=../env/db.env
 source env/db.env
 # shellcheck source=../env/elasticsearch.env
@@ -10,7 +14,6 @@ source env/magento.env
 # shellcheck source=../env/rabbitmq.env
 source env/rabbitmq.env
 
-
 DOMAIN=${1:-magento.test}
 
 bin/stop

+ 4 - 0
compose/bin/start

@@ -1,6 +1,10 @@
 #!/bin/bash
 set -o errexit
 
+MEM=$(docker info | grep "Total Memory" | cut -d':' -f2 | xargs | sed s/GiB//)
+# Docker reports RAM 0.2 less than what it is actually set to
+(( $(echo "$MEM < 5.8" | bc -l) )) && echo "There must be at least 6GB of RAM allocated to Docker to continue." && exit
+
 # Ref: https://stackoverflow.com/a/51789677/9821321
 function parseYaml {
   local s