mirror of
https://github.com/zulip/zulip.git
synced 2026-06-30 21:11:04 +08:00
The production CI image starts `rabbitmq-server` but does not stop it,
which leaves a stale `/var/run/rabbitmq/pid` file in the image.
`rabbitmqctl wait --timeout 600 /var/run/rabbitmq/pid`, which is run
after starting the rabbitmq node, reads the PID file and waits for the
PID to be running, and for rabbitmq's port to be responding to pings.
If it reads an old PID file before the new PID is written, it
aborts (all but the first and last lines are output from `rabbitmqctl
wait` that is hidden by `/etc/init.d/rabbitmq-server`):
```
* Starting RabbitMQ Messaging Server rabbitmq-server
Waiting for pid file '/var/run/rabbitmq/pid' to appear
pid is 341
Waiting for erlang distribution on node 'rabbit@fc8f64d6acdb' while OS process '341' is running
Error:
process_not_running
* FAILED - check /var/log/rabbitmq/startup_\{log, _err\}
```
If it failed, the `production-upgrade` script tried to start
`rabbitmq` again -- despite it already still starting in the
background. These two attempts conflicted, and often one or both
failed.
Stop `rabbitmq-server` when building the image, which removes the
stale PID file.
23 lines
921 B
Docker
23 lines
921 B
Docker
# To build these production upgrade test images, say an Ubuntu 20.04 Focal system
|
|
# preinstalled with Zulip 3.4:
|
|
# docker build . -f Dockerfile.prod --build-arg=BASE_IMAGE=zulip/ci:focal --build-arg=VERSION=3.4 --tag=zulip/ci:focal-3.4
|
|
# docker push zulip/ci:focal-3.4
|
|
|
|
ARG 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
|
|
ARG VERSION
|
|
RUN cd $(mktemp -d) \
|
|
&& curl -fLO "https://download.zulip.com/server/zulip-server-$VERSION.tar.gz" \
|
|
&& tar -xf "zulip-server-$VERSION.tar.gz" \
|
|
&& sudo service rabbitmq-server start \
|
|
&& sudo service rabbitmq-server status \
|
|
&& sudo -s "./zulip-server-$VERSION/scripts/setup/install" --self-signed-cert --hostname 127.0.0.1 --email circleci@example.com \
|
|
&& sudo service rabbitmq-server stop
|
|
|
|
CMD ["/bin/sh"]
|