This project combines the wraith multi-protocol messaging system with a comprehensive monitoring stack, providing a unified Kubernetes deployment for both the application and its observability infrastructure.
This integrated project merges two components:
- Wraith Application: Multi-protocol publisher/subscriber system supporting NATS, TCP, UDP, and Redis
- Monitoring Stack: Prometheus metrics collection and Grafana visualization with custom dashboards
- NATS: Message broker for pub/sub communication
- Redis: In-memory data store for caching and messaging
- Wraith Server: Multi-protocol publisher that sends data and exposes Prometheus metrics
- Wraith Agent: Multi-protocol subscriber that receives data from the server
- Prometheus: Metrics collection and storage (automatically scrapes wraith-server:8000)
- Grafana: Visualization and dashboards with custom button panel plugin
- Multi-protocol support (NATS, TCP, UDP, Redis)
- Binary data transmission (PDW, EDW)
- Prometheus metrics for timing and performance
- Built-In Test (BIT) functionality
- HTTP API for control
- Custom Grafana dashboards for visualization
- Unified Kubernetes deployment with CI/CD pipeline
wraith-dashboard/
├── wraith-common/ # Shared Rust library
│ ├── src/ # Common utilities and message definitions
│ │ ├── protocols/ # Protocol implementations (NATS, TCP, UDP, Redis)
│ │ ├── pdw.rs # Pulse Descriptor Word structures
│ │ ├── edw.rs # Emitter Descriptor Word structures
│ │ ├── msg.rs # Message definitions
│ │ └── utils.rs # Utility functions
│ └── Cargo.toml # Common library dependencies
├── wraith-server/ # Multi-protocol server implementation
│ ├── src/main.rs # Server application
│ └── Cargo.toml # Server dependencies
├── wraith-agent/ # Multi-protocol agent implementation
│ ├── src/main.rs # Agent application
│ └── Cargo.toml # Agent dependencies
├── k8s/ # Kubernetes manifests
│ ├── base/ # Base manifests
│ │ ├── infrastructure/ # NATS, Redis, Namespace
│ │ ├── monitoring/ # Prometheus, Grafana, Dashboards
│ │ ├── applications/ # Wraith Server & Agent
│ │ └── kustomization.yaml # Base kustomization
│ └── overlays/
│ ├── local/ # Local cluster configuration
│ └── remote/ # Remote cluster configuration
├── .forgejo/workflows/ci.yml # CI/CD pipeline
├── deploy.sh # Main deployment script
├── Earthfile # Build configuration for all images
├── Cargo.toml # Rust workspace configuration
├── Cargo.lock # Dependency lock file
└── README.md # This file
- Kubernetes cluster (e.g., minikube, kind, or k3s)
- kubectl configured to connect to your cluster
- Earthly for building container images
The deployment system consists of four cohesive components:
- Defines containerized build process for all components
- Multi-platform builds (linux/amd64, linux/arm64)
- Configurable registry and tag via build arguments
- Builds wraith-server, wraith-agent, and custom Grafana images
- Main deployment script that coordinates builds and deployments
- Handles both local and remote deployments
- Manages QEMU setup for cross-platform builds
- Provides helpful post-deployment commands
- Uses Kustomize for environment-specific configurations
- Supports image registry and tag substitution
- Organized by component type (infrastructure, monitoring, applications)
- Automated testing, building, and deployment
- Uses Earthly for consistent multi-platform container builds
- Deploys using the same deploy.sh script for consistency
The easiest way to deploy is using the provided script:
# For local clusters (minikube, kind, k3s)
./deploy.sh local
# For local with specific tag
./deploy.sh local localhost v2.0.0
# For remote clusters
./deploy.sh remote docker.io/myuser
./deploy.sh remote gcr.io/myproject v1.0.0Usage: ./deploy.sh [local|remote] [registry] [tag]
./deploy.sh local
# This internally:
# 1. Runs: earthly --build-arg TAG=0.1-slim +all
# 2. Runs: kubectl apply -k k8s/overlays/local./deploy.sh remote gcr.io/myproject v1.2.3
# This internally:
# 1. Runs: earthly --push --build-arg REGISTRY=gcr.io/myproject --build-arg TAG=v1.2.3 +all-multiplatform
# 2. Runs: kubectl kustomize k8s/overlays/remote | sed substitutions | kubectl apply -f -earthly --build-arg TAG=0.1-slim +all
kubectl apply -k k8s/overlays/local# Build and push multi-platform images (amd64 + arm64) to your registry
earthly --push --build-arg REGISTRY=your-registry.com --build-arg TAG=v1.0.0 +all-multiplatform
# Deploy with registry substitution
kubectl kustomize k8s/overlays/remote | sed 's|your-registry.com|your-actual-registry.com|g' | sed 's|0.1-slim|v1.0.0|g' | kubectl apply -f -Multi-Platform Support: Remote deployments automatically build for both linux/amd64 and linux/arm64 architectures, ensuring compatibility with ARM-based clusters.
- Default:
localhost/wraith-*:0.1-slim(local development) - CI/CD:
$REGISTRY/$REPO_OWNER/wraith-*:$COMMIT_SHA(versioned by commit) - Production: Configurable via deploy.sh parameters
- Local: Uses
k8s/overlays/local- localhost registry, local cluster settings - Remote: Uses
k8s/overlays/remote- configurable registry, production settings
All deployment methods deploy:
- Infrastructure services: NATS, Redis, namespace
- Wraith applications: server and agent
- Monitoring stack: Prometheus, Grafana with custom dashboards
Images Built:
wraith-server:${TAG}- Multi-protocol serverwraith-agent:${TAG}- NATS agentlocalhost/grafana:10.0.3-wraith- Custom Grafana with button panel plugin
The server supports multiple protocols simultaneously and can be controlled via HTTP API:
- HTTP API: Port 80 for control commands
- Metrics: Port 8000 for Prometheus scraping
- TCP: Port 9001 for TCP communication
- UDP: Port 9002 for UDP communication
- NATS: Connects to
nats.wraith.svc.cluster.local:4222 - Redis: Connects to
redis.wraith.svc.cluster.local:6379
The agent receives data from all protocols and connects to the server for coordination:
- HTTP: Port 80 for status and control
- TCP: Port 55555 for TCP communication
- UDP: Port 55556 for UDP communication
- NATS: Connects to
nats.wraith.svc.cluster.local:4222
- Prometheus automatically scrapes metrics from
wraith-server:8000 - Grafana provides visualization dashboards
- Custom button panel plugin enables interactive controls
Send data using all protocols:
curl -X POST -H "Content-Type: application/json" \
-d '{"SEND": true}' \
http://wraith-server.wraith.svc/postSend data using specific protocol:
curl -X POST -H "Content-Type: application/json" \
-d '{"SEND": true, "protocol": "NATS"}' \
http://wraith-server.wraith.svc/postRun Built-In Test (BIT):
curl -X POST -H "Content-Type: application/json" \
-d '{"BIT": true}' \
http://wraith-server.wraith.svc/postAfter deployment, services are available within the cluster:
- Wraith Server:
http://wraith-server.wraith.svc - Prometheus:
http://prometheus.wraith.svc:9090 - Grafana:
http://grafana.wraith.svc:3000
For external access, use port-forwarding:
# Access Grafana locally
kubectl port-forward -n wraith svc/grafana 3000:3000
# Access Prometheus locally
kubectl port-forward -n wraith svc/prometheus 9090:9090
# Check deployment status
kubectl get pods -n wraithThe integrated monitoring provides:
- Real-time Metrics: Automatic collection of wraith-server performance data
- Custom Dashboards: Pre-configured Grafana dashboards for wraith metrics
- Interactive Controls: Button panel plugin for triggering actions
- Historical Data: Prometheus storage for trend analysis
The automated pipeline includes:
- Lint: Code quality checks with clippy and rustfmt
- Unit Tests: Rust unit and integration tests
- Integration Tests: Cross-component testing
- Build: Uses Earthly for multi-platform container builds
- Deploy: Deploys to staging environment using deploy.sh
- Acceptance Tests: End-to-end validation
The CI/CD system uses the same deployment tools as manual deployments, ensuring consistency across all environments.
To remove all deployed resources:
kubectl delete -k k8s/baseThe organized structure supports:
- Independent component development
- Easy testing of individual protocols
- Modular deployment options
- Consistent build and deployment processes
- Future extensibility for additional monitoring components
Check pod status:
kubectl get pods -n wraithView logs:
kubectl logs -n wraith deployment/wraith-server
kubectl logs -n wraith deployment/wraith-agent
kubectl logs -n wraith deployment/prometheus
kubectl logs -n wraith deployment/grafanaVerify services:
kubectl get svc -n wraithCheck deployment status:
kubectl rollout status deployment/wraith-server -n wraith
kubectl rollout status deployment/wraith-agent -n wraithThis architecture ensures consistency across all deployment scenarios while maintaining flexibility for different environments and use cases.