mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
dev: Clearer postgres error messages in postgres-init-dev-db.
This uses `pg_isready` to provide a clearer error message if postgres isn't working. Fixes #2419.
This commit is contained in:
@@ -39,6 +39,15 @@ fi
|
|||||||
|
|
||||||
DBNAME_BASE=${DBNAME}_base
|
DBNAME_BASE=${DBNAME}_base
|
||||||
|
|
||||||
|
if ! pg_isready -U "$DEFAULT_USER" -q; then
|
||||||
|
set +x
|
||||||
|
echo
|
||||||
|
echo 'ERROR: PostgreSQL Server is not running! Ensure the service is enabled.'
|
||||||
|
echo 'ERROR: Try `sudo service postgresql start`?'
|
||||||
|
echo "ERROR: You can easily test if you fixed it using: pg_isready -U \$DEFAULT_USER"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
$ROOT_POSTGRES "$DEFAULT_DB" << EOF
|
$ROOT_POSTGRES "$DEFAULT_DB" << EOF
|
||||||
CREATE USER $USERNAME;
|
CREATE USER $USERNAME;
|
||||||
ALTER USER $USERNAME PASSWORD '$PASSWORD';
|
ALTER USER $USERNAME PASSWORD '$PASSWORD';
|
||||||
|
|||||||
Reference in New Issue
Block a user