Giter Site home page Giter Site logo

gateway's Introduction

Gitter Build Status Go Report Card

Gateway/简体中文

Gateway is a restful API gateway based on HTTP, which can be used as a unified API access layer.

Tutorial

A very detailed tutorial for beginners. Link
Below are video tutorials.
Basics:

Routing Configuration Tutorial:

JWT Plugin Configuration Tutorial:

Attention

Please make sure your Go version is 1.10 or above. Otherwise, undefined "math/rand".Shuffle error will occur when compiling. StackOverFlow Link

Features

  • Traffic Control (on Server or API)
  • Circuit Breaker (on Server or API)
  • Load Balance
  • Service Discovery
  • Plugin
  • Routing (Divert Traffic, Duplicate Traffic)
  • API Aggregation
  • API Argument Check
  • API Access Control (White and Black List)
  • API Default Return Value
  • API Customized Return Value
  • API Result Cache
  • JWT Authorization
  • API Metric Imports Prometheus
  • API Retry After Failure
  • Backend Server Health Check
  • Open Management of API (GRPC、Restful)
  • Websocket Support
  • Online Data Migration Support

Docker

The following content requires reader some knowledge of Docker. You can refer to this book, or check out the official documentation

Quick Start

Use docker pull fagongzi/gateway command to download gateway Docker image. docker run -d -p 9093:9093 -p 80:80 -p 9092:9092 fagongzi/gateway initiates the container. 3 Ports are exposed:

  • 80

    Proxy's HTTP port, this port is for client access.

  • 9092

    APIServer's external GRPC port

  • 9093

    APIServer's external HTTP Restful port. Visit http://127.0.0.1:9093/ui/index.html to access the web UI.

Running parameters can be set by the following environment varaibles. Configuration overrides default.

  • GW_PROXY_OPTS

    All options in proxy --help are supported.

  • API_SERVER_OPTS

    All options in apiserver --help are supported.

  • ETCD_OPTS

    All options in etcd --help are supported.

Available Docker Images

  • fagongzi/gateway

    A quick start image, consisting of three components: etcd, proxy, apiserver, Only intended for quick start experience. Do not use in production.

  • fagongzi/proxy

    proxy component, production ready

  • fagongzi/apiserver

    apiserver component, production ready

Architecture

Web UI

Available Gateway Web UI Projects:

Components

Gateway consists of proxy and apiserver.

Proxy

Proxy is a component which provides service to clients. Proxy is a stateless node. Multiple proxies can be deployed to handle huge traffic. More.

ApiServer

ApiServer provides GRPC and Restful to manage metadata for users. ApiServer integrates official Web UI. More.

Concepts of Gateway

Server

A server is a a real backend service. More.

Cluster

Cluster consists of servers which provide the same service. A server is chosen to handle a specific request based on a load balance strategy. More.

API

API is a key concept of Gateway. We can manage external APIs in Gateway and their distribution rules, aggregation rules and URL matching rules. More.

Routing

Routing is a route strategy. Cookie, Querystring, Header and Path in HTTP Request dictate traffic distribution and traffic duplication to a specific cluster. Through this feature, AB test and online traffic divertion is achieved. More.

Getting Involved

More

WeChat

Sponsor

Open source is not easy. If this project is helpful to you, you can buy me a drink, thank you!

Wechat

Alipay

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.