2018-12-18 02:08:53 +01:00
|
|
|
#!/usr/bin/env bash
|
2017-06-06 03:15:17 +02:00
|
|
|
# This test installs a Zulip production environment (from the release
|
2020-06-27 01:17:52 +02:00
|
|
|
# tarball from production-build).
|
2015-10-15 01:47:42 +02:00
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2021-03-31 14:01:33 +02:00
|
|
|
usage() {
|
|
|
|
cat <<'EOF'
|
|
|
|
Usage:
|
|
|
|
production-install
|
|
|
|
production-install --test-custom-db
|
|
|
|
production-install --help
|
|
|
|
|
|
|
|
Options:
|
|
|
|
--test-custom-db
|
2022-02-08 00:13:33 +01:00
|
|
|
This will instruct the install test to be run with a custom database name and user.
|
2021-03-31 14:01:33 +02:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
# Shell option parsing.
|
|
|
|
args="$(getopt -o '' --long help,test-custom-db -n "$0" -- "$@")"
|
|
|
|
eval "set -- $args"
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
--test-custom-db)
|
|
|
|
TEST_CUSTOM_DB=1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-05-14 17:16:28 +02:00
|
|
|
ZULIP_PATH=/root/zulip-latest
|
|
|
|
mkdir -p "$ZULIP_PATH"
|
|
|
|
tar -xf /tmp/zulip-server-test.tar.gz -C "$ZULIP_PATH" --strip-components=1
|
2015-10-15 01:47:42 +02:00
|
|
|
|
2016-01-19 20:44:21 +01:00
|
|
|
# Do an apt upgrade to start with an up-to-date machine
|
2018-08-03 02:14:51 +02:00
|
|
|
APT_OPTIONS=(-o 'Dpkg::Options::=--force-confdef' -o 'Dpkg::Options::=--force-confold')
|
2016-05-02 23:34:49 +02:00
|
|
|
apt-get update
|
2016-06-22 17:59:34 +02:00
|
|
|
|
2018-08-03 02:14:51 +02:00
|
|
|
if ! apt-get dist-upgrade -y "${APT_OPTIONS[@]}"; then
|
2020-03-28 01:25:56 +01:00
|
|
|
echo "\`apt-get dist-upgrade\`: Failure occurred while trying to perform distribution upgrade, Retrying..."
|
2018-08-03 02:14:51 +02:00
|
|
|
apt-get dist-upgrade -y "${APT_OPTIONS[@]}"
|
2017-06-13 19:04:46 +02:00
|
|
|
fi
|
travis: Remove rabbitmq nodename dependency on hostname.
Because rabbitmq doesn't support changing the nodename of a running
rabbitmq node, Zulip installations suffered a plague of issues where
e.g. a Zulip server would reboot, the hostname would change, and
suddenly the local rabbitmq instance being used by Zulip would stop
working.
We address this problem by using, by default, a fixed rabbitmq
nodename, but providing server administrators the option to set the
rabbitmq nodename used by Zulip however they choose.
To upgrade an existing server to use this new configuration, one will
need to add something like the following to /etc/zulip/zulip.conf:
[rabbitmq]
nodename = zulip@localhost
However, I don't believe we have the puppet code in place to make this
work correctly at initial installation without rabbitmq-server being
already installed (but off), as we can easily setup in Travis CI but I
haven't been willing to do for the installer. So for now, this just
fixes our Travis CI problems.
Fixes: #1579.
2016-08-10 03:40:07 +02:00
|
|
|
|
2021-06-24 21:08:36 +02:00
|
|
|
os_info="$(
|
|
|
|
. /etc/os-release
|
|
|
|
printf '%s\n' "$ID" "$VERSION_ID"
|
|
|
|
)"
|
|
|
|
{
|
|
|
|
read -r os_id
|
|
|
|
read -r os_version_id
|
|
|
|
} <<<"$os_info"
|
|
|
|
|
2021-11-09 03:50:07 +01:00
|
|
|
# Pin to PostgreSQL 10 on Ubuntu 20.04, so we can test upgrading it
|
|
|
|
if [ "$os_id $os_version_id" = 'ubuntu 20.04' ]; then
|
2020-10-26 22:35:47 +01:00
|
|
|
export POSTGRESQL_VERSION=10
|
2020-06-27 01:26:18 +02:00
|
|
|
fi
|
|
|
|
|
2021-03-31 14:01:33 +02:00
|
|
|
# Install
|
|
|
|
if [ -z "$TEST_CUSTOM_DB" ]; then
|
|
|
|
echo "Testing production install with default database name and user."
|
2022-07-16 02:38:25 +02:00
|
|
|
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email ci@example.com
|
2021-03-31 14:01:33 +02:00
|
|
|
else
|
|
|
|
echo "Testing production install with custom database name and user."
|
2022-07-16 02:38:25 +02:00
|
|
|
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email ci@example.com --postgresql-database-user zulipcustomuser --postgresql-database-name zulipcustomdb
|
2021-03-31 14:01:33 +02:00
|
|
|
fi
|
2015-10-15 01:47:42 +02:00
|
|
|
|
2021-11-09 03:50:07 +01:00
|
|
|
if [ "$os_id $os_version_id" = 'ubuntu 20.04' ]; then
|
2020-06-27 01:26:18 +02:00
|
|
|
if [ "$(crudini --get /etc/zulip/zulip.conf postgresql version)" != "10" ]; then
|
|
|
|
echo "Installer did not install the PostgreSQL 10 that we asked for!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-06-27 01:17:52 +02:00
|
|
|
echo "Production installation complete!"
|
2016-05-08 03:49:43 +02:00
|
|
|
exit 0
|