I've created several RESTful microservices and dockerized them. Now I want to have a web-based UI for them and the ability to create users and grant permissions to them to use some of the APIs.
I know that I need some kind of API gateway. My first thought was that I always could do that bruteforce way: create some django app that would serve UI and proxy all request to APIs by hand, but this seems very dull. Maybe there are some alternatives? I've ready about Tyk, but can't find any information about the ability to add users and grant permissions to them.
I probably could create an application that would serve as API gateway and automate proxying of requests by writing some code that would model that. So for example I basically need a mapping between external urls to actual api urls and some authorization logic. Maybe there are already something like that?
Docker for the API Gateway It will need some environment to handle requests and responses via server-side code (perhaps Go or Elixir), and it will often be attached to an authentication/authorization service so it can validate requests before proxying them to a micro service.
The Docker Engine API is a RESTful API accessed by an HTTP client such as wget or curl , or the HTTP library which is part of most modern programming languages.
You can create an API Gateway API with private integration to provide your customers access to HTTP/HTTPS resources within your Amazon Virtual Private Cloud (Amazon VPC). Such VPC resources are HTTP/HTTPS endpoints on an EC2 instance behind a Network Load Balancer in the VPC.
I was looking for something similar, including support for rate limiting, UI console, etc. It boils down to a few freemium tools like:
and a few open source ones:
I've decided on tyk since it has a nice UI console and solid docs. All of them were mentioned on Quora, which is nice when you want to go shopping :)
If you like getting your hands dirty, you could quite easily implement your own simplified API Gateway. I believe this approach perfectly fits into microservice paradigm - implement simple service with limited functionality that does only one thing, but does it well.
I've written a tutorial on this subject (implementing simple API Gateway for Dockerized microservices with Node.js). My example is about 100 lines of JavaScript code, it uses node-docker-monitor to listen to Docker events and http-proxy to handle HTTP requests from the clients.
https://memz.co/api-gateway-microservices-docker-node-js/
or alternative solution with SkyDNS and Nginx
https://memz.co/reverse-proxy-nginx-docker-microservices/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With