From c0cc98c6a84b7289e24210417b8f6a351277d0a5 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Mon, 21 Mar 2022 13:02:40 -0400 Subject: [PATCH] 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. --- scripts/lib/install | 70 ++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/scripts/lib/install b/scripts/lib/install index 5c852f7297..843e44afb7 100755 --- a/scripts/lib/install +++ b/scripts/lib/install @@ -499,29 +499,6 @@ EOF fi fi -if has_class "zulip::postgresql_common" && [ -z "$NO_INIT_DB" ]; then - "$ZULIP_PATH"/scripts/setup/create-database -fi - -if has_class "zulip::app_frontend_base"; then - 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" - ln -nsf "$deploy_path" /home/zulip/deployments/next - ln -nsf "$deploy_path" /home/zulip/deployments/current - ln -nsf /etc/zulip/settings.py "$deploy_path"/zproject/prod_settings.py - mkdir -p "$deploy_path"/prod-static/serve - cp -rT "$deploy_path"/prod-static/serve /home/zulip/prod-static - chown -R zulip:zulip /home/zulip /var/log/zulip /etc/zulip/settings.py - - if ! [ -e "/home/zulip/prod-static/generated" ]; then - # If we're installing from a Git checkout, we need to run - # `tools/update-prod-static` in order to build the static - # 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 ( @@ -531,21 +508,54 @@ if [ -n "$ZULIP_ADMINISTRATOR" ]; then ) fi +if ! has_class "zulip::app_frontend_base"; then + set +x + cat <