Skip to content

Commit b8794f1

Browse files
Bihan  RanaBihan  Rana
authored andcommitted
Resolve gateway installation command
1 parent 178d5a5 commit b8794f1

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/dstack/_internal/core/backends/base/compute.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,17 +1029,16 @@ def get_dstack_gateway_wheel(build: str) -> str:
10291029
def get_dstack_gateway_commands(router: Optional[AnyRouterConfig] = None) -> List[str]:
10301030
build = get_dstack_runner_version()
10311031
wheel = get_dstack_gateway_wheel(build)
1032-
# Use router type directly as pip extra
1032+
# Build package spec with extras if router is specified
10331033
if router:
1034-
gateway_package = f"dstack-gateway[{router.type}]"
1034+
gateway_package = f"dstack-gateway[{router.type}] @ {wheel}"
10351035
else:
1036-
gateway_package = "dstack-gateway"
1036+
gateway_package = f"dstack-gateway @ {wheel}"
10371037
return [
10381038
"mkdir -p /home/ubuntu/dstack",
10391039
"python3 -m venv /home/ubuntu/dstack/blue",
10401040
"python3 -m venv /home/ubuntu/dstack/green",
1041-
f"/home/ubuntu/dstack/blue/bin/pip install {wheel}",
1042-
f"/home/ubuntu/dstack/blue/bin/pip install --upgrade '{gateway_package}'",
1041+
f"/home/ubuntu/dstack/blue/bin/pip install '{gateway_package}'",
10431042
"sudo /home/ubuntu/dstack/blue/bin/python -m dstack.gateway.systemd install --run",
10441043
]
10451044

src/dstack/_internal/server/services/gateways/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,20 +454,19 @@ async def _update_gateway(gateway_compute_model: GatewayComputeModel, build: str
454454
gateway_compute_model.configuration
455455
)
456456

457-
# Determine gateway package with router extras (similar to compute.py)
457+
# Build package spec with extras and wheel URL (similar to compute.py)
458+
wheel = get_dstack_gateway_wheel(build)
458459
if compute_config.router:
459-
gateway_package = f"dstack-gateway[{compute_config.router.type}]"
460+
gateway_package = f"dstack-gateway[{compute_config.router.type}] @ {wheel}"
460461
else:
461-
gateway_package = "dstack-gateway"
462+
gateway_package = f"dstack-gateway @ {wheel}"
462463

463464
commands = [
464465
# prevent update.sh from overwriting itself during execution
465466
"cp dstack/update.sh dstack/_update.sh",
466-
f"sh dstack/_update.sh {get_dstack_gateway_wheel(build)} {build}",
467+
# Pass the full package spec (with extras) to update.sh instead of just the wheel
468+
f"sh dstack/_update.sh '{gateway_package}' {build}",
467469
"rm dstack/_update.sh",
468-
# Install gateway package with router extras to the active venv (blue or green)
469-
# update.sh writes the active version to dstack/version
470-
f"version=$(cat /home/ubuntu/dstack/version) && /home/ubuntu/dstack/$version/bin/pip install --upgrade '{gateway_package}'",
471470
]
472471
stdout = await connection.tunnel.aexec("/bin/sh -c '" + " && ".join(commands) + "'")
473472
if "Update successfully completed" in stdout:

0 commit comments

Comments
 (0)