Skip to content

Commit

Permalink
Allow control of some serve configuration via env vars (ray-project#4…
Browse files Browse the repository at this point in the history
…7533)

When a serve app is launched, serve will startup automatically. In
certain places like k8s, it can be difficult to preconfigure serve (e.g.
in the [ray-cluster helm
chart](https://github.com/ray-project/kuberay/blob/master/helm-chart/ray-cluster/values.yaml)
there is no ability to set the default serve arguments).

This means you need to either be explicit when you start serve, or if it
starts up automatically you may need to shut it down, then restart it,
which is inconvenient.

Signed-off-by: Tim Paine <[email protected]>
Signed-off-by: ujjawal-khare <[email protected]>
  • Loading branch information
timkpaine authored and ujjawal-khare committed Oct 15, 2024
1 parent 277031d commit 5898073
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/ray/serve/_private/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@
SERVE_NAMESPACE = "serve"

#: HTTP Address
DEFAULT_HTTP_ADDRESS = "http://127.0.0.1:8000"
DEFAULT_HTTP_ADDRESS = os.environ.get(
"RAY_SERVE_DEFAULT_HTTP_ADDRESS", "http://127.0.0.1:8000"
)

#: HTTP Host
DEFAULT_HTTP_HOST = "127.0.0.1"
DEFAULT_HTTP_HOST = os.environ.get("RAY_SERVE_DEFAULT_HTTP_HOST", "127.0.0.1")

#: HTTP Port
DEFAULT_HTTP_PORT = 8000
DEFAULT_HTTP_PORT = int(os.environ.get("RAY_SERVE_DEFAULT_HTTP_PORT", 8000))

#: Uvicorn timeout_keep_alive Config
DEFAULT_UVICORN_KEEP_ALIVE_TIMEOUT_S = 5

#: gRPC Port
DEFAULT_GRPC_PORT = 9000
DEFAULT_GRPC_PORT = int(os.environ.get("RAY_SERVE_DEFAULT_GRPC_PORT", 9000))

#: Default Serve application name
SERVE_DEFAULT_APP_NAME = "default"
Expand Down

0 comments on commit 5898073

Please sign in to comment.