dev
This commit is contained in:
parent
2d8e7c10eb
commit
b8e17ce7d4
|
@ -30,13 +30,13 @@ export default defineConfig({
|
|||
text: 'Base 基础微服务',
|
||||
items: [
|
||||
{ text: 'Initialize 初始化', link: '/base/initialize' },
|
||||
{ text: 'FTS 文件传输服务', link: '/base/fts' },
|
||||
{ text: 'FTS 文件传输', link: '/base/fts' },
|
||||
{ text: 'Notify 通知', link: '/base/notify' },
|
||||
{ text: 'Push 消息推送', link: '/base/push' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Service 服务库',
|
||||
text: 'Service 微服务库',
|
||||
items: [
|
||||
{ text: 'Passport 通行证', link: '/service/passport/index' },
|
||||
{ text: 'ECommerce 电商', link: '/service/ec/index' },
|
||||
|
@ -46,6 +46,7 @@ export default defineConfig({
|
|||
{ text: 'IM 即时通讯', link: '/service/im/index' },
|
||||
{ text: 'IoT 物联网', link: '/service/iot/index' },
|
||||
{ text: 'Mgt 管理端', link: '/service/mgt/index' },
|
||||
{ text: 'Other 其它微服务', link: '/service/other/index' },
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
# Initialize 初始化微服务
|
||||
|
||||
## 介绍
|
||||
|
||||
Gateway 网关服务是一个用 Go 语言开发的高性能 API 网关,旨在帮助开发者轻松管理和路由微服务请求。通过使用此网关,您可以集中处理身份验证、负载均衡、API 版本控制以及请求和响应的转换等功能。
|
||||
|
||||
## 源码仓库
|
||||
```
|
||||
https://git.apinb.com/bsm-service-base/initialize
|
||||
```
|
||||
|
||||
## 功能特性
|
||||
|
||||
- **路由管理**:自动发现注册的GRPC微服务,实现动态管理路由。
|
||||
- **支持协议**:同时支持Grpc/Restful协议,自动映射转发。
|
||||
- **负载均衡**:支持多种负载均衡策略(轮询、随机等)。
|
||||
- **身份验证**:网关实现身份验证,采用不可视化的JWT机制。
|
||||
- **监控和日志**:实时监控请求日志,方便问题排查和性能优化。
|
||||
|
||||
## 安装
|
||||
|
||||
要安装 Gateway 网关服务,请确保您已经安装了 bsm cli。:
|
||||
|
||||
```bash
|
||||
bsm install gateway
|
||||
```
|
||||
|
||||
## 配置文件说明
|
||||
|
||||
在 `etc/` 目录中,根据dev,test,prod环境不同读取不同的配置文件,您可以配置网关的基本设置,例如:
|
||||
|
||||
gateway_prod.yaml
|
||||
```yaml
|
||||
Name: bsm-gateway
|
||||
|
||||
Open:
|
||||
- rpc
|
||||
- http
|
||||
|
||||
TLS:
|
||||
Ca: /usr/local/bsm/cert/ca.crt
|
||||
Cert: /usr/local/bsm/cert/server.crt
|
||||
Key: /usr/local/bsm/cert/server.key
|
||||
|
||||
Rpc:
|
||||
Addr: 0.0.0.0:10020
|
||||
|
||||
Http:
|
||||
Addr: 0.0.0.0:10021
|
||||
|
||||
Https:
|
||||
Addr: 0.0.0.0:10022
|
||||
|
||||
Etcd:
|
||||
Endpoints:
|
||||
- 127.0.0.1:2379
|
||||
```
|
||||
|
||||
### 配置项说明
|
||||
|
||||
- **Open**:要开通的服务。
|
||||
- **TLS**:数字证书,用于SSL和GRPC客户端连接。
|
||||
- **Rpc/Http/Https**:Rpc/Http/Https监听端口。
|
||||
- **Etcd**:ETCD服务配置。
|
||||
|
||||
## 启动网关
|
||||
|
||||
使用以下命令启动网关服务:
|
||||
|
||||
```bash
|
||||
bsm start gateway
|
||||
```
|
||||
查看启动日志 `./logs/gateway-v0.2.4.log`
|
||||
```
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway Starting...
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway Runtime Mode: test
|
||||
2024/10/04 11:27:15 [Blocks Service] Service Route Prefix: service.
|
||||
2024/10/04 11:27:15 [Blocks Service] Service Anonymous Prefix: anonymous.
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway Service Build: Version v0.2.3, Go Version linux/amd64 golang:1.23.1-bookworm By 2024-10-03 20:56:05
|
||||
2024/10/04 11:27:15 [Blocks Service] Connectd ETCD:[127.0.0.1:2379]
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway HTTP Proxy Addr [0.0.0.0:10021] Runing Success!
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway RPC Proxy Addr [0.0.0.0:10020] Runing Success!
|
||||
```
|
||||
## 测试网关
|
||||
|
||||
一旦服务启动,您可以使用 `curl` 或 Postman 等工具发送请求。例如:
|
||||
|
||||
```bash
|
||||
curl http://localhost:10021/ping
|
||||
```
|
||||
正常时,返回:
|
||||
```
|
||||
PONG
|
||||
```
|
||||
## 查看日志
|
||||
|
||||
网关服务会将日志存储至: `/usr/local/bsm/logs/` 目录下。
|
|
@ -0,0 +1,97 @@
|
|||
# Gateway API网关
|
||||
|
||||
## 介绍
|
||||
|
||||
Gateway 网关服务是一个用 Go 语言开发的高性能 API 网关,旨在帮助开发者轻松管理和路由微服务请求。通过使用此网关,您可以集中处理身份验证、负载均衡、API 版本控制以及请求和响应的转换等功能。
|
||||
|
||||
## 源码仓库
|
||||
```
|
||||
https://git.apinb.com/bsm-infra/gateway
|
||||
```
|
||||
|
||||
## 功能特性
|
||||
|
||||
- **路由管理**:自动发现注册的GRPC微服务,实现动态管理路由。
|
||||
- **支持协议**:同时支持Grpc/Restful协议,自动映射转发。
|
||||
- **负载均衡**:支持多种负载均衡策略(轮询、随机等)。
|
||||
- **身份验证**:网关实现身份验证,采用不可视化的JWT机制。
|
||||
- **监控和日志**:实时监控请求日志,方便问题排查和性能优化。
|
||||
|
||||
## 安装
|
||||
|
||||
要安装 Gateway 网关服务,请确保您已经安装了 bsm cli。:
|
||||
|
||||
```bash
|
||||
bsm install gateway
|
||||
```
|
||||
|
||||
## 配置文件说明
|
||||
|
||||
在 `etc/` 目录中,根据dev,test,prod环境不同读取不同的配置文件,您可以配置网关的基本设置,例如:
|
||||
|
||||
gateway_prod.yaml
|
||||
```yaml
|
||||
Name: bsm-gateway
|
||||
|
||||
Open:
|
||||
- rpc
|
||||
- http
|
||||
|
||||
TLS:
|
||||
Ca: /usr/local/bsm/cert/ca.crt
|
||||
Cert: /usr/local/bsm/cert/server.crt
|
||||
Key: /usr/local/bsm/cert/server.key
|
||||
|
||||
Rpc:
|
||||
Addr: 0.0.0.0:10020
|
||||
|
||||
Http:
|
||||
Addr: 0.0.0.0:10021
|
||||
|
||||
Https:
|
||||
Addr: 0.0.0.0:10022
|
||||
|
||||
Etcd:
|
||||
Endpoints:
|
||||
- 127.0.0.1:2379
|
||||
```
|
||||
|
||||
### 配置项说明
|
||||
|
||||
- **Open**:要开通的服务。
|
||||
- **TLS**:数字证书,用于SSL和GRPC客户端连接。
|
||||
- **Rpc/Http/Https**:Rpc/Http/Https监听端口。
|
||||
- **Etcd**:ETCD服务配置。
|
||||
|
||||
## 启动网关
|
||||
|
||||
使用以下命令启动网关服务:
|
||||
|
||||
```bash
|
||||
bsm start gateway
|
||||
```
|
||||
查看启动日志 `./logs/gateway-v0.2.4.log`
|
||||
```
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway Starting...
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway Runtime Mode: test
|
||||
2024/10/04 11:27:15 [Blocks Service] Service Route Prefix: service.
|
||||
2024/10/04 11:27:15 [Blocks Service] Service Anonymous Prefix: anonymous.
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway Service Build: Version v0.2.3, Go Version linux/amd64 golang:1.23.1-bookworm By 2024-10-03 20:56:05
|
||||
2024/10/04 11:27:15 [Blocks Service] Connectd ETCD:[127.0.0.1:2379]
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway HTTP Proxy Addr [0.0.0.0:10021] Runing Success!
|
||||
2024/10/04 11:27:15 [Blocks Service] gateway RPC Proxy Addr [0.0.0.0:10020] Runing Success!
|
||||
```
|
||||
## 测试网关
|
||||
|
||||
一旦服务启动,您可以使用 `curl` 或 Postman 等工具发送请求。例如:
|
||||
|
||||
```bash
|
||||
curl http://localhost:10021/ping
|
||||
```
|
||||
正常时,返回:
|
||||
```
|
||||
PONG
|
||||
```
|
||||
## 查看日志
|
||||
|
||||
网关服务会将日志存储至: `/usr/local/bsm/logs/` 目录下。
|
Loading…
Reference in New Issue