Goku API Gateway deployment of several ways, the fastest one minute can be used as a gateway on

What is Goku API Gateway?

(Reprinted to https://segmentfault.com/a/1190000020948193 )

Goku API Gateway (Chinese name: Wukong API Gateway) is based on a service run Golang development of micro-enterprise system services gateway on the border. When you build a website, App, IOT even when open API trading, Goku API Gateway can help you to extract internal systems duplicate components out and placed running on Goku, such as user authorization, access control, firewall, data conversion, etc. ; and Goku feature provides service orchestration, so that companies can quickly obtain the required data from a range of services to business fast response.

Community version of Goku API Gateway (CE) has improved the user guide and secondary development guidelines, Go code uses pure language, with good performance and scalability, and built-in plug-in system allows businesses to customize for their own business development. Use Goku API Gateway enables a more focused business development team to achieve business.

A complete set of Goku API Gateway consists of a  console  and  a number of gateway node  components. Nodes by IP address registered in the console, in the console configuration items will take effect for all nodes. Console used to run the gateway configuration information, such as access policies, forwarding API information, etc.; actual node for forwarding. When the console has released the latest configuration, all nodes will take the initiative to update their running configuration; the console release of version management configuration support, you can manually release and rollback.

Goku API Gateway supports multiple gateway node cluster management, which allows users access to different clusters so that the purpose of the different service address access.

The following are two DC (Data Center) deployment architecture diagram of an example:
Here Insert Picture Description
Goku gateway node in addition to obtaining the Console directly, but also supports direct reads the configuration file way to use. Profiles can be derived through online console EOLINKER official, the online console that allows users to easily modify the configuration, edit the configuration file after export, you can put on the server node.

Online console Address: http://goku-console.eolinker.com

Then use online console can not distinguish between different clusters, or recommendations for the use of more powerful features to deploy their own private cloud console.

In this paper, several Goku API Gateway is deployed:

A node online console docker +

Second, the online console node docker + Docker

Third, using the installation package installed directly

Links need to use to deploy the installation:

A node online console Docker +

Goku API Gateway nodes provide Docker Docker and console, the fastest way is to deploy only Docker node, and then configure the gateway to online information via the console, export the configuration file is completed and uploaded to the server node, and finally start node Docker.

Steps for usage

1. Once configured, the console's online Home export configurations:
Here Insert Picture Description
2, will be uploaded to the server configuration, start docker:

docker run -dt -p {转发端口号}:6689 \
-v {日志挂载地址}:/app/goku-ce/node/work \
-v {配置文件地址}:/app/goku-ce/node/work/goku-node.json \
eolinker/goku-api-gateway-ce-node

Full configuration example as follows:

docker run -dt -p 6689:6689 \
-v /app/goku-ce/node/work:/app/goku-ce/node/work \ -v /app/goku-ce/node/versionConfig_b14a1af4-b961-4dfb-8bfe-d4d157dd651e.json:/app/goku-ce/node/work/goku-node.json \ eolinker/goku-api-gateway-ce-node

API to access the gateway address is: {{Node IP: Port}} / {{forwarding URL}}.

二、节点Docker+控制台Docker

(一)部署控制台

1、 创建goku-ce专属网络

docker network create --driver bridge --subnet=172.18.12.0/24 --gateway=172.18.12.1 goku-ce

2、运行控制台程序

docker run -dt -p {浏览器访问端口号}:7000 \
-v {sqlite数据库挂载地址}:/app/goku-ce/console/work \
-e GOKU_ADMIN_PASSWORD={控制台admin密码} \
--network=goku-ce \
--ip 172.18.12.2 \ --name goku-ce-console \ eolinker/goku-api-gateway-ce-console

完整示例启动如下:

docker run -dt -p 7000:7000 \
-v /app/goku-ce/work:/app/goku-ce/console/work \
-e GOKU_ADMIN_PASSWORD=123456 \
--network=goku-ce \
--ip 172.18.12.2 \
--name goku-ce-console \
eolinker/goku-api-gateway-ce-console

3、 登录控制台

打开浏览器,输入 域名/IP+浏览器访问端口号,进入控制台页面,输入用户名(admin)及密码(启动设置的admin密码)进行登录:
Here Insert Picture Description

(二)部署网关节点

1、进入控制台,新建节点

节点IP需要和启动节点docker容器时绑定的IP 一致:
Here Insert Picture Description
点击查看 新建节点详细教程

2、在控制台生成并发布配置

发布配置后,节点会读取控制台的最新配置来运行。

点击查看 发布配置的教程链接

3、启动节点docker容器

docker run -dt -p {转发端口号}:6689 \
--network goku-ce \
--ip {节点IP} \
-v {日志挂载地址}:/app/goku-ce/node/work \
-e GOKU_ADMIN_ADDRESS={控制台IP}:7005 \ eolinker/goku-api-gateway-ce-node

完整示例如下:

docker run -dt -p 6689:6689 \
--network goku-ce \
--ip 172.18.12.3 \
-v /app/goku-ce/work:/app/goku-ce/node/work \
-e GOKU_ADMIN_ADDRESS=172.18.12.2:7005 \
eolinker/goku-api-gateway-ce-node

4、查看节点运行状态

进入节点管理页面,若节点的状态显示为运行中,则节点正常启动:
Here Insert Picture Description

三、通过安装包直接部署

安装准备:到Github上下载最新的Release包。

项目地址:https://github.com/eolinker/g...

(一)安装控制台

1、安装命令:

mkdir -p {install dir}
mv console-{version}.tar.gz {tmp}/
cd {tmp}/
tar -xzf console-{version}.tar.gz
cd console-{version} && ./install.sh {install dir}
cd {install dir}

2、首次安装进入{install dir}/console/config文件夹,编辑配置文件内容,配置语法参照yaml。

goku.conf 如下:

admin_bind: 绑定节点获取配置的地址,形如IP:Port,填写内网地址或本机地址
listen_port: 管理后台监听端口,可以开放给外网访问
db_type: 数据库类型,v3.1.0只支持 sqlite
db_path: sqlite db的文件路径

3、进入{install dir}/console文件夹,运行run.sh文件以启动控制台。

首次运行:

./run.sh start {config file} 管理员账号 管理员密码

示例:

./run.sh start config/goku.conf admin 123456

非首次运行:

./run.sh start|restart

4、在浏览器输入服务器IP+程序监听端口号,进入控制台页面

注:程序监听端口号为goku.conf的配置项listen_port的值

(二)、节点安装

1、安装命令:

  mkdir -p {install dir}
  mv goku-node-{version}.tar.gz {tmp}/
  cd {tmp}/ tar -xzf goku-node-{version}.tar.gz cd goku-node-{version} && ./install.sh {install dir} cd {install dir}

2、在控制台新建节点

(1)登录控制台,一级菜单选择 网关节点,创建集群:
Here Insert Picture Description
(2)进入相应的集群,为不同集群 添加节点
Here Insert Picture Description
(3)点击 新增节点 按钮,填写节点信息后点击 确定

  • 新建节点时的节点IP字段填写内网IP或本地IP
  • 若配置文件(goku.conf)中的admin_bind字段值IP部分为127.0.0.1或localhost,此处节点IP必须填写127.0.0.1

3、启动节点程序:

{install dir}/run.sh {start|stop|reload|restart|force-reload} [admin url] [port]

此处的admin url值与配置文件(goku.conf)中的admin_bind字段值一致。

示例:

{install dir}/run.sh start 127.0.0.1:7005 7702

4、检查节点是否正常运行:

The gateway node into the console page, if the node status is shown as running, the node starts normally:
Here Insert Picture Description
Finally, you can also compile Master branch on Github code, compile the latest content to install, compile Tutorial: HTTPS: // help.eolinker.com/#/tutorial/?groupID=c-372&productID=19

Related Links

节点Dockerhttps://hub.docker.com/r/eoli...

Console Docker : HTTPS: //hub.docker.com/r/eoli ...

New on the console : http://goku-console.eolinker.com

Project Address : HTTPS: //github.com/eolinker/g ...

Project official website : https://www.eolinker.com

Guess you like

Origin www.cnblogs.com/jackey2015/p/11827539.html