zulip/scripts
Alex Vandiver 6c1a8185aa setup_path: Ensure that the right venv is activated.
`setup_path()` previously only checked that some `zulip-py3-venv` was
the `sys.prefix`, not that it was the one associated with this
deployment.  When `uwsgi` is started, it is started from `bin/uwsgi`
within a `zulip-py3-venv` virtualenv, and as such sets
`sys.executable` to that, resulting in uwsgi workers picking up the
library path of that virtualenv.  On first start, `sys.path` thus
already matches the expected virtualenv, and the `setup_path` in
`zproject.wsgi` does nothing.

If a rolling restart was later done into a deployment with a different
virtualenv, the `zproject.wsgi` call to `setup_path()` did not change
`sys.path` to the new virtualenv, since it was already running within
_a_ virtualenv.  This led to dependency version mismatches, and
potentially even more disastrous consequences if the old (but still
erroneously in use) virtualenv was later garbage-collected.

PR #26771 was a previous attempt to resolve this, but failed due to
not thinking of the uwsgi binary itself as possibly providing a
virtualenv path.  We leave the `chdir` hooks from that in-place, since
it cannot hurt for the "master" uwsgi process to be chdir'd to `/`,
and the `hook-post-fork` `chdir` is reasonable as well.

Resolve the virtualenv in `setup_path()`, and activate it if it
differs from the one that is currently active.  To be sure that no
other old virtualenvs are used, we also filter out any paths which
appear to be from other Zulip virtualenvs.
2024-08-29 12:42:13 -07:00
..
lib setup_path: Ensure that the right venv is activated. 2024-08-29 12:42:13 -07:00
nagios thumbnail: Add support for multiple queue workers. 2024-07-21 19:15:43 -07:00
setup install-aws-server: Switch to 24.04. 2024-08-20 10:04:37 -07:00
README.md docs: Apply bullet style changes from Prettier. 2021-09-08 12:06:24 -07:00
__init__.py
get-django-setting python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
log-search ruff: Fix UP035 Import from `collections.abc`, `typing` instead. 2024-07-13 22:28:22 -07:00
purge-old-deployments ruff: Fix UP006 Use `list` instead of `List` for type annotation. 2024-07-13 22:28:22 -07:00
refresh-sharding-and-restart sharding: Configure Tornado sharding with nginx map. 2022-09-15 16:07:50 -07:00
reload-clients reload-clients: Log how many reload events were actually sent. 2024-03-01 09:31:20 -08:00
restart-server restart-server: Wait until chain reload has completed. 2024-08-29 12:12:34 -07:00
start-server scripts: Add a start-server as well. 2021-04-21 10:24:08 -07:00
stop-server start-server/restart-server: Drop privileges if necessary. 2024-02-07 12:33:00 -08:00
upgrade-zulip upgrade: Modify upgrade scripts to handle failure. 2021-06-23 08:42:20 -07:00
upgrade-zulip-from-git upgrade: Modify upgrade scripts to handle failure. 2021-06-23 08:42:20 -07:00
zulip-puppet-apply ruff: Fix UP006 Use `list` instead of `List` for type annotation. 2024-07-13 22:28:22 -07:00

README.md

This directory contains scripts that:

  • Generally do not require access to Django or the database (those are "management commands"), and thus are suitable to run operationally.

  • Are useful for managing a production deployment of Zulip (many are also used in a Zulip development environment, though development-only scripts live in tools/).

For more details, see https://zulip.readthedocs.io/en/latest/overview/directory-structure.html.