What are the option to API gateway with docker?

痞子三分冷 提交于 2019-12-04 08:35:27

问题


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?


回答1:


I was looking for something similar, including support for rate limiting, UI console, etc. It boils down to a few freemium tools like:

  • apigee
  • mashape
  • apiary
  • 3scale.net

and a few open source ones:

  • tyk
  • kong
  • ApiAxle
  • WSO2
  • API Umbrella

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 :)




回答2:


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/



来源:https://stackoverflow.com/questions/31546631/what-are-the-option-to-api-gateway-with-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!