Files
zulip/tools/build-local-server-tarball
Kevin Mehall e6ca5d265d Include handlebars templates in build-local-server-tarball
update-prod-static needs DEBUG=False. This also replaces our
local_settings.py before generating anything included in the tarball.

(imported from commit 890cd9d1a44acfd2c20e1662e0c68132c633d1b3)
2013-11-12 15:50:07 -05:00

47 lines
1.1 KiB
Bash
Executable File

#!/bin/sh -ex
GITID=$(git rev-parse HEAD)
if [ "$(uname)" = "Darwin" ]; then
TMPDIR=/tmp/local-server
rm -Rf $TMPDIR
mkdir -p $TMPDIR
else
TMPDIR=$(mktemp -d)
fi
TMP_CHECKOUT=$TMPDIR/zulip-server/
TARBALL=$TMPDIR/zulip-server.tar
# .gitattributes lists the files that are not exported
git archive -o $TARBALL --prefix=zulip-server/ HEAD
# Check out a temporary full copy of the index to generate static files
git checkout-index -f -a --prefix $TMP_CHECKOUT
cd $TMP_CHECKOUT
# Use default settings so there is no chance of leaking secrets
cp zproject/local_settings_template.py zproject/local_settings.py
# Some settings need values for it to work
cat >> zproject/local_settings.py <<EOF
DEBUG = False
LOCAL_DATABASE_PASSWORD = ''
SECRET_KEY = 'not_used_here'
EOF
# update-prod-static generates the prod-static directory.
# See COLLECTSTATIC in settings.py
./tools/update-prod-static
echo $GITID > version_id
mv update-prod-static.log ..
cd $TMPDIR
tar --append -f $TARBALL zulip-server/prod-static zulip-server/version_id
rm -r zulip-server
gzip $TARBALL
echo "Generated $TARBALL.gz"