Files
zulip/scripts/setup/initialize-database
Tim Abbott 5bf66e04fc initialize-database: Print nice instructions for how to redo if fails.
Most of our installation process is idempotent, but this step in
particular is not, so it's important to provide a clear error message
about how to proceed.
2015-09-29 18:27:27 -07:00

23 lines
715 B
Bash
Executable File

#!/bin/bash -xe
# Change to root directory of the checkout that we're running from
cd "$(dirname "$0")/../.."
python manage.py checkconfig
python manage.py migrate --noinput
python manage.py createcachetable third_party_api_results
if ! python manage.py initialize_voyager_db; then
set +x
echo
echo -e "\033[32mPopulating default database failed."
echo "After you fix the problem, you will need to do the following before rerunning this:"
echo " * supervisorctl stop all # to stop all services that might be accessing the database"
echo " * scripts/setup/postgres-init-db # run as root to drop and re-create the database"
echo -e "\033[0m"
set -x
fi
supervisorctl restart all