ci: Create Zulip server pre-installed docker image template.

These Docker images will be useful for testing the upgrade process
from previous Zulip major releases to master.

Fixes part of #18346.
This commit is contained in:
Gaurav Pandey 2021-06-02 23:05:03 +05:30 committed by Tim Abbott
parent 76f73ae787
commit 4ca87d785b
4 changed files with 64 additions and 13 deletions

View File

@ -0,0 +1,30 @@
# To build these production upgrade test images, say a Debian Buster system
# preinstalled with Zulip 3.4 (RELEASE=buster, VERSION=3.4):
# 0. $ tools/ci/generate-dockerfiles # Defined in tools/ci/images.yml
# 1. $ docker build tools/ci/images/$RELEASE-$VERSION/ --tag zulip/ci:$RELEASE-$VERSION
# 2. $ docker push zulip/ci:$RELEASE-$VERSION
FROM {base_image}
# Remove already existing rabbitmq mnesia directory files
RUN sudo rm -rf /var/lib/rabbitmq/mnesia/*
# The bionic hack used in production suite
RUN if [ -f /etc/os-release ]; then \
. /etc/os-release \
&& os_codename=$VERSION_CODENAME \
&& if [ "$os_codename" = "bionic" ]; then \
sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf; \
fi; \
fi
# Download the release tarball, start rabbitmq server and install the server
RUN cd $(mktemp -d) \
&& wget https://www.zulip.org/dist/releases/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
CMD ["/bin/sh"]

View File

@ -21,9 +21,9 @@
# then borrows from the CircleCI Dockerfile.
# To rebuild from this file for a given release, say bionic:
# 0. $ tools/ci/generate-dockerfiles
# 1. $ docker build tools/ci/images/$RELEASE/ --tag zulip/ci:$RELEASE
# 2. $ docker push zulip/ci:$RELEASE
# 1. $ tools/ci/generate-dockerfiles
# 2. $ docker build tools/ci/images/$RELEASE/ --tag zulip/ci:$RELEASE
# 3. $ docker push zulip/ci:$RELEASE
FROM {base_image}

View File

@ -10,10 +10,13 @@ if __name__ == "__main__":
with open("Dockerfile.template") as f:
docker_template = f.read()
with open("Dockerfile.prod.template") as p:
docker_prod_template = p.read()
with open("images.yml") as f:
dockerfile_settings = yaml.safe_load(f)
for distro in dockerfile_settings:
for distro in dockerfile_settings["distros"]:
dockerfile_path = f"images/{distro}/Dockerfile"
os.makedirs(os.path.dirname(dockerfile_path), exist_ok=True)
with open(dockerfile_path, "w") as f:
@ -24,4 +27,17 @@ if __name__ == "__main__":
"""
)
f.write(docker_template.format_map(dockerfile_settings[distro]))
f.write(docker_template.format_map(dockerfile_settings["distros"][distro]))
for server in dockerfile_settings["servers"]:
dockerfile_path = f"images/{server}/Dockerfile"
os.makedirs(os.path.dirname(dockerfile_path), exist_ok=True)
with open(dockerfile_path, "w") as f:
f.write(
"""\
# THIS IS A GENERATED FILE. DO NOT EDIT.
# See template: tools/ci/Dockerfile.prod.template
"""
)
f.write(docker_prod_template.format_map(dockerfile_settings["servers"][server]))

View File

@ -1,11 +1,16 @@
bionic:
distros:
bionic:
base_image: buildpack-deps:bionic-scm
focal:
focal:
base_image: buildpack-deps:focal-scm
buster:
buster:
base_image: buildpack-deps:buster-scm
bullseye:
bullseye:
base_image: buildpack-deps:bullseye-scm
servers:
buster-3.4:
base_image: zulip/ci:buster
version: 3.4