zulip/tools/test-install/prepare-base
Alex Vandiver d49e73e087 test-install: Do not install rabbitmq in base install.
The installer does not adjust the node name if the rabbitmq already
exists, and the default node name bakes in the
`zulip-install-bionic-base` hostname.  As such, the resulting LXC
image does not properly start rabbitmq.

Remove rabbitmq, allowing the installer to install and configure it
with a nodename of `zulip@localhost`.  This also lets the installed
image be successfully copied and booted under a new hostname without
breaking rabbitmq.
2020-07-06 18:53:38 -07:00

66 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
if [ "$EUID" -ne 0 ]; then
echo "error: this script must be run as root" >&2
exit 1
fi
RELEASE="$1"
ARCH=amd64 # TODO: maybe i686 too
case "$RELEASE" in
bionic) extra_packages=(python-pip)
;;
focal) extra_packages=(python3-pip)
;;
*)
echo "error: unsupported target release: $RELEASE" >&2
exit 1
;;
esac
THIS_DIR="$(dirname "$(readlink -f "$0")")"
set -x
CONTAINER_NAME=zulip-install-$RELEASE-base
if ! lxc-info -n "$CONTAINER_NAME" >/dev/null 2>&1; then
lxc-create -n "$CONTAINER_NAME" -t download -- -d ubuntu -r "$RELEASE" -a "$ARCH"
fi
lxc-start -n "$CONTAINER_NAME"
"$THIS_DIR"/lxc-wait -n "$CONTAINER_NAME"
run() {
lxc-attach --clear-env -n "$CONTAINER_NAME" -- "$@"
}
run passwd -d root
run apt-get update
run apt-get dist-upgrade -y
# As an optimization, we install a bunch of packages the installer
# would install for itself.
run apt-get install -y --no-install-recommends \
xvfb parallel netcat unzip zip jq python3-pip wget curl eatmydata \
git crudini openssl ssl-cert \
build-essential python3-dev \
memcached redis-server \
hunspell-en-us supervisor libssl-dev puppet \
gettext libffi-dev libfreetype6-dev zlib1g-dev libjpeg-dev \
libldap2-dev libmemcached-dev \
libxml2-dev libxslt1-dev libpq-dev \
virtualenv \
"${extra_packages[@]}"
run ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
run locale-gen en_US.UTF-8 || true
echo "LC_ALL=en_US.UTF-8" | run tee /etc/default/locale
# TODO: on failure, either stop or print message
lxc-stop -n "$CONTAINER_NAME"