mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 12:33:40 +00:00
installer: Halt if wrong version of PostgreSQL is already installed.
49a7a66004 and immediately previous commits began installing
PostgreSQL 12 from their apt repository. On machines which already
have the distribution-provided version of PostgreSQL installed,
however, this leads to failure to apply puppet when restarting
PostgreSQL 12, as both attempt to claim the same port.
During installation, if we will be installing PostgreSQL, look for
other versions than what we will install, and abort if they are
found. This is safer than attempting to automatically uninstall or
reconfigure existing databases.
This commit is contained in:
committed by
Tim Abbott
parent
814198d649
commit
31f1f10501
@@ -184,6 +184,37 @@ EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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`.
|
||||
|
||||
Reference in New Issue
Block a user