mirror of https://github.com/zulip/zulip.git
install: Re-order final steps.
Move database creation to immediately before database initialization; this means it happens in a directory readable by the `zulip` user, as well as placing it alongside similar operations. It removes the check for the `zulip::postgresql_common` Puppet class; instead it keeps the check for `--no-init-db`, and switches to require `zulip::app_frontend_base`. This is a behavior change for any install of `zulip::postgresql_common`-only classes, but that is not a common form -- and such installs likely already pass `--no-init-db` because they are warm spare replicas. As a result, all non-`zulip::app_frontend_base` installs now skip database initialization, even without `--no-init-db`. This is clearly correct for, e.g. Redis-only hosts, and makes clearer that the frontend, not the database host, is responsible for database initialization.
This commit is contained in:
parent
394f1eadde
commit
c0cc98c6a8
|
@ -499,11 +499,30 @@ EOF
|
|||
fi
|
||||
fi
|
||||
|
||||
if has_class "zulip::postgresql_common" && [ -z "$NO_INIT_DB" ]; then
|
||||
"$ZULIP_PATH"/scripts/setup/create-database
|
||||
# Set up a basic .gitconfig for the 'zulip' user
|
||||
if [ -n "$ZULIP_ADMINISTRATOR" ]; then
|
||||
(
|
||||
cd / # Make sure the current working directory is readable by zulip
|
||||
su zulip -c "git config --global user.email $ZULIP_ADMINISTRATOR"
|
||||
su zulip -c "git config --global user.name 'Zulip Server ($EXTERNAL_HOST)'"
|
||||
)
|
||||
fi
|
||||
|
||||
if has_class "zulip::app_frontend_base"; then
|
||||
if ! has_class "zulip::app_frontend_base"; then
|
||||
set +x
|
||||
cat <<EOF
|
||||
|
||||
Success!
|
||||
|
||||
Not configuring PostgreSQL, or /home/zulip/deployments, because this
|
||||
is not a front-end install.
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Frontend deploys use /home/zulip/deployments; without this, the
|
||||
# install directory is also only readable by root.
|
||||
deploy_path=$("$ZULIP_PATH"/scripts/lib/zulip_tools.py make_deploy_path)
|
||||
mv "$ZULIP_PATH" "$deploy_path"
|
||||
ln -nsf /home/zulip/deployments/next "$ZULIP_PATH"
|
||||
|
@ -520,16 +539,6 @@ if has_class "zulip::app_frontend_base"; then
|
|||
# assets.
|
||||
su zulip -c '/home/zulip/deployments/current/tools/update-prod-static'
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set up a basic .gitconfig for the 'zulip' user
|
||||
if [ -n "$ZULIP_ADMINISTRATOR" ]; then
|
||||
(
|
||||
cd / # Make sure the current working directory is readable by zulip
|
||||
su zulip -c "git config --global user.email $ZULIP_ADMINISTRATOR"
|
||||
su zulip -c "git config --global user.name 'Zulip Server ($EXTERNAL_HOST)'"
|
||||
)
|
||||
fi
|
||||
|
||||
if [ -n "$NO_INIT_DB" ]; then
|
||||
set +x
|
||||
|
@ -537,15 +546,16 @@ if [ -n "$NO_INIT_DB" ]; then
|
|||
|
||||
Success!
|
||||
|
||||
Stopping because --no-init-db was passed.
|
||||
To complete the installation, configure PostgreSQL and then run:
|
||||
Stopping because --no-init-db was passed. To complete the
|
||||
installation, configure PostgreSQL by creating the database and
|
||||
database user, and then run:
|
||||
|
||||
su zulip -c '/home/zulip/deployments/current/scripts/setup/initialize-database'
|
||||
su zulip -c '/home/zulip/deployments/current/manage.py generate_realm_creation_link'
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
else
|
||||
/home/zulip/deployments/current/scripts/setup/create-database
|
||||
su zulip -c '/home/zulip/deployments/current/scripts/setup/initialize-database --quiet'
|
||||
|
||||
su zulip -c '/home/zulip/deployments/current/manage.py generate_realm_creation_link'
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue