Skip to content

Commit

Permalink
feat: Make UI accessible behind proxy (#3428)
Browse files Browse the repository at this point in the history
* feat: Make UI runnable behind proxy

Signed-off-by: Hai Nguyen <quanghai.ng1512@gmail.com>

* chore: root_path is optional for type hint

Signed-off-by: Hai Nguyen <quanghai.ng1512@gmail.com>

Signed-off-by: Hai Nguyen <quanghai.ng1512@gmail.com>
  • Loading branch information
sudohainguyen authored Jan 6, 2023
1 parent 01ab462 commit 753d8db
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
17 changes: 15 additions & 2 deletions sdk/python/feast/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,24 @@ def version():
"--registry_ttl_sec",
"-r",
help="Number of seconds after which the registry is refreshed",
type=int,
type=click.INT,
default=5,
show_default=True,
)
@click.option(
"--root_path",
help="Provide root path to make the UI working behind proxy",
type=click.STRING,
default="",
)
@click.pass_context
def ui(ctx: click.Context, host: str, port: int, registry_ttl_sec: int):
def ui(
ctx: click.Context,
host: str,
port: int,
registry_ttl_sec: int,
root_path: Optional[str] = "",
):
"""
Shows the Feast UI over the current directory
"""
Expand All @@ -170,6 +182,7 @@ def ui(ctx: click.Context, host: str, port: int, registry_ttl_sec: int):
port=port,
get_registry_dump=registry_dump,
registry_ttl_sec=registry_ttl_sec,
root_path=root_path,
)


Expand Down
8 changes: 7 additions & 1 deletion sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,12 @@ def get_feature_server_endpoint(self) -> Optional[str]:

@log_exceptions_and_usage
def serve_ui(
self, host: str, port: int, get_registry_dump: Callable, registry_ttl_sec: int
self,
host: str,
port: int,
get_registry_dump: Callable,
registry_ttl_sec: int,
root_path: Optional[str] = "",
) -> None:
"""Start the UI server locally"""
if flags_helper.is_test():
Expand All @@ -2335,6 +2340,7 @@ def serve_ui(
get_registry_dump=get_registry_dump,
project_id=self.config.project,
registry_ttl_sec=registry_ttl_sec,
root_path=root_path,
)

@log_exceptions_and_usage
Expand Down
12 changes: 10 additions & 2 deletions sdk/python/feast/ui_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ def start_server(
get_registry_dump: Callable,
project_id: str,
registry_ttl_sec: int,
root_path: Optional[str] = "",
):
app = get_app(store, get_registry_dump, project_id, registry_ttl_sec, host, port)
uvicorn.run(app, host=host, port=port)
app = get_app(
store,
get_registry_dump,
project_id,
registry_ttl_sec,
host,
port,
)
uvicorn.run(app, host=host, port=port, root_path=root_path)

0 comments on commit 753d8db

Please sign in to comment.