snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
1
tools/ci/.gitattributes
vendored
Normal file
1
tools/ci/.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
success-http-headers.template.txt eol=crlf
|
||||
39
tools/ci/Docker-prod-8.0.diff
Normal file
39
tools/ci/Docker-prod-8.0.diff
Normal file
@@ -0,0 +1,39 @@
|
||||
diff --git scripts/setup/apt-repos/zulip/custom.sh scripts/setup/apt-repos/zulip/custom.sh
|
||||
index be7c780b7e..ee363c7d65 100755
|
||||
--- scripts/setup/apt-repos/zulip/custom.sh
|
||||
+++ scripts/setup/apt-repos/zulip/custom.sh
|
||||
@@ -2,7 +2,6 @@
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ! -e /usr/share/doc/groonga-apt-source/copyright ]]; then
|
||||
- arrow_keyring=$(readlink -f "$LIST_PATH/apache-arrow-keyring.gpg")
|
||||
pgroonga_apt_sign_key=$(readlink -f "$LIST_PATH/pgroonga-packages.groonga.org.asc")
|
||||
|
||||
remove_pgroonga_apt_tmp_dir() {
|
||||
@@ -28,16 +27,6 @@ if [[ ! -e /usr/share/doc/groonga-apt-source/copyright ]]; then
|
||||
read -r release
|
||||
} <<<"$os_info"
|
||||
|
||||
- if [ "$distribution" = debian ] && [ "$release" = bookworm ]; then
|
||||
- # As of Debian 12, the Groonga repository depends on the
|
||||
- # Apache Arrow repository.
|
||||
- arrow_apt_source_deb="apache-arrow-apt-source-latest-$release.deb"
|
||||
- arrow_apt_source_deb_sign="$arrow_apt_source_deb.asc"
|
||||
- curl -fLO --retry 3 "https://apache.jfrog.io/artifactory/arrow/$distribution/$arrow_apt_source_deb"
|
||||
- curl -fLO --retry 3 "https://apache.jfrog.io/artifactory/arrow/$distribution/$arrow_apt_source_deb_sign"
|
||||
- gpgv --keyring="$arrow_keyring" "$arrow_apt_source_deb_sign" "$arrow_apt_source_deb"
|
||||
- fi
|
||||
-
|
||||
groonga_apt_source_deb="groonga-apt-source-latest-$release.deb"
|
||||
groonga_apt_source_deb_sign="$groonga_apt_source_deb.asc.$pgroonga_apt_sign_key_fingerprint"
|
||||
curl -fLO --retry 3 "https://packages.groonga.org/$distribution/$groonga_apt_source_deb"
|
||||
@@ -53,9 +42,6 @@ if [[ ! -e /usr/share/doc/groonga-apt-source/copyright ]]; then
|
||||
# accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
|
||||
chown _apt .
|
||||
|
||||
- if [ "$distribution" = debian ] && [ "$release" = bookworm ]; then
|
||||
- apt-get -y install "./$arrow_apt_source_deb"
|
||||
- fi
|
||||
apt-get -y install "./$groonga_apt_source_deb"
|
||||
}
|
||||
touch "$STAMP_FILE"
|
||||
65
tools/ci/Dockerfile
Normal file
65
tools/ci/Dockerfile
Normal file
@@ -0,0 +1,65 @@
|
||||
# Dockerfile for a generic Debian/Ubuntu image with just the basics we
|
||||
# need to make it suitable for CI. In particular:
|
||||
# * a non-root user to run as (a pain to try to do in setup,
|
||||
# because by then we've already cloned the repo);
|
||||
# * Git and other basic utilities.
|
||||
|
||||
# To rebuild from this file for a given release, say Ubuntu 22.04 jammy:
|
||||
# docker build . --build-arg=BASE_IMAGE=ubuntu:22.04 --pull --tag=zulip/ci:jammy
|
||||
# docker push zulip/ci:jammy
|
||||
#
|
||||
# tools/ci/build-docker-images will rebuild all images, but not push them.
|
||||
|
||||
ARG BASE_IMAGE
|
||||
# Pin to linux/amd64 so builds on Apple Silicon (or other non-amd64
|
||||
# hosts) still produce images compatible with our GitHub Actions runners.
|
||||
FROM --platform=linux/amd64 $BASE_IMAGE
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
|
||||
|
||||
# Set the locale.
|
||||
ENV LC_ALL C.UTF-8
|
||||
|
||||
# Extra packages used by Zulip.
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gettext \
|
||||
git \
|
||||
hunspell-en-us \
|
||||
jq \
|
||||
libffi-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
libldap2-dev \
|
||||
libpq-dev \
|
||||
libssl-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
locales \
|
||||
memcached \
|
||||
moreutils \
|
||||
puppet \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
# 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 \
|
||||
sudo \
|
||||
supervisor \
|
||||
unzip \
|
||||
xvfb \
|
||||
zlib1g-dev
|
||||
|
||||
ARG USERNAME=github
|
||||
RUN groupadd --gid 1001 $USERNAME \
|
||||
&& useradd --uid 1001 --gid $USERNAME --shell /bin/bash --create-home $USERNAME \
|
||||
&& echo "$USERNAME ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers.d/50-$USERNAME \
|
||||
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
|
||||
|
||||
USER $USERNAME
|
||||
|
||||
CMD ["/bin/sh"]
|
||||
25
tools/ci/Dockerfile.prod
Normal file
25
tools/ci/Dockerfile.prod
Normal file
@@ -0,0 +1,25 @@
|
||||
# To build these production upgrade test images, say an Debian 12 Bookworm system
|
||||
# preinstalled with Zulip 7.0:
|
||||
# docker build --pull . -f Dockerfile.prod \
|
||||
# --build-arg=BASE_IMAGE=zulip/ci:bookworm \
|
||||
# --build-arg=VERSION=7.0 \
|
||||
# --tag=zulip/ci:bookworm-7.0
|
||||
# docker push zulip/ci:bookworm-7.0
|
||||
|
||||
ARG BASE_IMAGE
|
||||
# See tools/ci/Dockerfile for why we pin to linux/amd64.
|
||||
FROM --platform=linux/amd64 $BASE_IMAGE
|
||||
|
||||
# Download the release tarball, start rabbitmq server and install the server
|
||||
ARG VERSION
|
||||
ADD Docker-prod-8.0.diff /tmp
|
||||
RUN cd $(mktemp -d) \
|
||||
&& curl -fLO --retry 3 "https://download.zulip.com/server/zulip-server-$VERSION.tar.gz" \
|
||||
&& tar -xf "zulip-server-$VERSION.tar.gz" \
|
||||
&& if [ "$VERSION" = "8.0" ]; then \
|
||||
cat /tmp/Docker-prod-8.0.diff | patch -p0 -d "zulip-server-$VERSION"; \
|
||||
fi \
|
||||
&& sudo -s "./zulip-server-$VERSION/scripts/setup/install" --self-signed-cert --hostname 127.0.0.1 --email ci@example.com \
|
||||
&& sudo service rabbitmq-server stop
|
||||
|
||||
CMD ["/bin/sh"]
|
||||
6
tools/ci/activate-venv
Normal file
6
tools/ci/activate-venv
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ZULIP_PATH="$(dirname "${BASH_SOURCE[0]}")/../.."
|
||||
source "$ZULIP_PATH/.venv/bin/activate"
|
||||
source "$ZULIP_PATH"/tools/python-warnings.bash
|
||||
echo "Using $VIRTUAL_ENV"
|
||||
8
tools/ci/build-docker-images
Executable file
8
tools/ci/build-docker-images
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eux
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
docker build . --build-arg=BASE_IMAGE=ubuntu:22.04 --pull --tag=zulip/ci:jammy
|
||||
docker build . --build-arg=BASE_IMAGE=ubuntu:24.04 --pull --tag=zulip/ci:noble
|
||||
docker build . --build-arg=BASE_IMAGE=ubuntu:26.04 --pull --tag=zulip/ci:resolute
|
||||
docker build . --build-arg=BASE_IMAGE=debian:12 --pull --tag=zulip/ci:bookworm
|
||||
docker build . --build-arg=BASE_IMAGE=debian:13 --pull --tag=zulip/ci:trixie
|
||||
9
tools/ci/check-executables
Executable file
9
tools/ci/check-executables
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
files="$(git ls-tree -r @ | sed -n 's/^100755 blob \S\+\t//p' | xargs -r grep -Lz '^#!' --)" || [ $? = 123 ]
|
||||
if [ "$files" ]; then
|
||||
echo 'error: non-scripts should not be marked executable (fix with chmod -x):'
|
||||
echo
|
||||
printf '%s\n' "$files"
|
||||
exit 1
|
||||
fi
|
||||
22
tools/ci/generate-failure-message
Executable file
22
tools/ci/generate-failure-message
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def get_build_url_from_environment() -> str:
|
||||
server = os.environ["GITHUB_SERVER_URL"]
|
||||
repo = os.environ["GITHUB_REPOSITORY"]
|
||||
run_id = os.environ["GITHUB_RUN_ID"]
|
||||
return f"{server}/{repo}/actions/runs/{run_id}"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
branch = os.environ.get("GITHUB_REF", "unknown branch").split("/")[-1]
|
||||
topic = f"{branch} failing"
|
||||
build_url = get_build_url_from_environment()
|
||||
github_actor = os.environ.get("GITHUB_ACTOR", "unknown user")
|
||||
content = f"[Build]({build_url}) triggered by {github_actor} on branch `{branch}` has failed."
|
||||
|
||||
# Output in the key-value pair format GitHub Actions outputs are expected
|
||||
# to be in.
|
||||
print(f"topic={topic}\ncontent={content}")
|
||||
53
tools/ci/production-build
Executable file
53
tools/ci/production-build
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
# In short, this provisions a Zulip development environment and then
|
||||
# builds a Zulip release tarball (the same way we build them for an
|
||||
# actual release). The actual test job will then install that.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Provisioning may fail due to many issues but most of the times a network
|
||||
# connection issue is the reason. So we are going to retry entire provisioning
|
||||
# once again if that fixes our problem.
|
||||
tools/provision --build-release-tarball-only || {
|
||||
ret=$?
|
||||
if [ "$ret" = 1 ]; then
|
||||
echo "\`provision\`: Something went wrong with the provisioning, might be a network issue, Retrying to provision..."
|
||||
tools/provision --build-release-tarball-only
|
||||
else
|
||||
echo "\`provision\`: Something REALLY BAD went wrong with the provisioning, not retrying."
|
||||
exit "$ret"
|
||||
fi
|
||||
}
|
||||
|
||||
source tools/ci/activate-venv
|
||||
|
||||
if ! ./tools/build-release-tarball test; then
|
||||
echo "Attempting to output failure logging data"
|
||||
cat /tmp/tmp.*/update-prod-static.log || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Move all the required artifacts to /tmp/production-build
|
||||
# that will be later sent down to downstream install jobs.
|
||||
mkdir /tmp/production-build
|
||||
mv /tmp/tmp.*/zulip-server-test.tar.gz /tmp/production-build
|
||||
cp -a \
|
||||
tools/ci/success-http-headers.template.txt \
|
||||
tools/ci/production-install \
|
||||
tools/ci/production-verify \
|
||||
tools/ci/production-upgrade \
|
||||
tools/ci/production-pgroonga \
|
||||
tools/ci/production-upgrade-pg \
|
||||
tools/ci/generate-failure-message \
|
||||
package.json pnpm-lock.yaml \
|
||||
/tmp/production-build
|
||||
|
||||
# Check that webpack bundles use only ES2022 syntax.
|
||||
# Use the pnpm binary installed by tools/provision.
|
||||
PNPM="/usr/local/bin/pnpm"
|
||||
tar -C /tmp -xzf /tmp/production-build/zulip-server-test.tar.gz zulip-server-test/prod-static/serve/webpack-bundles
|
||||
(
|
||||
GLOBIGNORE="/tmp/zulip-server-test/prod-static/serve/webpack-bundles/katex*.js"
|
||||
"$PNPM" exec es-check es2022 /tmp/zulip-server-test/prod-static/serve/webpack-bundles/*.js
|
||||
)
|
||||
93
tools/ci/production-install
Executable file
93
tools/ci/production-install
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
# This test installs a Zulip production environment (from the release
|
||||
# tarball from production-build).
|
||||
set -e
|
||||
set -x
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
production-install
|
||||
production-install --test-custom-db
|
||||
production-install --help
|
||||
|
||||
Options:
|
||||
--test-custom-db
|
||||
This will instruct the install test to be run with a custom database name and user.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Shell option parsing.
|
||||
args="$(getopt -o '' --long help,test-custom-db -n "$0" -- "$@")"
|
||||
eval "set -- $args"
|
||||
while true; do
|
||||
case "$1" in
|
||||
--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--test-custom-db)
|
||||
TEST_CUSTOM_DB=1
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
ZULIP_PATH=/root/zulip-latest
|
||||
mkdir -p "$ZULIP_PATH"
|
||||
tar -xf /tmp/zulip-server-test.tar.gz -C "$ZULIP_PATH" --strip-components=1
|
||||
|
||||
# Disable interactive prompts from apt.
|
||||
echo 'Dpkg::Options { "--force-confdef" "--force-confold" }' >/etc/apt/apt.conf.d/noninteractive
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Do an apt upgrade to start with an up-to-date machine
|
||||
apt-get update
|
||||
|
||||
if ! apt-get dist-upgrade -y; then
|
||||
echo "\`apt-get dist-upgrade\`: Failure occurred while trying to perform distribution upgrade, Retrying..."
|
||||
apt-get dist-upgrade -y
|
||||
fi
|
||||
|
||||
os_info="$(
|
||||
. /etc/os-release
|
||||
printf '%s\n' "$ID" "$VERSION_ID"
|
||||
)"
|
||||
{
|
||||
read -r os_id
|
||||
read -r os_version_id
|
||||
} <<<"$os_info"
|
||||
|
||||
# Pin PostgreSQL on Ubuntu 22.04, so we can test upgrading it
|
||||
if [ "$os_id $os_version_id" = 'ubuntu 22.04' ]; then
|
||||
export POSTGRESQL_VERSION=14
|
||||
fi
|
||||
|
||||
# Install
|
||||
if [ -z "$TEST_CUSTOM_DB" ]; then
|
||||
echo "Testing production install with default database name and user."
|
||||
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email ci@example.com
|
||||
else
|
||||
echo "Testing production install with custom database name and user."
|
||||
"$ZULIP_PATH"/scripts/setup/install --self-signed-cert --hostname 127.0.0.1 --email ci@example.com --postgresql-database-user zulipcustomuser --postgresql-database-name zulipcustomdb
|
||||
fi
|
||||
|
||||
if [ -n "${POSTGRESQL_VERSION:-}" ]; then
|
||||
if [ "$(crudini --get /etc/zulip/zulip.conf postgresql version)" != "$POSTGRESQL_VERSION" ]; then
|
||||
echo "Installer did not install the PostgreSQL $POSTGRESQL_VERSION that we asked for!"
|
||||
exit 1
|
||||
fi
|
||||
if ! su - zulip -c "psql -tc 'select version()'" | grep -q "^ PostgreSQL $POSTGRESQL_VERSION\."; then
|
||||
echo "Installed PostgreSQL is not actually PostgreSQL $POSTGRESQL_VERSION!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Production installation complete!"
|
||||
exit 0
|
||||
14
tools/ci/production-pgroonga
Normal file
14
tools/ci/production-pgroonga
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# This tests installing the pgroonga extension
|
||||
set -e
|
||||
set -x
|
||||
|
||||
crudini --set /etc/zulip/zulip.conf machine pgroonga enabled
|
||||
/home/zulip/deployments/current/scripts/zulip-puppet-apply -f
|
||||
echo 'USING_PGROONGA = True' >>/etc/zulip/settings.py
|
||||
su zulip -c '/home/zulip/deployments/current/manage.py migrate pgroonga'
|
||||
|
||||
su zulip -c /home/zulip/deployments/current/scripts/restart-server
|
||||
|
||||
echo 'Installation of pgroonga complete!'
|
||||
exit 0
|
||||
33
tools/ci/production-upgrade
Normal file
33
tools/ci/production-upgrade
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Given a Zulip production environment that had been installed with a
|
||||
# previous version of Zulip, upgrade it to the commit being tested.
|
||||
# This takes as input the tarball generated by production-build.
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Start the services that would be running on a working Zulip host;
|
||||
# since this is a container, these services are not started
|
||||
# automatically.
|
||||
|
||||
# Start the postgresql service.
|
||||
sudo service postgresql start
|
||||
|
||||
# Starting the rabbitmq-server
|
||||
epmd -daemon
|
||||
sudo service rabbitmq-server start
|
||||
|
||||
# Start the supervisor
|
||||
sudo service supervisor start
|
||||
|
||||
# Disable interactive prompts from apt.
|
||||
echo 'Dpkg::Options { "--force-confdef" "--force-confold" }' >/etc/apt/apt.conf.d/noninteractive
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Zulip releases before 2.1.8/3.5/4.4 have a bug in their
|
||||
# `upgrade-zulip` scripts, resulting in them exiting with status 0
|
||||
# unconditionally. We work around that by running
|
||||
# scripts/lib/upgrade-zulip instead.
|
||||
UPGRADE_SCRIPT=/home/zulip/deployments/current/scripts/lib/upgrade-zulip
|
||||
|
||||
# Execute the upgrade.
|
||||
sudo "$UPGRADE_SCRIPT" /tmp/zulip-server-test.tar.gz
|
||||
11
tools/ci/production-upgrade-pg
Executable file
11
tools/ci/production-upgrade-pg
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# This tests upgrading PostgreSQL
|
||||
set -e
|
||||
set -x
|
||||
|
||||
su zulip -c /home/zulip/deployments/current/scripts/stop-server
|
||||
/home/zulip/deployments/current/scripts/setup/upgrade-postgresql
|
||||
su zulip -c /home/zulip/deployments/current/scripts/start-server
|
||||
|
||||
echo "Upgrade of PostgreSQL complete!"
|
||||
exit 0
|
||||
178
tools/ci/production-verify
Executable file
178
tools/ci/production-verify
Executable file
@@ -0,0 +1,178 @@
|
||||
#!/usr/bin/env bash
|
||||
# This tests a Zulip production environment (installed via
|
||||
# production-install) with some Nagios checks and other tools to
|
||||
# verify that everything is working properly.
|
||||
set -e
|
||||
set -x
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
production-verify
|
||||
production-verify --test-custom-db
|
||||
production-verify --help
|
||||
|
||||
Options:
|
||||
--test-custom-db
|
||||
Use custom database and user names.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Shell option parsing.
|
||||
args="$(getopt -o '' --long help,test-custom-db -n "$0" -- "$@")"
|
||||
eval "set -- $args"
|
||||
NAGIOS_USER="zulip"
|
||||
while true; do
|
||||
case "$1" in
|
||||
--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--test-custom-db)
|
||||
NAGIOS_USER="zulipcustomuser"
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
. /etc/os-release
|
||||
os_info="$(
|
||||
. /etc/os-release
|
||||
printf '%s\n' "$ID" "$VERSION_ID"
|
||||
)"
|
||||
{
|
||||
read -r os_id
|
||||
read -r os_version_id
|
||||
} <<<"$os_info"
|
||||
|
||||
cat >>/etc/zulip/settings.py <<EOF
|
||||
# CircleCI override settings above
|
||||
AUTHENTICATION_BACKENDS = ( 'zproject.backends.EmailAuthBackend', )
|
||||
NOREPLY_EMAIL_ADDRESS = 'noreply@example.com'
|
||||
ALLOWED_HOSTS = []
|
||||
EOF
|
||||
|
||||
check_header() {
|
||||
if ! sed "s|{nginx_version_string}|$nginx_version|g" "$success_header_file" \
|
||||
| diff -ur - /tmp/http-headers-processed; then
|
||||
set +x
|
||||
echo
|
||||
echo "FAILURE: The HTTP headers returned from loading the homepage on the server do not match the contents of tools/ci/success-http-headers.template.txt. Typically, this means that the server threw a 500 when trying to load the homepage."
|
||||
echo "Displaying the contents of the server's error log:"
|
||||
echo
|
||||
cat /var/log/zulip/errors.log
|
||||
echo
|
||||
echo "Displaying the contents of the main server log:"
|
||||
echo
|
||||
cat /var/log/zulip/server.log
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo
|
||||
echo "Now testing that the supervisord jobs are running properly"
|
||||
echo
|
||||
sleep 15 # Guaranteed to have a working supervisord process get an extra digit
|
||||
if supervisorctl status | grep -vq RUNNING || supervisorctl status | sed 's/^.*uptime //' | grep -q 0:00:0; then
|
||||
set +x
|
||||
echo
|
||||
echo "FAILURE: Supervisor output shows daemons are crashing:"
|
||||
echo
|
||||
supervisorctl status
|
||||
echo
|
||||
echo "DEBUG: printing Zulip server's error log:"
|
||||
cat /var/log/zulip/errors.log
|
||||
echo
|
||||
echo "DEBUG: printing Zulip server's workers log:"
|
||||
cat /var/log/zulip/workers.log
|
||||
echo
|
||||
echo "DEBUG: printing Zulip server's tornado log:"
|
||||
cat /var/log/zulip/tornado.log
|
||||
echo
|
||||
echo "DEBUG: printing process_fts_updates log:"
|
||||
cat /var/log/zulip/fts-updates.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO: Ideally this would test actually logging in, but this is a start.
|
||||
echo
|
||||
echo "Now testing that the newly installed server's settings endpoint loads"
|
||||
echo
|
||||
|
||||
curl -ILk https://localhost/api/v1/server_settings -o /tmp/http-headers
|
||||
grep -vi -e '^content-length:' -e '^date:' -e '^expires:' -e '^set-cookie:' /tmp/http-headers >/tmp/http-headers-processed
|
||||
|
||||
nginx_version="$(nginx -v 2>&1)"
|
||||
nginx_version="${nginx_version#nginx version: }"
|
||||
case "$os_id $os_version_id" in
|
||||
'ubuntu 22.04' | 'ubuntu 24.04')
|
||||
;;
|
||||
*)
|
||||
nginx_version="${nginx_version% (*)}"
|
||||
;;
|
||||
esac
|
||||
success_header_file="/tmp/success-http-headers.template.txt"
|
||||
check_header
|
||||
|
||||
# Start the RabbitMQ queue worker related section
|
||||
echo
|
||||
echo "Now confirming all the RabbitMQ queue processors are correctly registered!"
|
||||
echo
|
||||
# These hacky shell scripts just extract the sorted list of queue processors, running and expected
|
||||
supervisorctl status | cut -f1 -dR | cut -f2- -d: | grep events | cut -f1 -d" " | cut -f3- -d_ | cut -f1 -d- | sort -u >/tmp/running_queue_processors.txt
|
||||
su zulip -c /home/zulip/deployments/current/scripts/lib/queue_workers.py | sort -u >/tmp/expected_queue_processors.txt
|
||||
if ! diff /tmp/expected_queue_processors.txt /tmp/running_queue_processors.txt >/dev/null; then
|
||||
set +x
|
||||
echo "FAILURE: Runnable queue processors declared in zerver/worker/queue_processors.py "
|
||||
echo "do not match those in puppet/zulip/manifests/profile/base.pp"
|
||||
echo "See https://zulip.readthedocs.io/en/latest/subsystems/queuing.html for details."
|
||||
echo
|
||||
diff -ur /tmp/expected_queue_processors.txt /tmp/running_queue_processors.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Now running RabbitMQ consumer Nagios tests"
|
||||
echo
|
||||
# First run the check that usually runs in cron and populates the state files
|
||||
/home/zulip/deployments/current/scripts/nagios/check-rabbitmq-consumers
|
||||
|
||||
# Then, compute the list of all Django queue workers to run Nagios checks against
|
||||
consumer_list=$(/home/zulip/deployments/current/scripts/lib/queue_workers.py --queue-type=consumer)
|
||||
for consumer in $consumer_list; do
|
||||
if ! /usr/lib/nagios/plugins/zulip_app_frontend/check_cron_file "/var/lib/nagios_state/check-rabbitmq-consumers-$consumer"; then
|
||||
set +x
|
||||
echo
|
||||
echo "FAILURE: Missing Nagios consumer for $consumer; displaying full consumer output:"
|
||||
set -x
|
||||
rabbitmqctl list_consumers
|
||||
supervisorctl status
|
||||
tail -n +1 /var/log/zulip/events*.log
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Some of the Nagios tests have been temporarily disabled to work
|
||||
# around a Travis CI infrastructure issue.
|
||||
echo
|
||||
echo "Now running additional Nagios tests"
|
||||
echo
|
||||
if ! /usr/lib/nagios/plugins/zulip_app_frontend/check_queue_worker_errors \
|
||||
|| ! su zulip -c "/usr/local/bin/process_fts_updates --nagios-check --nagios-user=$NAGIOS_USER"; then # || \
|
||||
# ! su zulip -c "/usr/lib/nagios/plugins/zulip_app_frontend/check_send_receive_time --site=https://127.0.0.1/api --nagios --insecure"; then
|
||||
set +x
|
||||
echo
|
||||
echo "FAILURE: Nagios checks don't pass:"
|
||||
echo
|
||||
echo "DEBUG: printing Zulip server's error log:"
|
||||
cat /var/log/zulip/errors.log
|
||||
exit 1
|
||||
fi
|
||||
echo "Production installation test successful!"
|
||||
exit 0
|
||||
21
tools/ci/setup-backend
Executable file
21
tools/ci/setup-backend
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
ZULIP_PATH="$(dirname "${BASH_SOURCE[0]}")/../.."
|
||||
. "$ZULIP_PATH/tools/python-warnings.bash"
|
||||
|
||||
# This is just a thin wrapper around provision.
|
||||
# Provisioning may fail due to many issues but most of the times a network
|
||||
# connection issue is the reason. So we are going to retry entire provisioning
|
||||
# once again if that fixes our problem.
|
||||
tools/provision "$@" || {
|
||||
ret=$?
|
||||
if [ "$ret" = 1 ]; then
|
||||
echo "\`provision\`: Something went wrong with the provisioning, might be a network issue, Retrying to provision..."
|
||||
tools/provision
|
||||
else
|
||||
echo "\`provision\`: Something REALLY BAD went wrong with the provisioning, not retrying."
|
||||
exit "$ret"
|
||||
fi
|
||||
}
|
||||
1
tools/ci/setup-frontend
Symbolic link
1
tools/ci/setup-frontend
Symbolic link
@@ -0,0 +1 @@
|
||||
setup-backend
|
||||
15
tools/ci/success-http-headers.template.txt
Normal file
15
tools/ci/success-http-headers.template.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
HTTP/2 200
|
||||
server: {nginx_version_string}
|
||||
content-type: application/json
|
||||
vary: Accept-Encoding
|
||||
vary: Accept-Language, Cookie
|
||||
content-language: en
|
||||
strict-transport-security: max-age=31536000; includeSubdomains; preload
|
||||
x-frame-options: DENY
|
||||
x-content-type-options: nosniff
|
||||
referrer-policy: strict-origin-when-cross-origin
|
||||
cross-origin-opener-policy: same-origin
|
||||
access-control-allow-origin: *
|
||||
access-control-allow-headers: Authorization
|
||||
access-control-allow-methods: GET, POST, DELETE, PUT, PATCH, HEAD
|
||||
|
||||
Reference in New Issue
Block a user