ci: Do not pre-install rabbitmq-server in Docker images.

Before Zulip 4.9, the Zulip install process left any already-installed
rabbitmq with whatever nodename it had previously configured.  Wince
this encodes the name of the host when it was installed, this does not
function well with containers.

Leave rabbitmq-server uninstalled, which lets the Zulip installation
process set the nodename to `localhost`, which ensures that it is
usable across container restarts.
This commit is contained in:
Alex Vandiver 2021-11-29 13:53:18 -08:00 committed by Alex Vandiver
parent b161cba078
commit 63d2565467
4 changed files with 9 additions and 26 deletions

View File

@ -176,9 +176,7 @@ jobs:
restore-keys: v1-yarn-deps-${{ matrix.os }} restore-keys: v1-yarn-deps-${{ matrix.os }}
- name: Install production - name: Install production
run: | run: sudo /tmp/production-install ${{ matrix.extra-args }}
sudo service rabbitmq-server restart
sudo /tmp/production-install ${{ matrix.extra-args }}
- name: Verify install - name: Verify install
run: sudo /tmp/production-verify ${{ matrix.extra-args }} run: sudo /tmp/production-verify ${{ matrix.extra-args }}

View File

@ -42,7 +42,9 @@ RUN apt-get update \
puppet \ puppet \
python3-dev \ python3-dev \
python3-pip \ python3-pip \
rabbitmq-server \ # We do not pre-install rabbitmq-server, as doing so fixes the
# nodename to be the current hostname, which varies. Letting Zulip
# install rabbitmq allows it to fix the nodename to 'localhost'.
redis-server \ redis-server \
sudo \ sudo \
supervisor \ supervisor \

View File

@ -9,16 +9,11 @@
ARG BASE_IMAGE ARG BASE_IMAGE
FROM $BASE_IMAGE FROM $BASE_IMAGE
# Remove already existing rabbitmq mnesia directory files
RUN sudo rm -rf /var/lib/rabbitmq/mnesia/*
# Download the release tarball, start rabbitmq server and install the server # Download the release tarball, start rabbitmq server and install the server
ARG VERSION ARG VERSION
RUN cd $(mktemp -d) \ RUN cd $(mktemp -d) \
&& curl -fLO "https://download.zulip.com/server/zulip-server-$VERSION.tar.gz" \ && curl -fLO "https://download.zulip.com/server/zulip-server-$VERSION.tar.gz" \
&& tar -xf "zulip-server-$VERSION.tar.gz" \ && tar -xf "zulip-server-$VERSION.tar.gz" \
&& sudo service rabbitmq-server start \
&& sudo service rabbitmq-server status \
# Version 3.4 predates ddb9d16132a6336b384bf674c4c950cd75d83e5c and 9d57fa97597ec176a8357d6620ab9e670ee19f4e # Version 3.4 predates ddb9d16132a6336b384bf674c4c950cd75d83e5c and 9d57fa97597ec176a8357d6620ab9e670ee19f4e
&& perl -pi -e 's/pgrep -f epmd/which pgrep && pgrep -x epmd/' zulip-server-$VERSION/puppet/zulip/manifests/rabbit.pp \ && perl -pi -e 's/pgrep -f epmd/which pgrep && pgrep -x epmd/' zulip-server-$VERSION/puppet/zulip/manifests/rabbit.pp \
&& sudo -s "./zulip-server-$VERSION/scripts/setup/install" --self-signed-cert --hostname 127.0.0.1 --email ci@example.com \ && sudo -s "./zulip-server-$VERSION/scripts/setup/install" --self-signed-cert --hostname 127.0.0.1 --email ci@example.com \

View File

@ -5,28 +5,16 @@
set -e set -e
set -x set -x
# Structurally, this script should just call upgrade-zulip. However, # Start the services that would be running on a working Zulip host;
# because of a set of issues that result in the previously installed # since this is a container, these services are not started
# GitHub Actions Docker containers not actually working on boot, we # automatically.
# need to do some preparatory steps. It is a goal to delete these
# steps.
# Reinstall rabbitmq-server.
#
# * For rabbitmq-server, we likely need to do this to work around the
# hostname changing on reboot causing RabbitMQ to not boot.
sudo apt-get -y purge rabbitmq-server
sudo apt-get -y install rabbitmq-server
# Start the postgresql service. # Start the postgresql service.
sudo service postgresql start sudo service postgresql start
# Starting the rabbitmq-server # Starting the rabbitmq-server
if ! sudo service rabbitmq-server start; then epmd -daemon
echo sudo service rabbitmq-server start
echo "Starting rabbitmq-server failed. Trying again:"
sudo service rabbitmq-server start
fi
# Start the supervisor # Start the supervisor
sudo service supervisor start sudo service supervisor start