mirror of https://github.com/zulip/zulip.git
a1151aef8b
During installation on a new host, `create-database` attempts to verify that there isn't a bunch of data already in the database which is it about to drop and recreate. In the most common case, this statement emits a scary-looking warning, since the database does not exist yet: ``` + /home/zulip/deployments/current/scripts/setup/create-database + POSTGRES_USER=postgres ++ crudini --get /etc/zulip/zulip.conf postgresql database_name ++ echo zulip + DATABASE_NAME=zulip ++ crudini --get /etc/zulip/zulip.conf postgresql database_user ++ echo zulip + DATABASE_USER=zulip ++ cd / ++ su postgres -c 'psql -v ON_ERROR_STOP=1 -Atc '\''SELECT COUNT(*) FROM zulip.zerver_message;'\'' zulip' psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "zulip" does not exist ``` Because we are attempting to gracefully handle the case where the database does not exist yet, we also continue (and drop the database) in other, less expected cases -- for instance, if database contains a schema we do not expect. Explicitly check for the database existence first, and once we verify that, allow any further failures in the `SELECT COUNT(*)` to abort `create-database`. This serves the dual purpose of hiding the "FATAL" error for the common case when the database does not exist, as well as preventing dropping the database if anything else goes awry. |
||
---|---|---|
.. | ||
lib | ||
nagios | ||
setup | ||
README.md | ||
__init__.py | ||
get-django-setting | ||
log-search | ||
purge-old-deployments | ||
refresh-sharding-and-restart | ||
restart-server | ||
start-server | ||
stop-server | ||
upgrade-zulip | ||
upgrade-zulip-from-git | ||
zulip-puppet-apply |
README.md
This directory contains scripts that:
-
Generally do not require access to Django or the database (those are "management commands"), and thus are suitable to run operationally.
-
Are useful for managing a production deployment of Zulip (many are also used in a Zulip development environment, though development-only scripts live in
tools/
).
For more details, see https://zulip.readthedocs.io/en/latest/overview/directory-structure.html.