zulip/scripts/lib
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
..
__init__.py Factor out venv-creating code from provision.py. 2016-06-21 11:25:41 -07:00
build-groonga provision: Add provision support for Fedora 38. 2023-08-22 11:26:29 -07:00
build-pgroonga build-pgroonga: Upgrade PGroonga from 3.1.0 to 3.1.8. 2024-03-01 17:38:08 -08:00
check_rabbitmq_queue.py presence: Remove the queue worker. 2024-07-31 16:46:42 -07:00
check-database-compatibility check-database-compatibility: Ignore twofactor typo. 2023-08-23 22:14:26 -07:00
clean_emoji_cache.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
clean_node_cache.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
clean_unused_caches.py dependencies: Switch to pnpm. 2023-03-20 15:48:29 -07:00
clean_venv_cache.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
create-production-venv create-production-venv: Do not pull in "recommended" packages. 2024-08-26 20:52:59 -07:00
email-mirror-postfix typos: Fix typos caught by mwic. 2024-05-20 13:55:00 -07:00
fix-standalone-certbot puppet: Fix standalone certbot configurations. 2022-01-24 12:13:44 -08:00
hash_reqs.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
install install: Do not pull in "recommended" packages. 2024-08-26 20:52:59 -07:00
install-node install-node: Upgrade Node.js from 20.15.1 to 20.17.0. 2024-08-26 14:17:05 -07:00
node_cache.py node_cache: Run pnpm install if node_modules not present in help-beta. 2024-08-02 18:18:01 -07:00
puppet_cache.py Remove support for Ubuntu 20.04 and Debian 11. 2024-04-01 13:27:39 -07:00
pythonrc.py pythonrc: Add various frequently handy imports. 2024-03-27 12:49:24 -07:00
queue_workers.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
run_hooks.py upgrade-zulip: Factor out a script to run hooks. 2024-07-26 14:31:55 -07:00
setup_path.py setup_path: Ensure that the right venv is activated. 2024-08-29 12:42:13 -07:00
setup_venv.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
setup-apt-repo apt-repos: Temporarily work around Ubuntu 24.04 non-installable gnupg. 2024-03-31 13:51:31 -07:00
setup-yum-repo provision: Add support for Fedora 34. 2021-07-20 12:10:41 -07:00
sharding.py ruff: Bump target-version from py38 to py310. 2024-07-13 22:28:22 -07:00
supervisor.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
supported-os install: Check for a supported version of the OS in shell. 2024-04-16 11:13:33 -07:00
unpack-zulip ruff: Fix UP032 Use f-string instead of format call. 2023-08-02 15:58:55 -07:00
update-git-upstream upgrade-zulip-from-git: Extract code to set zulip upstream remote. 2023-04-19 16:56:14 -07:00
upgrade-zulip typos: Fix typos caught by mwic. 2024-05-20 13:55:00 -07:00
upgrade-zulip-from-git Remove support for Ubuntu 20.04 and Debian 11. 2024-04-01 13:27:39 -07:00
upgrade-zulip-stage-2 upgrade-zulip-stage-2: Be more specific about OS upgrade steps. 2024-07-26 11:14:11 -07:00
upgrade-zulip-stage-3 upgrade-zulip: Factor out a script to run hooks. 2024-07-26 14:31:55 -07:00
warn-rabbitmq-nodename-change puppet: Always set the RabbitMQ nodename to zulip@localhost. 2022-01-25 01:48:02 +00:00
zulip_tools.py ruff: Bump target-version from py38 to py310. 2024-07-13 22:28:22 -07:00