mirror of https://github.com/zulip/zulip.git
101 lines
2.9 KiB
Bash
Executable File
101 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# This test installs a Zulip production environment (from the release
|
|
# tarball from production-build).
|
|
set -e
|
|
set -x
|
|
|
|
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
|
|
|
|
ZULIP_PATH=/root/zulip-latest
|
|
mkdir -p "$ZULIP_PATH"
|
|
tar -xf /tmp/zulip-server-test.tar.gz -C "$ZULIP_PATH" --strip-components=1
|
|
|
|
# Do an apt upgrade to start with an up-to-date machine
|
|
APT_OPTIONS=(-o 'Dpkg::Options::=--force-confdef' -o 'Dpkg::Options::=--force-confold')
|
|
apt-get update
|
|
|
|
if [ -f /etc/os-release ]; then
|
|
# This is a temporary hack to test Debian Bullseye systems as
|
|
# though Bullseye was already released, so we don't need to
|
|
# change all of our scripts to parse bullseye/sid.
|
|
check_pretty_name="$(
|
|
. /etc/os-release
|
|
printf '%s\n' "$PRETTY_NAME"
|
|
)"
|
|
{ read -r pretty_name; } <<<"$check_pretty_name"
|
|
|
|
if [ "$pretty_name" = "Debian GNU/Linux bullseye/sid" ]; then
|
|
echo "VERSION_CODENAME=bullseye" | tee -a >>/etc/os-release
|
|
echo "VERSION_ID=\"11\"" | tee -a >>/etc/os-release
|
|
fi
|
|
# End hack
|
|
|
|
os_info="$(
|
|
. /etc/os-release
|
|
printf '%s\n' "$VERSION_CODENAME"
|
|
)"
|
|
{ read -r os_version_codename || true; } <<<"$os_info"
|
|
fi
|
|
|
|
if ! apt-get dist-upgrade -y "${APT_OPTIONS[@]}"; then
|
|
echo "\`apt-get dist-upgrade\`: Failure occurred while trying to perform distribution upgrade, Retrying..."
|
|
apt-get dist-upgrade -y "${APT_OPTIONS[@]}"
|
|
fi
|
|
|
|
# Pin to PostgreSQL 10 on Bionic, so we can test upgrading it
|
|
if [ "$os_version_codename" = "bionic" ]; then
|
|
export POSTGRESQL_VERSION=10
|
|
fi
|
|
|
|
# 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
|
|
|
|
if [ "$os_version_codename" = "bionic" ]; then
|
|
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
|
|
|
|
echo "Production installation complete!"
|
|
exit 0
|