mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
This file hasn't reflected the actual configuration of any live installation for some time, nor been part of any tests or other mechanism to regularly validate it, so it's naturally fallen behind as we make changes to the set of settings and typically don't update this file accordingly. Just remove it; all the documentation functions it serves are already served just as well by prod_settings_template.py and its ample comments.
128 lines
3.4 KiB
Bash
Executable File
128 lines
3.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eux
|
|
|
|
usage() {
|
|
echo "Usage: $0 [--py3] <ZULIP_VERSION>" >&2
|
|
exit 1
|
|
}
|
|
|
|
args="$(getopt -o '' -l 'py3' -n "$0" -- "$@")"
|
|
eval "set -- $args"
|
|
|
|
py3=
|
|
while true; do
|
|
case "$1" in
|
|
--py3) py3=t; shift;;
|
|
--) shift; break;;
|
|
*) usage;;
|
|
esac
|
|
done
|
|
|
|
GITID=$(git rev-parse HEAD)
|
|
|
|
if [ -z "${1:-}" ]; then
|
|
usage
|
|
fi
|
|
version="$1"
|
|
prefix="zulip-server-$version"
|
|
|
|
if [ "$(uname)" = "Darwin" ]; then
|
|
TMPDIR=/tmp/voyager-build
|
|
rm -Rf "$TMPDIR"
|
|
mkdir -p "$TMPDIR"
|
|
else
|
|
TMPDIR=$(mktemp -d)
|
|
fi
|
|
|
|
if ! git diff --exit-code >/dev/null; then
|
|
set +x
|
|
echo "ERROR: tarballs builds are based on a commit hash so your changes "
|
|
echo "will not be included; you should commit or stash them based on "
|
|
echo "what you want and then try again."
|
|
echo
|
|
exit 1
|
|
fi
|
|
|
|
TMP_CHECKOUT=$TMPDIR/$prefix/
|
|
TARBALL=$TMPDIR/$prefix.tar
|
|
|
|
# .gitattributes lists the files that are not exported
|
|
git archive -o "$TARBALL" "--prefix=$prefix/" HEAD
|
|
|
|
|
|
if tar -tf "$TARBALL" | grep -q -e zilencer -e puppet/zulip_internal; then
|
|
echo "Excluded files remain in tarball!";
|
|
echo "Versions of git 1.8.1.1 - 1.8.1.6 have broken .gitattributes syntax";
|
|
exit 1;
|
|
else
|
|
echo "Check for excluded files passed";
|
|
fi
|
|
|
|
if [ "$py3" ]; then
|
|
tools/replace-tarball-shebang \
|
|
'#!/usr/bin/env python' '#!/usr/bin/env python3' \
|
|
< "$TARBALL" > "$TARBALL.new"
|
|
mv "$TARBALL.new" "$TARBALL"
|
|
fi
|
|
|
|
# Check out a temporary full copy of the index to generate static files
|
|
git checkout-index -f -a --prefix "$TMP_CHECKOUT"
|
|
cd "$TMP_CHECKOUT"
|
|
|
|
# create var/log directory in the new temporary checkout
|
|
mkdir -p "var/log"
|
|
|
|
# Some settings need to be updated for update-prod-static to work
|
|
#
|
|
# TODO: Would be much better to instead run the below tools with some
|
|
# sort of environment hack to make settings.VOYAGER=True so that we
|
|
# don't need to create this dummy secrets file.
|
|
cat >> zproject/prod_settings_template.py <<EOF
|
|
DEBUG = False
|
|
EOF
|
|
cat >> zproject/dev-secrets.conf <<EOF
|
|
[secrets]
|
|
local_database_password = ''
|
|
secret_key = 'not_used_here'
|
|
shared_secret = 'not_used_here'
|
|
avatar_salt = 'not_used_here'
|
|
rabbitmq_password = 'not_used_here'
|
|
initial_password_salt = 'not_used_here'
|
|
EOF
|
|
|
|
# update-prod-static generates the prod-static directory.
|
|
# See COLLECTSTATIC in settings.py
|
|
set +x
|
|
# We do a bit of gymnastics to have update-prod-static.log be easily
|
|
# visible to the user and end up in the same directory as the final
|
|
# release tarball.
|
|
USER_PROD_STATIC_LOGPATH="${TMPDIR}/update-prod-static.log"
|
|
BUILD_PROD_STATIC_LOGPATH="${TMP_CHECKOUT}/var/log/update-prod-static.log"
|
|
ln -nfs "$BUILD_PROD_STATIC_LOGPATH" "$USER_PROD_STATIC_LOGPATH"
|
|
set -x
|
|
|
|
./tools/update-prod-static || (
|
|
set +x
|
|
echo; echo -ne "\033[33mRunning update-prod-static failed. "
|
|
echo -e "Check ${TMPDIR}/update-prod-static.log for more information.\033[0m"
|
|
exit 1
|
|
)
|
|
echo "$GITID" > build_id
|
|
echo "$version" > version
|
|
rm -f "$USER_PROD_STATIC_LOGPATH"
|
|
mv "$BUILD_PROD_STATIC_LOGPATH" "$USER_PROD_STATIC_LOGPATH"
|
|
|
|
rm -f zproject/dev-secrets.conf
|
|
|
|
# We don't need duplicate copies of emoji with hashed paths, and they would break bugdown
|
|
find prod-static/serve/generated/emoji/images/emoji/ -regex '.*\.[0-9a-f]+\.png' -delete
|
|
|
|
cd "$TMPDIR"
|
|
|
|
tar --append -f "$TARBALL" "$prefix/prod-static" "$prefix/build_id" "$prefix/version" "$prefix/staticfiles.json" "$prefix/webpack-stats-production.json"
|
|
|
|
rm -rf "$prefix"
|
|
|
|
gzip "$TARBALL"
|
|
echo "Generated $TARBALL.gz"
|