Files
2026-06-03 12:06:34 +08:00

56 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# router-proxy
独立的实例入口反向代理:
- 对外暴露一个统一端口
-`Host` 头把专属 URL 转发到对应 `app-instance` 容器
- 路由表从 `app-instance/runtime/registry/instances.json` 动态生成
## 文件
- `nginx.conf`
- Nginx 主配置
- `render-routes.py`
- 从实例注册表生成 `runtime/conf.d/instances.conf`
- `start-proxy.sh`
- 启动路由代理容器
- `reload-proxy.sh`
- 重载路由配置
## 默认约定
- 容器名:`beaver-router-proxy`
- Docker network`beaver-instance-edge`
- 对外端口:`8088`
建议直接参考:
- [`.env.example`](/home/ivan/xuan/beaver_project/router-proxy/.env.example)
`REGISTRY_PATH``OUTPUT_PATH` 一般不需要配。
这两个是主机侧脚本路径,默认值会按 `start-proxy.sh` 自己所在目录推导,比写死某台机器上的绝对路径更稳。
## 启动
```bash
cd /home/ivan/xuan/beaver_project/router-proxy
./start-proxy.sh
```
## 重载
```bash
cd /home/ivan/xuan/beaver_project/router-proxy
./reload-proxy.sh --start-if-missing
```
## URL 约定
如果 deploy-control 侧使用默认配置,实例 URL 形如:
```text
http://<instance-slug>.localhost:8088
```
只要本机或 DNS 能把该域名解析到代理所在机器,就会由该代理转发到目标实例容器。