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
|
|
|
|
This will instruct the install test to be ran with a custom database name and user.
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
2020-10-23 02:43:28 +02:00
|
|
|
# Pin to PostgreSQL 10 on Bionic, so we can test upgrading it
|
2021-06-24 21:01:35 +02:00
|
|
|
if [ "$os_id $os_version_id" = 'ubuntu 18.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."
|
|
|
|
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com
|
|
|
|
else
|
|
|
|
echo "Testing production install with custom database name and user."
|
|
|
|
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com --postgresql-database-user zulipcustomuser --postgresql-database-name zulipcustomdb
|
|
|
|
fi
|
2015-10-15 01:47:42 +02:00
|
|
|
|
2021-06-24 21:01:35 +02:00
|
|
|
if [ "$os_id $os_version_id" = 'ubuntu 18.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
|