This project contains a .NET Core Web API (KongFusion) that integrates with Kong API Gateway, Prometheus for monitoring, and Grafana for visualization. The application is designed to run multiple instances of the Web API, all managed through Docker Compose.
- Project Structure
- Technologies Used
- Prerequisites
- Setup Instructions
- Docker Services
- Monitoring and Visualization
- Kong API Gateway
- Metrics Collection with Prometheus
- Visualization with Grafana
- License
.
├── KongFusion/
│ ├── Controllers/
│ ├── Program.cs
│ └── KongFusion.csproj
├── docker-compose.yml
├── config/
│ ├── kong.yaml
│ └── prometheus.yml
├── README.md
└── .gitignore
- Docker: Containerize and manage multiple instances of the application.
- Docker Compose: Orchestrates services like Kong API Gateway, Prometheus, Grafana, and PostgreSQL.
- Kong: API Gateway to route traffic between services.
- Prometheus: Metrics collection for monitoring.
- Grafana: Visualization dashboard for monitoring data.
- PostgreSQL: Database backend for Kong.
git clone https://github.com/emreesahiiinn/KongFusion.git
cd KongFusion
To start the application and its services, run the following command:
docker-compose up
This command will:
- Build the
kongfusion
app. - Start Kong, Prometheus, Grafana, and PostgreSQL containers.
- Kong Admin GUI: http://localhost:8002
- Kong Admin API: http://localhost:8001
- Kong Proxy: http://localhost:8000
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000 (Default username:
admin
, password:admin
)
By default, the docker-compose.yml
file spins up five instances of the kongfusion
Web API. These instances are exposed on the following ports:
- kongfusion-1: http://localhost:5071
- kongfusion-2: http://localhost:5072
- kongfusion-3: http://localhost:5073
- kongfusion-4: http://localhost:5074
- kongfusion-5: http://localhost:5075
- kongfusion: The ASP.NET Core Web API application. It exposes endpoints and is load-balanced by Kong.
- kong: Kong API Gateway, configured to manage and route the requests between services.
- db: PostgreSQL database for storing Kong configurations.
- prometheus: Collects metrics from the
kongfusion
app for monitoring. - grafana: Provides a dashboard for visualizing the metrics collected by Prometheus.
The Kong API Gateway is used to route traffic to multiple instances of the kongfusion
application.
- Kong Admin GUI: http://localhost:8002
- Kong Admin API: http://localhost:8001
Kong is configured declaratively using the file config/kong.yaml
.
Prometheus collects metrics from each kongfusion
instance. The configuration for Prometheus is defined in config/prometheus.yml
.
Prometheus is available at http://localhost:9090.
Grafana is used to visualize the metrics collected by Prometheus. Once the service is running, you can access the Grafana dashboard at http://localhost:3000.
To add Prometheus as a data source in Grafana:
- Go to
Connections
>Data Sources
. - Add a new Prometheus data source with the URL
http://prometheus:9090
.
You can then create custom dashboards based on the collected metrics.