Skip to content

Commit

Permalink
Add ServerAliveInterval (#811)
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor-S authored Dec 21, 2023
1 parent 97bc27f commit 4a09158
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion runner/internal/gateway/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package gateway

import (
"fmt"
"github.com/dstackai/dstack/runner/internal/gerrors"
"os"
"os/exec"
"path/filepath"

"github.com/dstackai/dstack/runner/internal/gerrors"
)

type SSHControl struct {
Expand Down Expand Up @@ -42,6 +43,7 @@ func (c *SSHControl) exec(args []string, command string) ([]byte, error) {
"-o", fmt.Sprintf("ControlPath=%s", c.controlPath),
"-o", "ControlMaster=auto",
"-o", "ControlPersist=yes",
"-o", "ServerAliveInterval=60",
}
if args != nil {
allArgs = append(allArgs, args...)
Expand Down
2 changes: 1 addition & 1 deletion src/dstack/_internal/server/services/gateways.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ async def register_service_jobs(
raise ServerClientError("Gateway has no instance associated with it")

domain = gateway.wildcard_domain.lstrip("*.") if gateway.wildcard_domain else None
private_bytes, public_bytes = generate_rsa_key_pair_bytes(comment=f"{project}/{run_name}")
private_bytes, public_bytes = generate_rsa_key_pair_bytes(comment=f"{project.name}/{run_name}")

job.job_spec.gateway.gateway_name = gateway.name
job.job_spec.gateway.ssh_key = private_bytes.decode()
Expand Down

0 comments on commit 4a09158

Please sign in to comment.