This guide outlines the steps for setting up and running the WebSocket server and client locally for development purposes.
- Docker
- Kubernetes cluster (e.g., Minikube, Kind)
- Skaffold
- Chaos Mesh (for chaos testing)
- Protocol Buffers Compiler (protoc)
-
Start your local Kubernetes cluster:
For Minikube:
minikube start
For Kind:
kind create cluster
-
Install Chaos Mesh:
Follow the Chaos Mesh installation guide to install Chaos Mesh in your local Kubernetes cluster.
-
Start the WebSocket server:
Use Skaffold to deploy the WebSocket server to your local Kubernetes cluster:
skaffold dev --tail --trigger=manual
This command starts the WebSocket server in development mode with manual trigger for rebuilds and tails the logs.
-
Run the WebSocket client:
In a separate terminal, run the WebSocket client:
go run cmd/client/*.go exec
This command executes the client, which connects to the WebSocket server and sends/receives messages.
Navigate to the project root directory and run:
protoc --go_out=. --go_opt=paths=source_relative proto/message.proto
Alternatively, using Docker:
docker compose run --rm app protoc --go_out=. --go_opt=paths=source_relative proto/message.proto
- You can use Chaos Mesh to perform chaos experiments on your WebSocket server to test its resilience and fault tolerance.
- Make sure to configure your Kubernetes cluster and Skaffold settings according to your development environment.