Pārlūkot izejas kodu

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

Mark Shust 3 gadi atpakaļ
vecāks
revīzija
019922e7d5
2 mainītis faili ar 8 papildinājumiem un 1 dzēšanām
  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