Files
cloud-services/README.md

2.0 KiB

Cloud Services

Refactored cloud microservices from project-ai.

Structure

cloud-services/
├── pkg/                    # Shared Go packages
│   ├── kafka/              # Pure Go Kafka client (franz-go)
│   ├── dbc/                # CAN database signal definitions
│   ├── can-go/             # CAN protocol library
│   └── ...                 # Other shared modules
├── services/
│   └── gateway/            # API gateway service
├── deploy/
│   ├── base/               # Base k8s manifests
│   └── overlays/           # Environment-specific configs
└── scripts/                # Build and utility scripts

Quick Start

# Build all
go build ./...

# Build gateway
go build ./services/gateway

# Run tests
go test ./...

# Build Docker image
docker build -t gateway -f services/gateway/Dockerfile .

Services

Gateway

WebSocket gateway for TRex, HMI, and Mobile connections. Handles auth, message routing to Kafka.

  • Port 8077: HTTP/WebSocket
  • Port 11011: Health check

Development

Prerequisites

  • Go 1.25+
  • Docker (for container builds)

Module Structure

Uses Go workspaces (go.work) for local development:

  • ./pkg - shared packages
  • ./pkg/can-go - CAN protocol library
  • ./services/gateway - gateway service

Generating DBC Code

CAN signal definitions are generated from DBC files. See pkg/dbc/README.md.

./scripts/generate-dbc.sh /path/to/dbc/files

Deployment

Kubernetes manifests in deploy/ use Kustomize overlays:

# Development
kubectl apply -k deploy/overlays/development

# Or via ArgoCD
# See k8s-gitops-setup repo

Environment Variables

Variable Default Description
KAFKA_HOSTS localhost:9092 Kafka brokers
REDIS_HOST localhost Redis host
REDIS_PORT 6379 Redis port
JWK_URL - JWKS endpoint for JWT validation
LOG_LEVEL info Log level