A Go-based HTTP proxy service that creates composable mock microservice topologies for testing complex distributed systems.
This service acts as an HTTP proxy that can chain requests through multiple services, allowing you to simulate complex microservice architectures. Each service can forward requests to other services in the chain, and inject configurable faults to test resilience and retry logic. Perfect for testing distributed system behaviors in development and CI/CD pipelines.
go run cmd/main.go -port 8080 -service-name my-serviceUse the /proxy/ path format to chain requests through multiple services:
# Chain through service-b:8080, then service-c:80
curl http://localhost:8080/proxy/service-b:8080/proxy/service-c:80
# Direct proxy to a single service
curl http://localhost:8080/proxy/service-b:8080Simulate service failures and test retry logic using the /fault/ path format:
# Always return 500 Internal Server Error
curl http://localhost:8080/fault/500
# Return 503 error 30% of the time (for testing retries)
curl http://localhost:8080/fault/503/30
# Inject faults in a proxy chain
# 50% chance of 500 error, otherwise forward to service-b
curl http://localhost:8080/fault/500/50/proxy/service-b:8080Path formats:
/fault/<status-code>- Always inject error (100% chance)/fault/<status-code>/<percentage>- Inject error with specified probability (0-100)/fault/<status-code>/<percentage>/proxy/...- Chain with proxy segments
Supported status codes: 400-599 (client and server errors)
Use cases:
- Retry testing: Test Istio/Envoy retry policies with percentage-based faults
- Circuit breaker testing: Inject high error rates to trigger circuit breakers
- Resilience testing: Validate application behavior under intermittent failures
Example response:
{
"status": 500,
"service": "service-name",
"message": "Fault injected: 500 Internal Server Error"
}Proxy chains:
- Parse the path to extract the next service (
service-b:8080) - Forward the request with the remaining path (
/proxy/service-c:80) - Return the final response when no more proxy segments exist
Fault injection:
- Parse the path to extract status code and percentage
- Generate random number to determine if fault should trigger
- If triggered: return error response immediately
- If not triggered: continue to next segment or return success
curl http://localhost:8080/health| Flag | Default | Description |
|---|---|---|
-port |
8080 | HTTP server port |
-timeout |
30s | Request timeout |
-service-name |
proxy | Service identifier in responses |
-log-level |
info | Log level (debug, info, warn, error) |
-log-format |
text | Log format (json, text) |
All services return JSON responses:
{
"status": 200,
"service": "service-name",
"message": "Request processed successfully"
}Health endpoint response:
{
"status": "healthy",
"service": "service-name"
}docker run -p 8080:8080 ghcr.io/liamawhite/microservice:latestThis project includes a Helm chart for deploying multi-service topologies on Kubernetes.
Deploy a single service:
helm install my-microservice ./chart/ -f chart/values-single.yamlDeploy a three-tier topology:
helm install my-topology ./chart/ -f chart/values-three-tier.yaml- Multi-Service Deployments: Deploy interconnected microservice topologies
- Flexible Configuration: Global defaults with per-service overrides
- Auto-scaling: Optional HPA configuration per service
- Service Discovery: Native Kubernetes service-to-service communication
- Example Configurations: Pre-built values files for common scenarios
Once deployed, test request chains between services:
# Port-forward to the entry service
kubectl port-forward service/my-topology-service-a 8080:8080
# Chain through multiple services
curl http://localhost:8080/proxy/my-topology-service-b:8081/proxy/my-topology-service-c:8082
# Test fault injection (50% error rate)
curl http://localhost:8080/fault/503/50/proxy/my-topology-service-b:8081
# Check individual service health
kubectl port-forward service/my-topology-service-b 8081:8081
curl http://localhost:8081/healthSee chart/README.md for detailed Helm chart documentation, including:
- Configuration parameters
- Custom topology examples
- Resource naming conventions
- Installation options
See DEVELOPMENT.md for development setup, testing, and contribution guidelines.