API Gateway is a tool that provides routing mechanisms to microservices applications as a way of hiding multiple services behind a single facade.
It provides a security layer, and it is the user entry point. All requests coming to the application will go thought the API Gateway.
It provides load balancing across the registered service instances for the same service.
Build with gradle (build + unit tests):
./gradlew build
Before running the ft, it is required to have wiremock and app running, so run:
docker-compose -d up
Run functional-tests:
./gradlew cucumber
API Gateway depends on Keycloak
and Service Discovery
, so wiremock is used to mock those dependencies and test the functionalities of the application.
To be able to debug the application locally, we need to run the mocks with a different parameter, so run via command line:
MOCKS_DIRECTORY=local docker-compose up -d --build mocks
And then it is possible to start the application in Intellij in Debug mode.
Warning
It has dependencies and does not run without the dependencies running
Dependencies:
Keycloak
on port 8180- To start the keycloak, go to
identity-service
and check the wiki - Without Keycloak, the API Gateway fails on start up and does not start
- To start the keycloak, go to
Service discovery
on port 8081- To start the Service discovery, go to service-discovery and start it manually, or go to docker-local-setup and start it via docker compose
- Without the Service discovery the application also fails on start up and does not start
Local app is available on the port 8080
, health check endpoint is http://localhost:8080/private/health
./gradlew bootRun
Alternatively, it is possible to run using java -jar gateway-app/build/libs/gateway.jar
API Gateway should run together with the Service discovery and other services, to run this project, please see docker-local-setup.