Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
installer: Halt if wrong version of PostgreSQL is already installed.
Alex Vandiver31f1f1050155
diff --git a/docs/production/install-existing-server.md b/docs/production/install-existing-server.mdindex b9230103ffb..eb3d5d67181 100644--- a/docs/production/install-existing-server.md+++ b/docs/production/install-existing-server.md@@ -62,9 +62,16 @@ $ sudo service puppet-agent stop$ sudo service puppet stop```-### Postgres+### PostgreSQL-If you have an existing postgres database, note that Zulip will use+Zulip expects to install PostgreSQL 12, and find that listening on+port 5432; any other version of PostgreSQL that is detected at install+time will cause the install to abort. If you already have PostgreSQL+installed, you can pass `--postgres-version=` to the installer to have+it use that version. It will replace the package with the latest from+the PostgreSQL apt repository, but existing data will be retained.++If you have an existing PostgreSQL database, note that Zulip will usethe default `main` as its database name; make sure you're not usingthat.diff --git a/scripts/lib/install b/scripts/lib/installindex 86398442a6c..f47713d42d3 100755--- a/scripts/lib/install+++ b/scripts/lib/install@@ -184,6 +184,37 @@ EOFexit 1fi+case ",$PUPPET_CLASSES," in+ *,zulip::voyager,* | *,zulip::postgres_appdb_tuned,*)+ if [ "$package_system" = apt ]; then+ # We're going to install Postgres from the postgres apt+ # repository; this may conflict with the existing postgres.+ OTHER_PG="$(dpkg --get-selections |+ grep '^postgresql-[1-9].*\binstall$' |+ grep -v "^postgresql-$POSTGRES_VERSION\b" |+ cut -f 1)" || true+ if [ -n "$OTHER_PG" ]; then+ INDENTED="${OTHER_PG//$'\n'/$'\n' }"+ SPACED="${OTHER_PG//$'\n'/ }"+ cat <<EOF++The following PostgreSQL servers were found to already be installed:++ $INDENTED++Zulip needs to install PostgreSQL $POSTGRES_VERSION, but does not wish+to uninstall existing databases in order to do so. Remove all other+PostgreSQL servers manually before running the installer:++ sudo apt-get remove $SPACED++EOF+ exit 1+ fi+ fi+ ;;+esac+# Check for at least ~1.86GB of RAM before starting installation;# otherwise users will find out about insufficient RAM via weird# errors like a segfault running `pip install`.