feat(furniture): add bff runtime updates

Why: baseline pending runtime edge and container assets before next wave.

What: add local grpc proto usage, runtime endpoint updates, and repo docs/docker assets.

Rule: keep technical intent and align repository workflow.
This commit is contained in:
José René White Enciso 2026-03-08 14:59:42 -06:00
parent 1f45d9eff7
commit f9a0df0576
7 changed files with 129 additions and 1 deletions

9
.dockerignore Normal file
View File

@ -0,0 +1,9 @@
**/bin/
**/obj/
.vs/
TestResults/
.git/
.repo-tasks/
.repo-context/
.tasks/
.agile/

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# syntax=docker/dockerfile:1.7
ARG SDK_IMAGE=mcr.microsoft.com/dotnet/sdk:10.0
ARG RUNTIME_IMAGE=mcr.microsoft.com/dotnet/aspnet:10.0
FROM ${SDK_IMAGE} AS build
ARG NUGET_FEED_URL=http://192.168.10.100:3000/api/packages/AgileWebs/nuget/index.json
ARG NUGET_FEED_USERNAME=
ARG NUGET_FEED_TOKEN=
WORKDIR /src
COPY . .
RUN if [ -n "$NUGET_FEED_USERNAME" ] && [ -n "$NUGET_FEED_TOKEN" ]; then dotnet nuget add source "$NUGET_FEED_URL" --name gitea-org --username "$NUGET_FEED_USERNAME" --password "$NUGET_FEED_TOKEN" --store-password-in-clear-text --allow-insecure-connections --configfile /root/.nuget/NuGet/NuGet.Config; fi
RUN dotnet restore "src/Furniture.Bff.Rest/Furniture.Bff.Rest.csproj" --configfile /root/.nuget/NuGet/NuGet.Config
RUN dotnet publish "src/Furniture.Bff.Rest/Furniture.Bff.Rest.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore
FROM ${RUNTIME_IMAGE} AS runtime
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8080 ASPNETCORE_ENVIRONMENT=Production
EXPOSE 8080
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "Furniture.Bff.Rest.dll"]

View File

@ -0,0 +1,18 @@
# Feature Epics
## Repository
furniture-bff
## Core Epics
- Epic 1: Expand domain-aligned capabilities for restaurant operations.
- Epic 2: Stabilize service contracts for containerized runtime integration.
- Epic 3: Improve observability and operational readiness for demo compose environments.
## Domain-Specific Candidate Features
- Order lifecycle consistency and state transitions.
- Kitchen queue and dispatch optimization hooks.
- Operations control-plane policies (flags, service windows, overrides).
- POS closeout and settlement summary alignment.
## Documentation Contract
Any code change in this repository must include docs updates in the same branch.

View File

@ -0,0 +1,41 @@
# Containerization Runbook
## Image Build
If the repo consumes internal packages from Gitea, pass feed credentials as build args.
```bash
docker build --build-arg NUGET_FEED_USERNAME=<gitea-login> --build-arg NUGET_FEED_TOKEN=<gitea-token> -t agilewebs/furniture-bff:dev .
```
## Local Run
```bash
docker run --rm -p 8080:8080 --name furniture-bff agilewebs/furniture-bff:dev
```
## Health Probe
- Path: `/health`
- Fallback path: `/healthz`
- Port: `8080`
## Runtime Notes
- Requires `FurnitureService__GrpcAddress` to target furniture-service in distributed runs.
- gRPC client contract protobuf is vendored at `src/Furniture.Bff.Rest/Protos/furniture_runtime.proto` to keep image builds repo-local.
## Health Endpoint Consistency
- Canonical probe: `/health`
- Compatibility probe: `/healthz`
- Container port: `8080`
## Demo Integration
- Participates in: **furniture** demo compose stack.
- Integration artifact path: `greenfield/demo/furniture/docker-compose.yml`
## Known Limitations
- Current runtime adapters are still predominantly in-memory for deterministic local/demo behavior.
- Demo PostgreSQL seeds validate integration contracts and smoke determinism, but do not yet imply full persistence implementation parity.

View File

@ -15,7 +15,7 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<Protobuf Include="..\..\..\furniture-service\src\Furniture.Service.Grpc\Protos\furniture_runtime.proto" GrpcServices="Client" Link="Protos\furniture_runtime.proto" />
<Protobuf Include="Protos\furniture_runtime.proto" GrpcServices="Client" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Furniture.Bff.Application\Furniture.Bff.Application.csproj" />

View File

@ -9,6 +9,7 @@ using Furniture.Service.Grpc;
using Microsoft.Extensions.Primitives;
const string CorrelationHeaderName = "x-correlation-id";
const string CorsPolicyName = "FurnitureBffCors";
var builder = WebApplication.CreateBuilder(args);
var edgeProtocol = builder.Configuration["FurnitureBff:EdgeProtocol"] ?? "rest";
@ -23,6 +24,21 @@ builder.Services.AddHealthChecks();
builder.Services.AddBlueprintRuntimeCore();
builder.Services.AddFurnitureBffApplicationRuntime();
builder.Services.AddScoped<IFurnitureServiceClient, FurnitureServiceGrpcClientAdapter>();
var allowedOrigins = builder.Configuration.GetSection("FurnitureBff:AllowedOrigins").Get<string[]>() ??
["http://localhost:22380", "http://127.0.0.1:22380"];
builder.Services.AddCors(options =>
{
options.AddPolicy(CorsPolicyName, policy =>
{
if (Array.Exists(allowedOrigins, origin => origin == "*"))
{
policy.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
return;
}
policy.WithOrigins(allowedOrigins).AllowAnyMethod().AllowAnyHeader();
});
});
builder.Services.AddGrpcClient<FurnitureRuntime.FurnitureRuntimeClient>(options =>
{
var serviceAddress = builder.Configuration["FurnitureService:GrpcAddress"] ?? "http://localhost:5252";
@ -30,6 +46,7 @@ builder.Services.AddGrpcClient<FurnitureRuntime.FurnitureRuntimeClient>(options
});
var app = builder.Build();
app.UseCors(CorsPolicyName);
app.Use(async (context, next) =>
{
@ -54,6 +71,7 @@ app.MapGet($"{EndpointConventions.ApiPrefix}/{{furnitureId}}/availability", asyn
});
app.MapHealthChecks("/healthz");
app.MapHealthChecks("/health");
app.Run();

View File

@ -0,0 +1,20 @@
syntax = "proto3";
option csharp_namespace = "Furniture.Service.Grpc";
package furniture.service.grpc;
service FurnitureRuntime {
rpc GetFurnitureAvailability (GetFurnitureAvailabilityGrpcRequest) returns (GetFurnitureAvailabilityGrpcResponse);
}
message GetFurnitureAvailabilityGrpcRequest {
string furniture_id = 1;
string correlation_id = 2;
}
message GetFurnitureAvailabilityGrpcResponse {
string furniture_id = 1;
string display_name = 2;
int32 quantity_available = 3;
}