Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dstack/_internal/core/backends/base/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def get_shim_pre_start_commands(
f"dlpath=$(sudo mktemp -t {DSTACK_SHIM_BINARY_NAME}.XXXXXXXXXX)",
# -sS -- disable progress meter and warnings, but still show errors (unlike bare -s)
f'sudo curl -sS --compressed --connect-timeout 60 --max-time 240 --retry 1 --output "$dlpath" "{url}"',
f'sudo mv "$dlpath" {dstack_shim_binary_path}',
f'sudo cp "$dlpath" {dstack_shim_binary_path} && sudo rm "$dlpath"',
f"sudo chmod +x {dstack_shim_binary_path}",
f"sudo mkdir {dstack_working_dir} -p",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def upload_envs(client: paramiko.SSHClient, working_dir: str, envs: Dict[str, st
tmp_file_path = f"/tmp/{DSTACK_SHIM_ENV_FILE}"
sftp_upload(client, tmp_file_path, dot_env)
try:
cmd = f"sudo mkdir -p {working_dir} && sudo mv {tmp_file_path} {working_dir}/"
dest = f"{working_dir}/{DSTACK_SHIM_ENV_FILE}"
cmd = (
f"sudo mkdir -p {working_dir} && sudo mv {tmp_file_path} {dest}"
f" && {{ sudo chcon system_u:object_r:etc_t:s0 {dest} 2>/dev/null || true; }}"
)
_, stdout, stderr = client.exec_command(cmd, timeout=20)
out = stdout.read().strip().decode()
err = stderr.read().strip().decode()
Expand Down Expand Up @@ -148,6 +152,7 @@ def run_shim_as_systemd_service(
try:
cmd = """\
sudo mv /tmp/dstack-shim.service /etc/systemd/system/dstack-shim.service && \
{ sudo chcon system_u:object_r:systemd_unit_file_t:s0 /etc/systemd/system/dstack-shim.service 2>/dev/null || true; } && \
sudo systemctl daemon-reload && \
sudo systemctl --quiet enable dstack-shim && \
sudo systemctl restart dstack-shim
Expand Down
Loading