Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 47 additions & 95 deletions template/frp/README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,3 @@
## frp 是什么?

[frp(Fast Reverse Proxy)](https://github.com/fatedier/frp) 是一个高性能的反向代理工具,使用 Go 语言编写,能够帮助你轻松地将内网服务暴露到公网,实现安全、快速、便捷的内网穿透。它支持 TCP、UDP、HTTP、HTTPS 等多种协议,并提供丰富的功能,例如自定义域名、负载均衡、加密传输等,能够满足各种场景下的内网穿透需求。

目前 frp 在 GitHub 上已经获得了超过 83000 颗星。

![](https://s2.loli.net/2024/08/06/CVWAE9BbHxQh4af.png)

## frp 架构解析

frp 的核心思想是利用反向代理技术,将内网服务通过一个公网服务器进行转发,从而实现外部用户对内网服务的访问。架构图如下:

![](https://s2.loli.net/2024/08/06/PH6hiEWqLfCctQ8.png)

它的工作原理可以简单概括为:

1. 在拥有公网 IP 的服务器上部署 frp 服务端 (frps)。
2. 在内网服务器上部署 frp 客户端 (frpc),并配置需要暴露的服务端口和转发规则。
3. frpc 连接到 frps,建立反向代理通道。
4. 外部用户通过访问 frps 的公网 IP 和端口,最终访问到内网服务。

## frp 的核心功能

**frp 的主要功能特性包括:**

### 多协议支持

- TCP/UDP 穿透:支持最常见的 TCP 和 UDP 协议。
- HTTP/HTTPS 穿透:轻松暴露内网的 Web 服务。
- STCP:为 TCP 连接提供额外的安全层。
- SUDP:安全的 UDP 协议支持。

### 安全特性

- TLS 加密:支持传输层安全协议,保护数据传输。
- 身份验证:提供多种身份验证方式,如 token、OIDC 等。
- 带宽限制:可以对每个代理进行带宽限制,防止资源滥用。

### 高级功能

- 负载均衡:支持多个代理的负载均衡。
- 健康检查:自动检测后端服务的健康状态。
- 热重载:支持配置热重载,无需重启服务。
- 插件系统:提供插件机制,方便功能扩展。

### 易用性

- 简洁的配置:采用 TOML 格式,配置简单直观。
- Dashboard:提供 Web 界面,方便监控和管理。
- 多平台支持:支持 Windows、Linux、MacOS 等多个平台。

### 性能优化

- 连接池:使用连接池技术,提高连接效率。
- 多路复用:支持 TCP 连接的多路复用,减少连接数。
- 压缩传输:可选择开启压缩,节省带宽。

## frp vs. 其他内网穿透解决方案

为了更直观地展示 frp 的优势,我们可以将其与市面上的其他主流内网穿透解决方案进行对比:

| 特性 | frp | ngrok | Cloudflare Tunnel |
| ---------- | --------------- | ---------------- | ----------------- |
| 开源 | 是 | 否 | 否 |
| 免费使用 | 是 | 有限制 | 有限制 |
| 自托管 | 支持 | 不支持 | 不支持 |
| 多协议支持 | TCP/UDP/HTTP(S) | 主要支持 HTTP(S) | HTTP(S) |
| 配置复杂度 | 低 | 中 | 中 |
| 性能 | 高 | 中 | 高 |
| 安全特性 | 丰富 | 基本 | 丰富 |
| 社区支持 | 活跃 | 有限 | 有限 |

虽然 ngrok 在易用性方面略胜一筹,Cloudflare Tunnel 则在全球化部署上有优势,但 frp 在开源友好度、功能灵活性和成本控制上独树一帜。特别是对于希望完全控制内网穿透基础设施的团队来说,frp 提供了一个完美的平衡点。

## 部署 frp

填一下管理面板的用户名和密码:
Expand All @@ -96,13 +22,28 @@ frp 的核心思想是利用反向代理技术,将内网服务通过一个公

是不是有点似曾相识?没错,很像 **Windows 的快捷方式!**

单机操作系统可以这么玩,Sealos 云操作系统当然也可以这么玩。

## frp 的使用

下面我们通过一个简单的例子来快速体验一下 frp 的使用。
下面给出一个“部署完马上可用”的最短路径。假设你要把本地机器上的 `127.0.0.1:80` 暴露到公网。

### 1. 先拿到 3 个关键参数

- `管理面板地址`:应用卡片里的访问地址(对应模板里的管理 Ingress,端口 7500)。
- `serverAddr`:frp 的 HTTP 入口域名(对应模板里的 `app_host_http`)。
- `serverPort`:frp 服务端监听端口(7000)对应的外网端口,来自 `xxx-nodeport` Service 的 `server` 端口。

如果你习惯用 kubectl,可以这样查:

```bash
# 1) HTTP 入口域名(serverAddr)
kubectl -n <namespace> get ingress <app_name1> -o jsonpath='{.spec.rules[0].host}'; echo

# 2) frps 的 serverPort(7000 对应的 nodePort)
kubectl -n <namespace> get svc <app_name>-nodeport -o jsonpath='{.spec.ports[?(@.name=="server")].nodePort}'; echo
```

设我们要将本地 Linux 机器上运行在 80 端口的 Web 服务暴露到公网。首先要在 Web 服务所在的本地机器上下载 frpc 二进制文件:
### 2. 在本地机器下载 frpc

```bash
# 设置 VERSION 环境变量为 latest 版本号
Expand All @@ -116,42 +57,53 @@ tar zxf frp_${VERSION}_linux_amd64.tar.gz
cd frp_${VERSION}_linux_amd64
```

编写客户端配置文件:
### 3. 编写客户端配置 `frpc.toml`

```toml
# frpc.toml
serverAddr = "frp-udkhnlcc.bja.sealos.run"
serverPort = 46451
serverAddr = "你的-http-入口域名.sealos.run"
serverPort = 46451 # 替换为你的 7000 对应外网端口

[[proxies]]
name = "web"
name = "local-web"
type = "http"
localIP = "127.0.0.1"
localPort = 80
customDomains = ["frp-udkhnlcc.bja.sealos.run"]
customDomains = ["你的-http-入口域名.sealos.run"]
```

+ 将 `serverAddr` 的值替换为你的 frp 服务的 80 端口对应的公网地址:
### 4. 启动 frpc

```bash
./frpc -c ./frpc.toml
```

![](https://s2.loli.net/2024/08/06/Qakj7cm2EFgCW6p.png)
### 5. 访问与验证

+ 将 `serverPort` 的值替换为你的 frp 服务的 7000 端口对应的外网端口。在 frp 服务详情页面点击左上角的 “管理所有资源”:
- 打开管理面板:`https://<管理面板地址>`,使用部署时填写的 `ADMIN_USER` / `ADMIN_PASSWORD` 登录。
- 打开业务地址:`https://<serverAddr>`,如果本地 `127.0.0.1:80` 正常,就能看到你的本地服务。

![](https://s2.loli.net/2024/08/06/XmBHDZwxnGQCcUr.png)
### 本地 K8s(无 Sealos 域名)怎么用?

然后将鼠标拉到最下面,即可看到 7000 端口对应的外网端口
如果你是在本地 Kubernetes(没有自动公网域名)部署 frps,也可以使用

![](https://s2.loli.net/2024/08/06/zWyvsoOlZijLKHc.png)
- `serverAddr` 填任意可达 Node IP
- `serverPort` 填 7000 对应的 NodePort

+ 和 serverAddr 一样,将 `customDomains` 的值替换为你的 frp 服务的 80 端口对应的公网地址。
这种场景推荐优先用 `tcp` 代理(不依赖 `customDomains`),示例:

启动 frpc:
```toml
serverAddr = "你的NodeIP"
serverPort = 30070

```bash
./frpc -c ./frpc.toml
[[proxies]]
name = "local-ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 6000
```

现在让我们回到 frp 服务详情页面,点击 80 端口对应的外网地址就能打访问地机器的 Web 服务了。

![](https://s2.loli.net/2024/08/06/kmUKi9zwQIJFChS.png)

## frp 的高级用法
Expand Down Expand Up @@ -268,4 +220,4 @@ frp 作为一款轻量级的内网穿透工具,具有以下优势:
4. 可扩展性强:插件机制使其易于扩展;
5. 活跃度高:社区活跃,持续更新维护。

无论是个人开发测试,还是小型团队内部使用,frp 都是一个非常好的选择。大家可以尝试使用一下,相信会给你的开发工作带来很大的便利。
无论是个人开发测试,还是小型团队内部使用,frp 都是一个非常好的选择。大家可以尝试使用一下,相信会给你的开发工作带来很大的便利。
2 changes: 1 addition & 1 deletion template/frp/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
author: 'Sealos'
description: 'frp 是一个专注于内网穿透的高性能的反向代理应用'
readme: 'https://raw.githubusercontent.com/labring-actions/templates/main/template/frp/README.md'
icon: 'https://raw.githubusercontent.com/fatedier/frp/dev/assets/frps/static/favicon.ico'
icon: ' https://avatars.githubusercontent.com/u/7346661?s=48&v=4'
templateType: inline
locale: zh
i18n:
Expand Down
31 changes: 17 additions & 14 deletions template/openclaw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Openclaw is an AI agent gateway with multi-channel support including WhatsApp, Telegram, and Discord integration. This template deploys a production-ready Openclaw instance with persistent storage on Sealos Cloud.

This template is aligned with the current OpenClaw Docker gateway flow and pins the official `2026.3.28` container image.

## About Hosting Openclaw

Openclaw runs as a single-node AI agent gateway service that provides a unified interface for deploying and managing AI agents across multiple messaging platforms. The Sealos template automatically provisions persistent storage for your agent configurations, workspace data, and WhatsApp session files, ensuring your data is safely stored and survives restarts.
Expand Down Expand Up @@ -33,9 +35,7 @@ The Sealos template includes all required dependencies: runtime environment, per
This template deploys the following services:

- **Openclaw Gateway**: Main AI agent gateway service running on port 18789
- **Persistent Storage**: Two persistent volumes are automatically provisioned:
- Configuration storage (1Gi): Stores agent configurations, model settings, and channel credentials
- Workspace storage (1Gi): Stores agent workspace data and generated files
- **Persistent Storage**: A persistent volume is mounted at `/home/node/.openclaw`, which also contains the default workspace path `/home/node/.openclaw/workspace`

**Configuration:**

Expand All @@ -47,7 +47,7 @@ The Openclaw gateway is configured through environment variables and a configura
- **Gateway Token**: Authentication token for accessing the gateway control UI
- **Channel Tokens**: Optional tokens for Discord, Telegram, WhatsApp, and Slack

The control UI is enabled by default and accessible through the gateway URL with the gateway token parameter. The UI allows you to manage agents, configure channels, and monitor activity without modifying configuration files.
The control UI is enabled by default and accessible through the gateway URL with a token fragment. The UI allows you to manage agents, configure channels, and monitor activity without modifying configuration files.

**Channel Support:**

Expand Down Expand Up @@ -76,17 +76,20 @@ Deploy Openclaw on Sealos and focus on building intelligent AI agents instead of

## Deployment Guide

1. Open the [OpenClaw template](https://sealos.io/products/app-store/clawdbot) and click **Deploy Now**.
1. Open the [OpenClaw template](https://sealos.io/products/app-store/openclaw) and click **Deploy Now**.
2. Configure the parameters in the popup dialog:
- **provider_kind**: Select `openai_compat` or `anthropic_compat`
- **base_url**: Compatible provider base URL (default: `https://aiproxy.usw-1.sealos.io/v1`)
- **api_key**: Provider API key
- **model**: Default model ID (for example `claude-opus-4-6` or `gpt-5.2`)
- **模型提供商类型**: Select `openai_compat` or `anthropic_compat`. The default is `openai_compat`, which matches the default `/v1` endpoint
- **模型接口地址**: Compatible provider base URL (default: `https://aiproxy.usw-1.sealos.io/v1`)
- **API密钥**: Provider API key
- **登录令牌**: Control UI login token. The form defaults to `sealos2026`, but you can replace it with your own token.
- **默认模型**: Default model ID (for example `claude-opus-4-6` or `gpt-5.2`)
3. Wait for deployment to complete (typically 2-3 minutes). After deployment, you will be redirected to the Canvas. For later changes, describe your requirements in the AI dialog or click resource cards to modify settings.
4. Access your application via the provided URLs:
- **Control UI**: Open the generated URL from App resources (includes token and `gatewayUrl` query parameters)
- **Control UI**: Open the generated URL from App resources (includes a `#token=...` fragment)
- **Gateway Endpoint**: Use `https://<your-domain>/` as the OpenClaw gateway base endpoint

Security note: OpenClaw's Control UI is an admin surface. This template is designed for convenient self-hosting on a Sealos HTTPS domain, so keep the generated token private and rotate it if you ever suspect exposure.

## Configuration

After deployment, you can configure Openclaw through multiple methods:
Expand All @@ -95,10 +98,10 @@ After deployment, you can configure Openclaw through multiple methods:

Access the control UI at:
```
https://[your-app-url]/?token=[gateway-token]
https://[your-app-url]/#token=[gateway-token]
```

The gateway token is automatically generated and included in the App access URL shown on the Canvas App card after deployment. The UI provides a web-based interface for:
The gateway token comes from the deployment form and is included in the App access URL shown on the Canvas App card after deployment. The form defaults to `sealos2026`, and the token is passed in the URL fragment so it is not sent to the server. The UI provides a web-based interface for:
- Managing AI agents
- Configuring messaging channels (Telegram, Discord, WhatsApp, Slack)
- Monitoring agent activity
Expand Down Expand Up @@ -130,7 +133,7 @@ Each messaging platform requires specific setup:
4. Invite the bot to your server

**WhatsApp:**
1. WhatsApp session data is stored in persistent storage at `/home/node/.openclaw/whatsapp`
1. WhatsApp session data is stored in persistent storage under `/home/node/.openclaw`
2. Follow the WhatsApp Web QR code authentication process through the control UI
3. Session data persists across container restarts

Expand Down Expand Up @@ -171,7 +174,7 @@ To scale your Openclaw deployment:

**Issue: Cannot access control UI**
- Cause: Incorrect gateway token or URL
- Solution: Use the App URL from the Canvas App card (it already includes token parameters), or append `?token=[gateway-token]` to your gateway URL manually
- Solution: Use the App URL from the Canvas App card (it already includes the token fragment), or append `#token=[gateway-token]` to your gateway URL manually

### Getting Help

Expand Down
31 changes: 17 additions & 14 deletions template/openclaw/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Openclaw 是一款 AI 智能体网关,支持 WhatsApp、Telegram、Discord 等多渠道集成。借助本模板,您可以在 Sealos 云平台上快速部署一个生产就绪的 Openclaw 实例,并自动配置持久化存储。

本模板已对齐 OpenClaw 当前的 Docker 网关部署方式,并固定使用官方 `2026.3.28` 镜像版本。

## 关于托管 Openclaw

Openclaw 以单节点 AI 智能体网关服务的形式运行,为跨多个消息平台部署和管理 AI 智能体提供统一接口。Sealos 模板会自动为您的智能体配置、工作空间数据以及 WhatsApp 会话文件配置持久化存储,确保数据安全可靠,即使服务重启也能完好保存。
Expand Down Expand Up @@ -33,9 +35,7 @@ Sealos 模板已包含所有必需的依赖:运行时环境、用于配置和
本模板部署以下服务:

- **Openclaw 网关**:运行在 18789 端口的主 AI 智能体网关服务
- **持久化存储**:自动配置两个持久卷:
- 配置存储(1Gi):存储智能体配置、模型设置和渠道凭据
- 工作空间存储(1Gi):存储智能体工作空间数据和生成的文件
- **持久化存储**:在 `/home/node/.openclaw` 路径挂载持久卷,默认工作空间 `/home/node/.openclaw/workspace` 也包含在其中

**配置方式:**

Expand All @@ -47,7 +47,7 @@ Openclaw 网关通过环境变量和初始化时生成的配置文件进行配
- **Gateway Token**:访问网关控制 UI 的认证令牌
- **Channel Tokens**:Discord、Telegram、WhatsApp 和 Slack 的可选令牌

控制 UI 默认启用,可通过网关 URL 加上网关令牌参数访问。该 UI 让您能够管理智能体、配置渠道、监控活动,无需手动修改配置文件。
控制 UI 默认启用,可通过带网关令牌片段的访问地址打开。该 UI 让您能够管理智能体、配置渠道、监控活动,无需手动修改配置文件。

**渠道支持:**

Expand Down Expand Up @@ -76,17 +76,20 @@ Sealos 是一个基于 Kubernetes 构建的 AI 赋能云操作系统,将整个

## 部署指南

1. 打开 [OpenClaw 模板页面](https://sealos.io/products/app-store/clawdbot),点击 **Deploy Now**。
1. 打开 [OpenClaw 模板页面](https://sealos.io/products/app-store/openclaw),点击 **Deploy Now**。
2. 在弹窗中配置以下参数:
- **provider_kind**:选择 `openai_compat` 或 `anthropic_compat`
- **base_url**:兼容提供商的基础 URL(默认:`https://aiproxy.usw-1.sealos.io/v1`)
- **api_key**:提供商 API Key
- **model**:默认模型 ID(例如 `claude-opus-4-6` 或 `gpt-5.2`)
- **模型提供商类型**:选择 `openai_compat` 或 `anthropic_compat`。默认值为 `openai_compat`,与默认的 `/v1` 接口地址保持一致
- **模型接口地址**:兼容提供商的基础 URL(默认:`https://aiproxy.usw-1.sealos.io/v1`)
- **API密钥**:提供商 API Key
- **登录令牌**:控制台登录认证 Token。表单默认值为 `sealos2026`,你也可以改成自己的。
- **默认模型**:默认模型 ID(例如 `claude-opus-4-6` 或 `gpt-5.2`)
3. 等待部署完成(通常 2-3 分钟)。部署成功后会自动跳转到 Canvas。后续修改可在 AI 对话框描述需求,或点击对应资源卡调整配置。
4. 通过以下地址访问应用:
- **控制台 UI**:使用 App 资源生成的访问链接(已包含 token 与 `gatewayUrl` 参数
- **控制台 UI**:使用 App 资源生成的访问链接(已包含 `#token=...` 片段
- **网关端点**:`https://<your-domain>/` 可作为 OpenClaw 网关基础地址

安全提示:OpenClaw 的 Control UI 属于管理面。这个模板为了在 Sealos 的 HTTPS 域名上直接可用,默认生成可登录的访问令牌,因此请妥善保管该令牌;如怀疑泄露,请及时轮换。

## 配置说明

部署完成后,您可以通过多种方式配置 Openclaw:
Expand All @@ -95,10 +98,10 @@ Sealos 是一个基于 Kubernetes 构建的 AI 赋能云操作系统,将整个

通过以下地址访问控制界面:
```
https://[您的应用地址]/?token=[gateway-token]
https://[您的应用地址]/#token=[gateway-token]
```

网关令牌会在部署后自动生成,并包含在 Canvas 中 App 资源卡展示的访问链接里。该界面提供基于 Web 的管理功能:
网关令牌来自部署表单配置,并会包含在部署后 Canvas 中 App 资源卡展示的访问链接里。表单默认值为 `sealos2026`,令牌放在 URL 片段中,不会随请求发送到服务器。该界面提供基于 Web 的管理功能:
- 管理 AI 智能体
- 配置消息渠道(Telegram、Discord、WhatsApp、Slack)
- 监控智能体活动
Expand Down Expand Up @@ -130,7 +133,7 @@ https://[您的应用地址]/?token=[gateway-token]
4. 邀请机器人加入您的服务器

**WhatsApp:**
1. WhatsApp 会话数据存储在持久化存储的 `/home/node/.openclaw/whatsapp` 路径
1. WhatsApp 会话数据存储在持久化存储的 `/home/node/.openclaw` 目录下
2. 通过控制界面按照 WhatsApp Web 二维码认证流程操作
3. 会话数据在容器重启后依然保存

Expand Down Expand Up @@ -171,7 +174,7 @@ https://[您的应用地址]/?token=[gateway-token]

**问题:无法访问控制界面**
- 原因:网关令牌或 URL 错误
- 解决方案:优先使用 Canvas 中 App 资源卡提供的访问链接(已包含 token 参数),或在网关 URL 后手动追加 `?token=[网关令牌]`
- 解决方案:优先使用 Canvas 中 App 资源卡提供的访问链接(已包含 token 片段),或在网关 URL 后手动追加 `#token=[网关令牌]`

### 获取帮助

Expand Down
Loading