Skip to content

Commit

Permalink
upgrade: Mark puppet as having started the server.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexmv authored and timabbott committed Apr 1, 2022
1 parent e959663 commit 0af00a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/lib/upgrade-zulip-stage-2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit 0af00a3

Please sign in to comment.