From 330dcdd36a5666adde400def671ebd52ef7ea88b Mon Sep 17 00:00:00 2001 From: yanweidong Date: Fri, 4 Oct 2024 11:53:57 +0800 Subject: [PATCH] dev --- src/infra/gateway.md | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/infra/gateway.md b/src/infra/gateway.md index cf3e909..7f10099 100644 --- a/src/infra/gateway.md +++ b/src/infra/gateway.md @@ -38,9 +38,9 @@ Open: - http TLS: - Ca: /usr/local/bsm/cert/tls/scf.ca.crt - Cert: /usr/local/bsm/cert/tls/scf.server.crt - Key: /usr/local/bsm/cert/tls/scf.server.key + 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 @@ -53,14 +53,15 @@ Https: Etcd: Endpoints: - - 192.168.5.161:2379 + - 127.0.0.1:2379 ``` ### 配置项说明 -- **server.port**:指定网关监听的端口。 -- **routes**:定义路由规则,包括路径、请求方法和对应的后端服务。 -- **authentication**:配置身份验证选项。 +- **Open**:要开通的服务。 +- **TLS**:数字证书,用于SSL和GRPC客户端连接。 +- **Rpc/Http/Https**:Rpc/Http/Https监听端口。 +- **Etcd**:ETCD服务配置。 ## 启动网关 @@ -69,15 +70,28 @@ 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:8080/api/v1/resource +curl http://localhost:10021/ping +``` +正常时,返回: +``` +PONG ``` - ## 查看日志 -网关服务会在控制台输出访问日志,您可以根据日志信息进行监控与调试。 +网关服务会将日志存储至: `/usr/local/bsm/logs/` 目录下。