script: Add static asset pipeline option to support OS upgrades.

The comment explains this in more detail, but basically one previously
needed the `--from-git` option to `upgrade-zulip-stage-2` if one had
last installed/upgraded from Git, and not that option otherwise, which
would have forced us to make the OS upgrade documentation much more
complicated than it needed to be.
This commit is contained in:
Tim Abbott
2019-04-17 12:51:56 -07:00
parent a88643313f
commit 388565c7bd
2 changed files with 16 additions and 3 deletions

View File

@@ -287,7 +287,8 @@ Zulip's Python module dependencies for your new version of Python:
```
rm -rf /srv/zulip-venv-cache/*
/home/zulip/deployments/current/scripts/lib/upgrade-zulip-stage-2 /home/zulip/deployments/current/ --from-git
/home/zulip/deployments/current/scripts/lib/upgrade-zulip-stage-2 \
/home/zulip/deployments/current/ --ignore-static-assets
```
That last command will finish by restarting your Zulip server; you
@@ -340,7 +341,8 @@ Zulip's Python module dependencies for your new version of Python:
```
rm -rf /srv/zulip-venv-cache/*
/home/zulip/deployments/current/scripts/lib/upgrade-zulip-stage-2 /home/zulip/deployments/current/ --from-git
/home/zulip/deployments/current/scripts/lib/upgrade-zulip-stage-2 \
/home/zulip/deployments/current/ --ignore-static-assets
```
That last command will finish by restarting your Zulip server; you

View File

@@ -41,6 +41,8 @@ parser.add_argument("--skip-migrations", dest="skip_migrations", action='store_t
help="Skip doing migrations.")
parser.add_argument("--from-git", dest="from_git", action='store_true',
help="Upgrading from git, so run update-prod-static.")
parser.add_argument("--ignore-static-assets", dest="ignore_static_assets", action='store_true',
help="Do not attempt to copy/manage static assets.")
parser.add_argument("--skip-purge-old-deployments", dest="skip_purge_old_deployments",
action="store_true", help="Skip purging old deployments.")
args = parser.parse_args()
@@ -100,7 +102,16 @@ if os.path.exists(emoji_path):
shutil.rmtree("/home/zulip/prod-static/generated/emoji/images-google-64")
# And then, building/installing the static assets.
if args.from_git:
if args.ignore_static_assets:
# For the OS version upgrade use case, the static assets are
# already in place, and we don't need to do anything. Further,
# neither of the options below will work for all installations,
# because if we installed from Git, `prod-static/serve` may be
# empty so we can't do the non-Git thing, whereas if we installed
# from a tarball, we won't have a `tools/` directory and thus
# cannot run `tools/update-prod-static`.
pass
elif args.from_git:
# Note: The fact that this is before we apply puppet changes means
# that we don't support adding new puppet dependencies of
# update-prod-static with the git upgrade process. But it'll fail