From fc0d5fcfd5011eefba755b51bffc427cb8df925d Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 31 Mar 2022 16:11:25 -0700 Subject: [PATCH] upgrade: Mark puppet as having started the server. We previously used restart-server if puppet was run, as a nod to the fact that `supervisor reread && supervisor update` will _start_ service groups that were modified, even if they were previously stopped; this is because they are marked as `autostart=true`, which is honored on service change. However, upgrades want to run while there are no services running. If puppet is run, explicitly set the server as potentially being "up", so that a `shutdown_server()` before migrations, if they exist, will stop services. (cherry picked from commit 0af00a3233fc8964b1ba7c32e672b74d80889b89) --- scripts/lib/upgrade-zulip-stage-2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/lib/upgrade-zulip-stage-2 b/scripts/lib/upgrade-zulip-stage-2 index 94eb7c2204..d578973da9 100755 --- a/scripts/lib/upgrade-zulip-stage-2 +++ b/scripts/lib/upgrade-zulip-stage-2 @@ -363,6 +363,9 @@ if not args.skip_puppet: logging.info("Applying Puppet changes...") subprocess.check_call(["./scripts/zulip-puppet-apply", "--force"]) subprocess.check_call(["apt-get", "-y", "--allow-downgrades", "upgrade"]) + # Puppet may have reloaded supervisor, and in so doing started + # services; mark as potentially needing to stop the server. + IS_SERVER_UP = True if migrations_needed: # Database migrations assume that they run on a database in @@ -372,10 +375,7 @@ if migrations_needed: subprocess.check_call(["./manage.py", "migrate", "--noinput"], preexec_fn=su_to_zulip) logging.info("Restarting Zulip...") -if IS_SERVER_UP or not args.skip_puppet: - # Even if the server wasn't up previously, puppet might have - # started it if there were supervisord configuration changes, so - # we need to use restart-server if puppet ran. +if IS_SERVER_UP: restart_args = ["--fill-cache"] if args.skip_tornado: restart_args.append("--skip-tornado")