This project demonstrates the implementation of Apache SkyWalking APM (Application Performance Monitoring) with a microservices architecture. It consists of two Spring Boot services (Service A and Service B) and a Node.js service (Service C), all instrumented with SkyWalking agents for distributed tracing and monitoring.
The project includes:
- Service A: A Spring Boot application that makes HTTP calls to external services
- Service B: A Spring Boot application with MongoDB integration for customer data management
- Service C: A Node.js application with SkyWalking agent integration
- SkyWalking APM: Complete monitoring setup with OAP (Observability Analysis Platform) and UI
- Elasticsearch: Backend storage for SkyWalking
- MongoDB: Database for Service B
- GitHub Actions: CI workflow to build and push image to dockerhub and update the k8s manifest images.
Current project versions:
- SkyWalking OAP Server: 10.2.0
- SkyWalking UI: 10.2.0
- SkyWalking Java Agent: 8.1.0
- SkyWalking Node.js Agent: Latest version (via npm)
- Docker and Docker Compose
- Java 17 or higher
- Maven
- Node.js 18 or higher
- npm
- Git
- kubectl (for Kubernetes deployment)
- kind (for local Kubernetes cluster)
skywalking-apm-demo/
├── ServiceA/ # Spring Boot Service A
│ ├── agent/ # SkyWalking Java agent
│ └── src/ # Service source code
├── ServiceB/ # Spring Boot Service B with MongoDB
│ ├── agent/ # SkyWalking Java agent
│ └── src/ # Service source code
├── ServiceC/ # Node.js Service
│ └── src/ # Service source code
├── k8s/ # Kubernetes deployment files
├── docker-compose.yml # Docker composition for all services
├── build.sh # Build script for the project
└── deploy.sh # Deployment script for Kubernetes
- Spring Boot application
- Makes HTTP calls to external services
- Integrated with SkyWalking Java agent
- Runs on port 9090
- Spring Boot application with MongoDB
- Customer data management
- Integrated with SkyWalking Java agent
- Runs on port 8090
- Node.js application
- Express.js web server
- Integrated with SkyWalking Node.js agent
- Runs on port 3000
- OAP Server (ports 11800, 12800)
- SkyWalking UI (port 8080)
- Elasticsearch backend (port 9200)
- Database for Service B
- Runs on port 27017
This project supports two deployment methods:
- Docker Compose (Quick Start)
- Kubernetes (Production-like Environment)
This is the quickest way to get started with the demo:
- Build the Services:
./build.sh- Start the Infrastructure:
docker-compose up- kind (Kubernetes in Docker) installed
- kubectl installed
- Docker installed
- Run the deployment script:
./deploy.shThis script will:
- Create a kind cluster
- Deploy all necessary components
- Set up port forwarding for accessing services
- Create a kind cluster:
kind create cluster --config k8s/00-kind-config.yaml- Create the namespace:
kubectl apply -f k8s/01-namespace.yml- Deploy components:
kubectl apply -f k8s/02-elasticsearch.yml
kubectl apply -f k8s/03-oap.yml
kubectl apply -f k8s/04-ui.yml- Deploy services:
kubectl apply -f k8s/05-service-a.yml
kubectl apply -f k8s/06-service-b.yml
kubectl apply -f k8s/08-service-c.ymlAfter deployment, the services will be available at:
- SkyWalking UI: http://localhost:8080
- Service A: http://localhost:9090
- Service B: http://localhost:8090
- Service C: http://localhost:3000
Check if all pods are running:
kubectl get pods -n skywalking-apm-demoCheck the services:
kubectl get svc -n skywalking-apm-demoView the logs:
# For OAP server
kubectl logs -f deployment/sw-oap -n skywalking-apm-demo
# For UI
kubectl logs -f deployment/sw-ui -n skywalking-apm-demo
# For services
kubectl logs -f deployment/service-a -n skywalking-apm-demo
kubectl logs -f deployment/service-b -n skywalking-apm-demo
kubectl logs -f deployment/service-c -n skywalking-apm-demo-
If pods are not starting:
- Check pod events:
kubectl describe pod <pod-name> -n skywalking-apm-demo - Check logs:
kubectl logs <pod-name> -n skywalking-apm-demo
- Check pod events:
-
If services are not accessible:
- Verify the services:
kubectl get svc -n skywalking-apm-demo - Check port forwarding:
ps aux | grep "kubectl port-forward"
- Verify the services:
-
If SkyWalking UI shows no data:
- Verify OAP is connected to Elasticsearch
- Check if the agents are properly configured in the services
- Verify network connectivity between services and OAP
-
Java Agent:
- Check agent.config settings
- Verify agent logs in the container
- Ensure correct agent version compatibility
-
Node.js Agent:
- Check environment variables for configuration
- Verify agent initialization in the application
- Check connection to OAP server
To remove all resources:
kubectl delete namespace skywalking-apm-demoTo delete the kind cluster:
kind delete clusterThis project includes GitHub Actions workflows for:
- Building Docker images
- Pushing to DockerHub
- Updating Kubernetes manifests