Merge pull request #2116 from dokku/warn-on-low-memory

Warn users when there is a low memory condition on installation
This commit is contained in:
Jose Diaz-Gonzalez committed 2016-04-16 17:46:34 -04:00
commit 6a39fd70e1
1 file changed
+7
+7
View File
@@ -12,6 +12,7 @@ set -eo pipefail; [[ $TRACE ]] && set -x
# It also means that we can't run a partially downloaded script. # It also means that we can't run a partially downloaded script.
ensure-environment() { ensure-environment() {
local FREE_MEMORY
echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..." echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..."
if ! command -v apt-get &>/dev/null; then if ! command -v apt-get &>/dev/null; then
echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/" echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
@@ -22,6 +23,12 @@ ensure-environment() {
echo "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts" echo "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts"
exit 1 exit 1
} }
FREE_MEMORY=$(grep MemTotal /proc/meminfo | awk '{print $2}')
if [[ "$FREE_MEMORY" -lt 1003600 ]]; then
echo "For dokku to build containers, it is strongly suggested that you have 1024 megabytes or more of free memory"
echo "If necessary, please consult this document to setup swap: http://dokku.viewdocs.io/dokku/advanced-installation/#vms-with-less-than-1gb-of-memory"
fi
} }
install-requirements() { install-requirements() {