Skip to content
Merged
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
10 changes: 8 additions & 2 deletions src/dstack/_internal/proxy/gateway/services/nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def run_certbot(cls, domain: str, acme: ACMESettings) -> None:

cmd = ["sudo", "timeout", "--kill-after", str(CERTBOT_2ND_TIMEOUT), str(CERTBOT_TIMEOUT)]
cmd += ["certbot", "certonly"]
cmd += ["--non-interactive", "--agree-tos", "--register-unsafely-without-email"]
cmd += ["--non-interactive", "--agree-tos", "--register-unsafely-without-email", "--quiet"]
cmd += ["--keep", "--nginx", "--domain", domain]

if acme.server:
Expand All @@ -283,7 +283,13 @@ def run_certbot(cls, domain: str, acme: ACMESettings) -> None:
" Make sure DNS records are configured for this gateway."
)
if r.returncode != 0:
raise ProxyError(f"Error obtaining {domain} TLS certificate:\n{r.stderr.decode()}")
msg = (
r.stderr.decode()
.lstrip("An unexpected error occurred:\n")
.strip()
.replace("\n", " ")
)
raise ProxyError(f"Error obtaining {domain} TLS certificate: {msg}")

@staticmethod
def certificate_exists(domain: str) -> bool:
Expand Down
Loading