/apisix-dotnet-docker

Manage .NET Microservices APIs with Apache APISIX API Gateway

Primary LanguageShell

Manage .NET Microservices APIs with Apache APISIX API Gateway

This is an example project focus on the usage of Apache APISIX API Gateway for applications developed in ASP.NET Core (Assume that you have an API that manage products) and provide an easy example of how to deploy a multiple images using docker compose.

👉 To execute and customize the example project per your need shown in this post, here are the minimum requirements you need to install in your system:

Build a multi-container APISIX via Docker CLI

You can start the application by running docker compose command from the root folder of the project:

docker-compose -p docker-apisix up -d

Sample output:

[+] Running 7/7
 - Network apisix-dotnet-docker_apisix                Created                                                              0.0s
 - Container apisix-dotnet-docker-apisix-dashboard-1  Started                                                              1.2s
 - Container apisix-dotnet-docker-prometheus-1        Started                                                              0.7s
 - Container apisix-dotnet-docker-etcd-1              Started                                                              0.9s
 - Container apisix-dotnet-docker-grafana-1           Started                                                              1.2s
 - Container apisix-dotnet-docker-productapi-1        Started                                                              0.7s
 - Container apisix-dotnet-docker-apisix-1            Started                                                              2.0s

The running container list you can see by running docker compose ps CLI command or using docker desktop:

NAME                                      COMMAND                  SERVICE             STATUS              PORTS
apisix-dotnet-docker-apisix-1             "sh -c '/usr/bin/api…"   apisix              running             0.0.0.0:9080->9080/tcp, 0.0.0.0:9091-9092->9091-9092/tcp, 0.0.0.0:9443->9443/tcp
apisix-dotnet-docker-apisix-dashboard-1   "/usr/local/apisix-d…"   apisix-dashboard    running             0.0.0.0:9000->9000/tcp
apisix-dotnet-docker-etcd-1               "/opt/bitnami/script…"   etcd                running             0.0.0.0:12379->2379/tcp
apisix-dotnet-docker-grafana-1            "/run.sh"                grafana             running             0.0.0.0:3000->3000/tcp
apisix-dotnet-docker-productapi-1         "dotnet ProductApi.d…"   productapi          running             0.0.0.0:5555->80/tcp
apisix-dotnet-docker-prometheus-1         "/bin/prometheus --c…"   prometheus          running             0.0.0.0:9090->9090/tcp

Once the containers are running, navigate to http://localhost:5555/api/products in your web browser and you will see the following output:

Product list .NET API response

You can read the blog post for more information on how to configure APISIX API Gateway for the ASP.NET API.