diff --git a/docs/production/requirements.md b/docs/production/requirements.md index c492e822bb..8ecf6fec23 100644 --- a/docs/production/requirements.md +++ b/docs/production/requirements.md @@ -11,9 +11,9 @@ To run a Zulip server, you will need: - x86-64 - aarch64 - At least 2 GB RAM, and 10 GB disk space + - If you have < 5 GB RAM, we require some swap space; we recommend configuring + 2 GB of swap - If you expect 100+ users: 4 GB RAM, and 2 CPUs - - If you intend to [upgrade from Git][upgrade-from-git]: 3 GB RAM, or - 2G and at least 1G of swap configured. - A hostname in DNS - Credentials for sending email @@ -63,11 +63,10 @@ sudo apt update - CPU and memory: For installations with 100+ users you'll need a minimum of **2 CPUs** and **4 GB RAM**. For installations with fewer - users, 1 CPU and 2 GB RAM is sufficient. We strongly recommend against - installing with less than 2 GB of RAM, as you will likely experience - out of memory issues installing dependencies. We recommend against - using highly CPU-limited servers like the AWS `t2` style instances - for organizations with hundreds of users (active or no). + users, 1 CPU and 2 GB RAM with 2 GB of swap is sufficient. We + recommend against using highly CPU-limited servers like the AWS `t2` + style instances for organizations with hundreds of users (active or + no). - Disk space: You'll need at least 10 GB of free disk space for a server with dozens of users. We recommend using an SSD and avoiding diff --git a/scripts/lib/install b/scripts/lib/install index a68d5aff9b..f7118fdd1d 100755 --- a/scripts/lib/install +++ b/scripts/lib/install @@ -327,6 +327,19 @@ if [ "$mem_kb" -lt 1860000 ]; then exit 1 fi +# Anything under 5GB, we recommended allocating 2GB of swap. Error +# out if there's no swap. +swap_kb=$(grep SwapTotal /proc/meminfo | awk '{print $2}') +if [ "$mem_kb" -lt 5000000 ] && [ "$swap_kb" -eq 0 ]; then + set +x + echo -e '\033[0;31m' >&2 + echo "No swap allocated; when running with < 5GB of RAM, we recommend at least 2GB of swap." >&2 + echo "https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04" >&2 + echo >&2 + echo -e '\033[0m' >&2 + exit 1 +fi + # Do package update, e.g. do `apt-get update` on Debian if [ "$package_system" = apt ]; then # setup-apt-repo does an `apt-get update`