feat: 添加搜索收藏微服务
This commit is contained in:
@@ -29,7 +29,7 @@ docker compose down
|
||||
|
||||
构建脚本会扫描 `app/` 下所有 `api`、`rpc`、`mq`、`adapter` 入口,通过 `docker buildx bake` 并行构建所有服务镜像,生成 `juwan/<service>-<type>:dev`。
|
||||
|
||||
端到端接口测试走网关 `http://127.0.0.1:18080`,`18801-18809` 是各服务的直连端口,不经过认证链路。
|
||||
端到端接口测试走网关 `http://127.0.0.1:18080`,`18801-18813` 是各服务的直连端口,不经过认证链路。
|
||||
|
||||
如需只启动部分服务:
|
||||
|
||||
@@ -54,6 +54,10 @@ docker compose up -d postgres redis snowflake player-rpc player-api
|
||||
| community-api | 18807 |
|
||||
| objectstory-api | 18808 |
|
||||
| email-api | 18809 |
|
||||
| review-api | 18810 |
|
||||
| dispute-api | 18811 |
|
||||
| notification-api | 18812 |
|
||||
| search-api | 18813 |
|
||||
|
||||
## 环境变量
|
||||
|
||||
|
||||
@@ -125,6 +125,8 @@ services:
|
||||
condition: service_started
|
||||
notification-api:
|
||||
condition: service_started
|
||||
search-api:
|
||||
condition: service_started
|
||||
|
||||
ratelimit:
|
||||
image: envoyproxy/ratelimit:05c08d03
|
||||
@@ -306,6 +308,19 @@ services:
|
||||
snowflake:
|
||||
condition: service_started
|
||||
|
||||
search-rpc:
|
||||
image: juwan/search-rpc:dev
|
||||
container_name: juwan-search-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
|
||||
# ==================== API 层 ====================
|
||||
users-api:
|
||||
image: juwan/users-api:dev
|
||||
@@ -453,6 +468,17 @@ services:
|
||||
notification-rpc:
|
||||
condition: service_started
|
||||
|
||||
search-api:
|
||||
image: juwan/search-api:dev
|
||||
container_name: juwan-search-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18813:8888"
|
||||
depends_on:
|
||||
search-rpc:
|
||||
condition: service_started
|
||||
|
||||
# ==================== MQ ====================
|
||||
email-mq:
|
||||
image: juwan/email-mq:dev
|
||||
|
||||
@@ -224,6 +224,32 @@ static_resources:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
|
||||
disabled: true
|
||||
|
||||
- match:
|
||||
path: /api/v1/search
|
||||
headers:
|
||||
- name: ":method"
|
||||
exact_match: GET
|
||||
route:
|
||||
cluster: search_api_cluster
|
||||
timeout: 30s
|
||||
typed_per_filter_config:
|
||||
envoy.filters.http.ext_authz:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
|
||||
disabled: true
|
||||
|
||||
- match:
|
||||
prefix: /api/v1/recommendations
|
||||
headers:
|
||||
- name: ":method"
|
||||
exact_match: GET
|
||||
route:
|
||||
cluster: search_api_cluster
|
||||
timeout: 30s
|
||||
typed_per_filter_config:
|
||||
envoy.filters.http.ext_authz:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
|
||||
disabled: true
|
||||
|
||||
- match:
|
||||
prefix: /api/v1/posts
|
||||
headers:
|
||||
@@ -249,6 +275,14 @@ static_resources:
|
||||
cluster: user_api_cluster
|
||||
timeout: 30s
|
||||
|
||||
- match:
|
||||
safe_regex:
|
||||
google_re2: {}
|
||||
regex: "^/api/v1/users/[0-9]+/favorites/check$"
|
||||
route:
|
||||
cluster: search_api_cluster
|
||||
timeout: 30s
|
||||
|
||||
- match:
|
||||
prefix: /api/v1/users
|
||||
route:
|
||||
@@ -377,6 +411,12 @@ static_resources:
|
||||
cluster: notification_api_cluster
|
||||
timeout: 30s
|
||||
|
||||
- match:
|
||||
prefix: /api/v1/favorites
|
||||
route:
|
||||
cluster: search_api_cluster
|
||||
timeout: 30s
|
||||
|
||||
- match:
|
||||
prefix: /
|
||||
direct_response:
|
||||
@@ -633,6 +673,16 @@ static_resources:
|
||||
headers:
|
||||
- name: ":method"
|
||||
exact_match: GET
|
||||
- match:
|
||||
path: /api/v1/search
|
||||
headers:
|
||||
- name: ":method"
|
||||
exact_match: GET
|
||||
- match:
|
||||
path: /api/v1/recommendations/home
|
||||
headers:
|
||||
- name: ":method"
|
||||
exact_match: GET
|
||||
- match:
|
||||
prefix: /api/v1
|
||||
requires:
|
||||
@@ -838,6 +888,20 @@ static_resources:
|
||||
address: notification-api
|
||||
port_value: 8888
|
||||
|
||||
- name: search_api_cluster
|
||||
connect_timeout: 2s
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: search_api_cluster
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: search-api
|
||||
port_value: 8888
|
||||
|
||||
- name: authz_adapter_cluster
|
||||
connect_timeout: 0.5s
|
||||
type: STRICT_DNS
|
||||
|
||||
Reference in New Issue
Block a user