Files
git.stella-ops.org/etc/router.yaml.sample
StellaOps Bot 6a299d231f
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Add unit tests for Router configuration and transport layers
- Implemented tests for RouterConfig, RoutingOptions, StaticInstanceConfig, and RouterConfigOptions to ensure default values are set correctly.
- Added tests for RouterConfigProvider to validate configurations and ensure defaults are returned when no file is specified.
- Created tests for ConfigValidationResult to check success and error scenarios.
- Developed tests for ServiceCollectionExtensions to verify service registration for RouterConfig.
- Introduced UdpTransportTests to validate serialization, connection, request-response, and error handling in UDP transport.
- Added scripts for signing authority gaps and hashing DevPortal SDK snippets.
2025-12-05 08:01:47 +02:00

119 lines
3.5 KiB
Plaintext

# StellaOps Router Configuration
# This file configures the router gateway behavior, services, and routing rules.
# Payload limits control memory usage and protect against oversized requests
payloadLimits:
maxRequestBytesPerCall: 10485760 # 10 MB - max size of a single request
maxRequestBytesPerConnection: 104857600 # 100 MB - max total bytes per connection
maxAggregateInflightBytes: 1073741824 # 1 GB - max total in-flight across all connections
# Routing options control how requests are distributed to microservices
routing:
localRegion: "eu1" # This gateway's region
neighborRegions: # Fallback regions (in order of preference)
- eu2
- us1
tieBreaker: roundRobin # Options: roundRobin, random, leastLoaded, consistentHash
preferLocalRegion: true # Prefer instances in the local region
defaultTimeout: "00:00:30" # 30 seconds default request timeout
# Service definitions describe the microservices the gateway routes to
services:
- serviceName: billing
defaultVersion: "1.0.0"
defaultTransport: tcp # Options: tcp, certificate, udp, rabbitMq, inMemory
endpoints:
- method: POST
path: /invoices
defaultTimeout: "00:00:30" # 30 seconds
supportsStreaming: false
requiringClaims:
- type: role
value: billing-admin
- method: GET
path: /invoices/{id}
defaultTimeout: "00:00:05" # 5 seconds
- method: GET
path: /invoices
defaultTimeout: "00:00:10"
supportsStreaming: true # Streaming for large result sets
- serviceName: inventory
defaultVersion: "2.1.0"
defaultTransport: certificate # TLS with client certificates
endpoints:
- method: GET
path: /items
supportsStreaming: true
- method: POST
path: /items
defaultTimeout: "00:00:15"
requiringClaims:
- type: role
value: inventory-manager
- method: PUT
path: /items/{id}
defaultTimeout: "00:00:15"
- method: DELETE
path: /items/{id}
requiringClaims:
- type: role
value: admin
- serviceName: scanner
defaultVersion: "1.0.0"
defaultTransport: tcp
endpoints:
- method: POST
path: /scan
defaultTimeout: "00:05:00" # 5 minutes for long-running scans
supportsStreaming: true
- method: GET
path: /scan/{id}/status
# Static instances are pre-configured microservices (optional)
# Usually instances are discovered dynamically via HELLO messages
staticInstances:
- serviceName: billing
version: "1.0.0"
region: eu1
host: billing-eu1-01.internal
port: 5100
transport: tcp
weight: 100
metadata:
environment: production
rack: rack-1
- serviceName: billing
version: "1.0.0"
region: eu1
host: billing-eu1-02.internal
port: 5100
transport: tcp
weight: 100
metadata:
environment: production
rack: rack-2
- serviceName: billing
version: "1.0.0"
region: eu2
host: billing-eu2-01.internal
port: 5100
transport: tcp
weight: 80 # Lower weight for cross-region
metadata:
environment: production
# Environment variable overrides:
# STELLAOPS_ROUTER_PAYLOADLIMITS__MAXREQUESTBYTESPERCALL=20971520
# STELLAOPS_ROUTER_ROUTING__DEFAULTTIMEOUT=00:01:00
# STELLAOPS_ROUTER_ROUTING__LOCALREGION=us1