From a20dcf7bceef51b9479313f7ad92d60782eec0da Mon Sep 17 00:00:00 2001 From: "Jim Wang @ Intel" Date: Mon, 20 Jul 2020 11:21:22 -0700 Subject: [PATCH] doc: Add section Configure ADD_PROXY_ROUTE of API Gateway (#181) Add a new section for configuring `ADD_PROXY_ROUTE` environment variable in edgex-proxy service Closes: #171 Signed-off-by: Jim Wang --- .../microservices/security/Ch-APIGateway.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs_src/microservices/security/Ch-APIGateway.md b/docs_src/microservices/security/Ch-APIGateway.md index 96aa35ac2a..1b17bd1850 100644 --- a/docs_src/microservices/security/Ch-APIGateway.md +++ b/docs_src/microservices/security/Ch-APIGateway.md @@ -128,6 +128,40 @@ will be denied when trying to access resources through the API Gateway. name = "acl" whitelist = "admin,user" +**Configuration of Adding Microservices Routes for API Gateway** + +For the current pre-existing Kong routes, they are configured and initialized statically through configuration TOML file specified in `security-proxy-setup` application. This is not sufficient for some other new additional microservices like application services, for example. Thus, adding new proxy Kong routes are now possibly achieved via the environment variable, `ADD_PROXY_ROUTE`, of service `edgex-proxy` in the docker-compose file. Here is an example: + +```yaml +edgex-proxy: + ... + environment: + ... + ADD_PROXY_ROUTE: "myApp.http://my-app:56789" + ... + +... + +my-app: + ... + container_name: myApp + hostname: myApp + ... + +``` + +The value of `ADD_PROXY_ROUTE` takes a comma-separated list of one or more (at least one) paired additional service name and URL for which to create proxy Kong routes. The paired specification is given as the following: + +**\.\** + +where **RoutePrefix** is the name of service which requests to create proxy Kong route and it is case insensitive; it is the docker network hostname of the service that want to add the proxy Kong route in the docker-compose file if running from docker-compose, for example, `myApp` in this case. + +**TargetRouteURL** is the full qualified URL for the target service, like `http://my-app:56789` + +So as an example, for a single service, the value of `ADD_PROXY_ROUTE` would be: "`myApp.http://my-app:56789`". + +Once `ADD_PROXY_ROUTE` is configured and composed-up successfully, the proxy route then can be accessed the app's REST API via Kong as `http://localhost:8000/myApp/api/v1/...` in the same way you would access the edgex service in which you will also need an access token and it is using default access role if not specified in the TOML configuration file as well. + ## Using API Gateway **Resource Mapping between EdgeX Microservice and API gateway**