zulip/tools/ci/production-install

43 lines
1.3 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
ZULIP_PATH=/home/github/zulip
if [ "$CIRCLECI" = true ]; then
ZULIP_PATH=/home/circleci/zulip
fi
# 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
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 POSTGRES_VERSION=10
fi
# Install Zulip
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com
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