Skip to content

Install gateway app with uv-managed Python 3.12 - #4439

Merged
r4victor merged 5 commits into
masterfrom
issue_4423_gateway_python_upgrade
Oct 30, 2026
Merged

r4victor merged 5 commits into
masterfrom
issue_4423_gateway_python_upgrade

Conversation

@r4victor

Copy link
Copy Markdown
Collaborator

Part of #4423. Gateways run dstack on Ubuntu 22.04's system Python 3.10 and have no way to change it, which blocks dropping Python 3.10.

  • Gateways are now installed and updated by a single script, core/backends/base/resources/gateway_install.sh, used by cloud-init, the Kubernetes gateway pod, and the server's gateway updates.
  • The script installs uv and a uv-managed Python 3.12, and recreates the inactive blue/green venv on every update, so existing gateways move off Python 3.10 on their next update and later python_version changes migrate them the same way.
  • dstack is installed with uv pip install --compile-bytecode and without a persistent uv cache, so updates are fast, the restart downtime doesn't grow, and the disk usage doesn't grow either.
  • Both venvs always exist and are created with pip (uv venv --seed), so the pip-based update script of an older server keeps working after a server downgrade.
  • The install script is tested in an Ubuntu container with stubbed sudo, uv, python, and wget, behind a new opt-in --rundocker pytest flag.
  • A new --runall pytest flag enables all opt-in test groups, and CI uses it.

The gateway install script now provisions and updates gateways, recreating
the inactive venv on Python 3.12 so existing gateways migrate off the OS
Python 3.10. Part of #4423.
Older servers' update scripts install into the inactive venv with its
pip, so a fresh host needs both. The uv cache was never pruned.
Installing the systemd service with sudo leaves root-owned bytecode in
the venv, so the next update failed to remove it.
uv doesn't compile bytecode by default, so the app compiled it on the
first start, which more than doubled the restart downtime.
@r4victor
r4victor merged commit 24592ec into master Oct 30, 2026
29 checks passed
@r4victor
r4victor deleted the issue_4423_gateway_python_upgrade branch October 30, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant