- # 6. sufficient available resources
- # 6a. Memory
- #
- avail_mem="$(LANG=C free -m | grep '^Mem:' | awk '{print $2}')"
- if [ "$avail_mem" -lt 1000 ]; then
- echo "You do not appear to have sufficient memory to run Discourse."
- echo
- echo "See https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#create-new-cloud-server"
- exit 1
- elif [ "$avail_mem" -lt 2000 ]; then
- total_swap="$(LANG=C free -m | grep ^Swap: | awk '{print $2}')"
- if [ "$total_swap" -lt 1000 ]; then
- echo "You must have at least 1GB of swap when running with less than 2GB of RAM."
- echo
- echo "See https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#set-up-swap-if-needed"
- exit 1
- fi
- fi
-
- # 6b. Disk space
- free_disk="$(df /var | tail -n 1 | awk '{print $4}')"
- if [ "$free_disk" -lt 5000 ]; then
- echo "You must have at least 5GB of *free* disk space to install Discourse."
- echo
- echo "Please free up some space, or expand your disk, before continuing."
- exit 1
- fi