Skip to content
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
17 changes: 16 additions & 1 deletion docs/reference/feature-servers/registry-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

The Registry server supports both gRPC and REST interfaces for interacting with feature metadata. While gRPC remains the default protocol—enabling clients in any language with gRPC support—the REST API allows users to interact with the registry over standard HTTP using any REST-capable tool or language.

Feast supports running the Registry Server in three distinct modes:

| Mode | Command Example | Description |
| ----------- | ------------------------------------------- | -------------------------------------- |
| gRPC only | `feast serve_registry` | Default behavior for SDK and clients |
| REST + gRPC | `feast serve_registry --rest-api` | Enables both interfaces |
| REST only | `feast serve_registry --rest-api --no-grpc` | Used for REST-only clients like the UI |


## How to configure the server

## CLI
Expand All @@ -12,10 +21,16 @@ There is a CLI command that starts the Registry server: `feast serve_registry`.
To start the Registry Server in TLS mode, you need to provide the private and public keys using the `--key` and `--cert` arguments.
More info about TLS mode can be found in [feast-client-connecting-to-remote-registry-sever-started-in-tls-mode](../../how-to-guides/starting-feast-servers-tls-mode.md#starting-feast-registry-server-in-tls-mode)

To enable REST API support, start the registry server with REST mode enabled :
To enable REST API support along with gRPC, start the registry server with REST mode enabled :

`feast serve_registry --rest-api`

This launches both the gRPC and REST servers concurrently. The REST server listens on port 6572 by default.

To run a REST-only server (no gRPC):

`feast serve_registry --rest-api --no-grpc`


## How to configure the client

Expand Down
8 changes: 5 additions & 3 deletions sdk/python/feast/api/registry/rest/rest_registry_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from feast.registry_server import RegistryServer

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


class RestRegistryServer:
Expand All @@ -28,6 +29,7 @@ def __init__(self, store: FeatureStore):
dependencies=[Depends(inject_user_details)],
version="1.0.0",
openapi_url="/openapi.json",
root_path="/api/v1",
docs_url="/",
redoc_url="/docs",
default_status_code=status.HTTP_200_OK,
Expand Down Expand Up @@ -86,7 +88,7 @@ def start_server(

if tls_key_path and tls_cert_path:
logger.info("Starting REST registry server in TLS(SSL) mode")
print(f"REST registry server listening on https://localhost:{port}")
logger.info(f"REST registry server listening on https://localhost:{port}")
uvicorn.run(
self.app,
host="0.0.0.0",
Expand All @@ -95,8 +97,8 @@ def start_server(
ssl_certfile=tls_cert_path,
)
else:
print("Starting REST registry server in non-TLS(SSL) mode")
print(f"REST registry server listening on http://localhost:{port}")
logger.info("Starting REST registry server in non-TLS(SSL) mode")
logger.info(f"REST registry server listening on http://localhost:{port}")
uvicorn.run(
self.app,
host="0.0.0.0",
Expand Down
78 changes: 75 additions & 3 deletions sdk/python/feast/cli/serve.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import logging
import multiprocessing

import click

from feast.constants import (
DEFAULT_FEATURE_TRANSFORMATION_SERVER_PORT,
DEFAULT_OFFLINE_SERVER_PORT,
DEFAULT_REGISTRY_REST_SERVER_PORT,
DEFAULT_REGISTRY_SERVER_PORT,
)
from feast.repo_operations import create_feature_store

logging.basicConfig(level=logging.INFO)


@click.command("serve")
@click.option(
Expand Down Expand Up @@ -147,6 +153,13 @@ def serve_transformations_command(ctx: click.Context, port: int):
default=DEFAULT_REGISTRY_SERVER_PORT,
help="Specify a port for the server",
)
@click.option(
"--rest-port",
type=click.INT,
default=DEFAULT_REGISTRY_REST_SERVER_PORT,
show_default=True,
help="Specify a port for the REST API server (if enabled).",
)
@click.option(
"--key",
"-k",
Expand All @@ -165,29 +178,88 @@ def serve_transformations_command(ctx: click.Context, port: int):
show_default=False,
help="path to TLS certificate public key. You need to pass --key as well to start server in TLS mode",
)
@click.option(
"--grpc/--no-grpc",
is_flag=True,
default=True,
show_default=True,
help="Start a gRPC Registry Server. Enabled by default.",
)
@click.option(
"--rest-api",
"-r",
is_flag=True,
default=False,
show_default=True,
help="Start a REST API Server",
help="Start a REST API Registry Server",
)
@click.pass_context
def serve_registry_command(
ctx: click.Context,
port: int,
tls_key_path: str,
tls_cert_path: str,
grpc: bool,
rest_api: bool,
rest_port: int,
):
"""Start a gRPC or REST api registry server locally on a given port (gRPC by default)."""
"""Start Feast Registry server (gRPC by default, REST opt-in)."""
if (tls_key_path and not tls_cert_path) or (not tls_key_path and tls_cert_path):
raise click.BadParameter(
"Please pass --cert and --key args to start the registry server in TLS mode."
)
store = create_feature_store(ctx)

store.serve_registry(port, tls_key_path, tls_cert_path, rest_api)
if grpc and rest_api:
repo_path = store.repo_path
multiprocessing.set_start_method("spawn", force=True)
servers = [
multiprocessing.Process(
target=_serve_grpc_registry,
args=(repo_path, port, tls_key_path, tls_cert_path),
name="grpc_registry_server",
),
multiprocessing.Process(
target=_serve_rest_registry,
args=(repo_path, rest_port, tls_key_path, tls_cert_path),
name="rest_registry_server",
),
]
logging.info("Starting Feast Registry servers (gRPC + REST)...")
for p in servers:
logging.info(f"Starting {p.name}")
p.start()
for p in servers:
p.join()
else:
store.serve_registry(port, tls_key_path, tls_cert_path, rest_api)


def _serve_grpc_registry(
repo_path: str, port: int, tls_key_path: str, tls_cert_path: str
):
from feast import FeatureStore

store = FeatureStore(repo_path=repo_path)
store.serve_registry(
port=port,
tls_key_path=tls_key_path,
tls_cert_path=tls_cert_path,
)


def _serve_rest_registry(
repo_path: str, port: int, tls_key_path: str, tls_cert_path: str
):
from feast import FeatureStore

store = FeatureStore(repo_path=repo_path)
store.serve_registry(
port=port,
tls_key_path=tls_key_path,
tls_cert_path=tls_cert_path,
rest_api=True,
)


@click.command("serve_offline")
Expand Down
5 changes: 4 additions & 1 deletion sdk/python/feast/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
# Default FTS port
DEFAULT_FEATURE_TRANSFORMATION_SERVER_PORT = 6569

# Default registry server port
# Default registry server grpc port
DEFAULT_REGISTRY_SERVER_PORT = 6570

# Default registry server REST port
DEFAULT_REGISTRY_REST_SERVER_PORT = 6572

# Default offline server port
DEFAULT_OFFLINE_SERVER_PORT = 8815

Expand Down