Files
zulip/tools/provision
Robert Hönig 789ae8648a Add wrapper and log file output for provisioning.
Before this commit, provisioning was done by executing provision.py,
which printed the log directly to stdout, making debugging harder.
This commit creates a wrapper bash script 'provision' in tools, which
calls 'zulip/scripts/tools/provision_vm.py' (the new location of
provision.py) and prints all the output to
'zulip/var/log/zulip/zulip_provision.log' via 'tee'.
Travis tests and docs have been modified accordingly.
2017-01-17 14:23:28 -08:00

32 lines
892 B
Bash
Executable File

#!/bin/bash
set -e
if [ "$EUID" -eq 0 ]; then
echo "Error: The provision script must not be run as root" >&2
exit 1
fi
#Make the script independent of the location from where it is
#executed
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
cd "$PARENT_PATH"
mkdir -p ../var/log
LOG_PATH="../var/log/provision.log"
PROVISION_PATH="lib/provision.py"
echo "PROVISIONING STARTING." >> $LOG_PATH
python "$PROVISION_PATH" $@ 2>&1 | tee -a "$LOG_PATH"
failed=${PIPESTATUS[0]}
if [ $failed = 1 ]; then
echo -e "\033[0;31m"
echo "Provisioning failed!"
echo
echo -n "The provision process is designed to be idempotent, so you can retry "
echo -n "after resolving whatever issue caused the failure (there should be a traceback above). "
echo -n "A log of this installation is available in zulip/log/provision.log"
echo -e "\033[0m"
exit 1
fi
exit 0