瀏覽代碼

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