This project is a Content Delivery Network (CDN) built using Docker and a microservices architecture. It consists of the following components:
-
Backend Service: Serves content to clients.
-
Load Balancer: Distributes traffic across multiple backend instances.
-
Edge Service: Acts as a caching layer for efficient content delivery.
-
Monitoring Stack: Uses Prometheus and Grafana for tracking performance and metrics.
This is a dummy CDN.
-
Docker & Docker Compose : https://docs.docker.com/engine/install/
& https://docs.docker.com/compose/install/ -
curl or postman
(for testing API endpoints) : https://help.ubidots.com/en/articles/2165289-learn-how-to-install-run-curl-on-windows-macosx-linux or https://www.postman.com/downloads/ -
Grafana & Prometheus (for monitoring) : https://www.linode.com/docs/guides/how-to-install-prometheus-and-grafana-on-ubuntu/
git clone git@github.com:{your_username}/CDN-using-Go
cd CDN-using-Go
docker compose -f docker/docker-compose.yaml up --build -d
docker ps
Expected Output :
docker-backend-1 Running
docker-loadbalancer-1 Running
docker-edge-1 Running
curl http://localhost:8081
curl http://localhost:8080
curl http://localhost:8082
for i in {1..5}; do curl http://localhost:8080; echo ""; done
This should return responses from different backend instances.
docker logs docker-loadbalancer-1
http://localhost:9090
http://localhost:3000
(Default login: admin/admin)
1.Open Grafana → Dashboards → Import
2.Upload the provided grafana-dashboard.json
3.Select Prometheus as the data source
4.Click Import
rate(http_requests_total[5m])
etcetra.....
Service | Endpoint | Description |
---|---|---|
Backend | / |
Returns Content |
Load Balancer | / |
Distributes requests |
Edge | / |
Cached Content |
docker compose -f docker/docker-compose.yaml down
docker compose -f docker/docker-compose.yaml up --build