Skip to content

[chore]: Update/remove dstack-proxy TODOs #2239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2025
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 docs/docs/reference/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ For more details on the options below, refer to the [server deployment](../guide
- `DSTACK_DATABASE_URL`{ #DSTACK_DATABASE_URL } – The database URL to use instead of default SQLite. Currently `dstack` supports Postgres. Example: `postgresql+asyncpg://myuser:mypassword@localhost:5432/mydatabase`. Defaults to `None`.
- `DSTACK_SERVER_CLOUDWATCH_LOG_GROUP`{ #DSTACK_SERVER_CLOUDWATCH_LOG_GROUP } – The CloudWatch Logs group for workloads logs. If not set, the default file-based log storage is used.
- `DSTACK_SERVER_CLOUDWATCH_LOG_REGION`{ #DSTACK_SERVER_CLOUDWATCH_LOG_REGION } – The CloudWatch Logs region. Defaults to `None`.
- `DSTACK_DEFAULT_SERVICE_CLIENT_MAX_BODY_SIZE`{ #DSTACK_DEFAULT_SERVICE_CLIENT_MAX_BODY_SIZE } – Request body size limit for services, in bytes. Defaults to 64 MiB.
- `DSTACK_DEFAULT_SERVICE_CLIENT_MAX_BODY_SIZE`{ #DSTACK_DEFAULT_SERVICE_CLIENT_MAX_BODY_SIZE } – Request body size limit for services running with a gateway, in bytes. Defaults to 64 MiB.
- `DSTACK_FORBID_SERVICES_WITHOUT_GATEWAY`{ #DSTACK_FORBID_SERVICES_WITHOUT_GATEWAY } – Forbids registering new services without a gateway if set to any value.

??? info "Internal environment variables"
Expand Down
2 changes: 1 addition & 1 deletion src/dstack/_internal/proxy/lib/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Service(ImmutableModel):
domain: Optional[str] # only used on gateways
https: Optional[bool] # only used on gateways
auth: bool
client_max_body_size: int
client_max_body_size: int # only enforced on gateways
replicas: tuple[Replica, ...]

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def client(self) -> ServiceClient:

class ServiceConnectionPool:
def __init__(self) -> None:
# TODO(#1595): remove connections to stopped replicas in-server
# TODO(#2238): remove connections to stopped replicas in-server
self.connections: Dict[str, ServiceConnection] = {}

async def get(self, replica_id: str) -> Optional[ServiceConnection]:
Expand Down Expand Up @@ -139,7 +139,6 @@ async def get_service_replica_client(
timeout=HTTP_TIMEOUT,
)
# Nginx not available, forward directly to the tunnel
# TODO(#1595): consider trying different replicas, e.g. using HTTPMultiClient
replica = random.choice(service.replicas)
connection = await service_conn_pool.get(replica.id)
if connection is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,3 @@ async def service_reverse_proxy(
return await service_proxy.proxy(
project_name, run_name, path, request, auth, repo, service_conn_pool
)


# TODO(#1595): support websockets
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ async def proxy(
repo: BaseProxyRepo,
service_conn_pool: ServiceConnectionPool,
) -> fastapi.responses.Response:
# TODO(#1595): enforce client_max_body_size

if "Upgrade" in request.headers:
raise ProxyError("Upgrading connections is not supported", status.HTTP_400_BAD_REQUEST)

Expand Down Expand Up @@ -95,7 +93,7 @@ async def build_upstream_request(
).get_stream()
client.cookies.clear() # the client is shared by all users, don't leak cookies

# TODO(#1595): add common proxy headers
# TODO(#2237): add common proxy headers
return client.build_request(
downstream_request.method, url, headers=downstream_request.headers, content=request_stream
)
Expand Down