Sign inSign up

roryfig/api-gateway-data-plane

By roryfig

•Updated 10 months ago

API Gateway data-plane - High-performance Rust API Gateway

Helm
Image
0

5.9K

roryfig/api-gateway-data-plane repository overview

⁠API Gateway Data Plane

The Data Plane is the request proxy that routes incoming traffic to upstream services based on configuration from the Control Plane.

⁠Quick Start

docker run -d \
  --name api-gateway-data-plane \
  -p 8000:8000 \
  -e APP_SYNC__CONTROL_PLANE_URL=http://control-plane:8080 \
  roryfig/api-gateway-data-plane:latest

⁠Image Tags

TagDescription
latestLatest stable release
vX.Y.ZSpecific version (e.g., v1.0.0)
vX.YLatest patch of minor version
vXLatest minor of major version

⁠Dependencies

Required:

  • Control Plane (HTTP sync or RabbitMQ)

Optional:

  • Redis (distributed rate limiting, caching)
  • RabbitMQ (real-time config updates)
  • OpenTelemetry Collector (distributed tracing)

⁠Environment Variables

⁠Config Sync
VariableDefaultDescription
APP_SYNC__CONTROL_PLANE_URLhttp://localhost:8080Control Plane URL
APP_SYNC__SYNC_INTERVAL10Sync interval (seconds)
⁠Server
VariableDefaultDescription
APP_SERVER_HOST0.0.0.0Bind address
APP_SERVER_PORT8000HTTP port
⁠Authentication
VariableDefaultDescription
APP_AUTH_ENABLEDtrueEnable authentication
APP_AUTH_JWT_SECRET-JWT secret (must match Control Plane)
APP_AUTH_JWT_ALGORITHMHS256JWT algorithm
⁠Logging
VariableDefaultDescription
APP_LOGGING_LEVELinfoLog level
APP_LOGGING_FORMATjsonOutput format
⁠OpenTelemetry
VariableDefaultDescription
APP_TELEMETRY_ENABLEDfalseEnable tracing
APP_TELEMETRY_OTLP_ENDPOINT-OTLP endpoint
⁠CORS
VariableDefaultDescription
APP_CORS_ENABLEDtrueEnable CORS
APP_CORS_ALLOWED_ORIGINS*Allowed origins
APP_CORS_ALLOW_CREDENTIALSfalseAllow credentials
⁠Rate Limiting
VariableDefaultDescription
APP_RATE_LIMITING_ENABLEDtrueEnable rate limiting
APP_RATE_LIMITING_USE_REDISfalseDistributed limiting
APP_RATE_LIMITING_REQUESTS_PER_MINUTE1000Request limit
⁠Caching
VariableDefaultDescription
APP_CACHING_ENABLEDfalseEnable caching
APP_CACHING_TTL_SECONDS300Cache TTL
⁠TLS
VariableDefaultDescription
APP_TLS_ENABLEDfalseEnable HTTPS
APP_TLS_PORT8443HTTPS port
APP_TLS_CERT_PATH-Certificate path
APP_TLS_KEY_PATH-Private key path
⁠Redis (Optional)
VariableDefaultDescription
APP_REDIS_URL-Redis URL
⁠Circuit Breaker
VariableDefaultDescription
APP_CIRCUIT_BREAKER_FAILURE_THRESHOLD5Failures before open
APP_CIRCUIT_BREAKER_TIMEOUT_SECONDS60Recovery timeout

⁠YAML Configuration

# config/default.yaml
server:
  host: 0.0.0.0
  port: 8000

sync:
  control_plane_url: http://control-plane:8080
  sync_interval: 10

logging:
  level: info
  format: json

telemetry:
  enabled: true
  otlp_endpoint: http://jaeger:4317

cors:
  enabled: true
  allowed_origins: "https://myapp.com"
  allow_credentials: true

rate_limiting:
  enabled: true
  use_redis: true

caching:
  enabled: true
  ttl_seconds: 300

auth:
  enabled: true
  jwt_algorithm: HS256

redis:
  url: redis://redis:6379

circuit_breaker:
  failure_threshold: 5
  timeout_seconds: 60
docker run -d \
  -v $(pwd)/config:/app/config:ro \
  -e APP_AUTH_JWT_SECRET=your-secret \
  -e APP_ENV=production \
  roryfig/api-gateway-data-plane:latest

⁠Docker Compose

version: '3.8'
services:
  control-plane:
    image: roryfig/api-gateway-control-plane:latest
    # ... control plane config

  data-plane:
    image: roryfig/api-gateway-data-plane:latest
    ports:
      - "8000:8000"
    environment:
      APP_SYNC__CONTROL_PLANE_URL: http://control-plane:8080
      APP_AUTH_JWT_SECRET: ${JWT_SECRET}
      APP_REDIS_URL: redis://redis:6379
      APP_RATE_LIMITING_USE_REDIS: "true"
      APP_CACHING_ENABLED: "true"
    depends_on:
      - control-plane
    deploy:
      replicas: 3

⁠Health Check

curl http://localhost:8000/health

Tag summary

Content type

Image

Digest

sha256:bff9a9d18…

Size

46.1 MB

Last updated

10 months ago

docker pull roryfig/api-gateway-data-plane