Skip to content

Commit dbb4320

Browse files
author
shijiashuai
committed
docs: fix README issues - fix Docker commands, add system requirements, add security warnings
- Fix docker build path (add -f deploy/docker/Dockerfile) - Fix docker compose command (cd deploy/docker first) - Add Node.js 20+ prerequisite - Add System Requirements section with resource recommendations - Add production security warnings for WS_ALLOWED_ORIGINS and TURN - Rename 'Zero-Dependency' to 'No-Build Frontend' for accuracy - Add Makefile commands reference (make check, make dev) - Update both English and Chinese README
1 parent f411702 commit dbb4320

2 files changed

Lines changed: 54 additions & 8 deletions

File tree

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- [🚀 Quick Start](#-quick-start)
3737
- [🏗️ Architecture](#️-architecture)
3838
- [📚 Documentation](#-documentation)
39+
- [📊 System Requirements](#-system-requirements)
3940
- [⚙️ Configuration](#️-configuration)
4041
- [🚀 Deployment](#-deployment)
4142
- [🤝 Contributing](#-contributing)
@@ -61,7 +62,7 @@
6162

6263
### Production Ready
6364
- **🔒 Security-First** — Origin validation, identity binding, rate limiting
64-
- **📦 Zero-Dependency Frontend** — Pure vanilla JavaScript
65+
- **📦 No-Build Frontend** — Pure vanilla JavaScript, zero build step
6566
- **🐳 Docker Ready** — Multi-stage builds for minimal image size
6667
- **🧪 Well Tested** — Unit tests, e2e tests with Playwright
6768
- **📝 Bilingual Docs** — Complete EN/ZH documentation
@@ -77,6 +78,7 @@
7778
### Prerequisites
7879

7980
- [Go 1.22+](https://golang.org/dl/)
81+
- [Node.js 20+](https://nodejs.org/) (for frontend/e2e tests)
8082
- Modern browser (Chrome 90+, Firefox 88+, Safari 14+)
8183
- [Docker](https://www.docker.com/) (optional)
8284

@@ -95,15 +97,17 @@ go run ./cmd/server
9597
### Option 2: Docker
9698

9799
```bash
98-
docker build -t webrtc .
100+
# Build from project root
101+
docker build -f deploy/docker/Dockerfile -t webrtc .
99102
docker run --rm -p 8080:8080 webrtc
100103
```
101104

102105
### Option 3: Docker Compose (Production)
103106

104107
```bash
108+
# From project root
105109
export DOMAIN=your-domain.com
106-
docker compose up -d
110+
cd deploy/docker && docker compose up -d
107111
```
108112

109113
Visit `https://your-domain.com` with automatic HTTPS via Caddy.
@@ -209,6 +213,18 @@ webrtc/
209213

210214
---
211215

216+
## 📊 System Requirements
217+
218+
| Scenario | Recommended |
219+
|:---------|:------------|
220+
| Development | 1 core, 2GB RAM |
221+
| Single Room (< 10 users) | 1 core, 1GB RAM |
222+
| 50-user Mesh Room | 4 cores, 8GB RAM, good bandwidth |
223+
224+
> **Note:** Mesh architecture connects each peer to all others. CPU/bandwidth usage scales quadratically with participant count. For large rooms, consider SFU architecture.
225+
226+
---
227+
212228
## 📚 Documentation
213229

214230
### 📖 Guides
@@ -239,6 +255,10 @@ Complete documentation with search, navigation, and bilingual support.
239255
| `WS_ALLOWED_ORIGINS` | `*` | Allowed origins (comma-separated, `*` for all) |
240256
| `RTC_CONFIG_JSON` | Public STUN | ICE/TURN config (JSON) passed to browser |
241257

258+
> ⚠️ **Production Security Warning**
259+
> - Never use `WS_ALLOWED_ORIGINS=*` in production. Set it to your specific domain.
260+
> - Never commit TURN credentials to version control. Use environment variables only.
261+
242262
### ICE/TURN Configuration Example
243263

244264
```bash
@@ -315,14 +335,17 @@ We welcome contributions! This project follows **Spec-Driven Development (SDD)**
315335
# Setup
316336
go mod tidy
317337
338+
# Run all checks (build, test, lint, vet)
339+
make check
340+
318341
# Run tests
319342
go test -race ./...
320343
321344
# Run linter
322345
golangci-lint run
323346
324347
# Start with hot reload
325-
air
348+
make dev
326349
```
327350

328351
---

README.zh-CN.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- [🚀 快速开始](#-快速开始)
3737
- [🏗️ 系统架构](#️-系统架构)
3838
- [📚 文档导航](#-文档导航)
39+
- [📊 系统要求](#-系统要求)
3940
- [⚙️ 配置说明](#️-配置说明)
4041
- [🚀 部署指南](#-部署指南)
4142
- [🤝 参与贡献](#-参与贡献)
@@ -61,7 +62,7 @@
6162

6263
### 生产就绪
6364
- **🔒 安全优先** — 来源验证、身份绑定、速率限制
64-
- **📦 零依赖前端** — 纯原生 JavaScript
65+
- **📦 无需构建** — 纯原生 JavaScript,无构建步骤
6566
- **🐳 Docker 支持** — 多阶段构建,镜像体积最小
6667
- **🧪 完整测试** — 单元测试 + Playwright E2E 测试
6768
- **📝 中英双语** — 完整双语文档支持
@@ -77,6 +78,7 @@
7778
### 环境要求
7879

7980
- [Go 1.22+](https://golang.org/dl/)
81+
- [Node.js 20+](https://nodejs.org/)(前端/E2E 测试需要)
8082
- 现代浏览器 (Chrome 90+, Firefox 88+, Safari 14+)
8183
- [Docker](https://www.docker.com/)(可选)
8284

@@ -95,15 +97,17 @@ go run ./cmd/server
9597
### 方式二:Docker
9698

9799
```bash
98-
docker build -t webrtc .
100+
# 在项目根目录构建
101+
docker build -f deploy/docker/Dockerfile -t webrtc .
99102
docker run --rm -p 8080:8080 webrtc
100103
```
101104

102105
### 方式三:Docker Compose(生产环境)
103106

104107
```bash
108+
# 在项目根目录执行
105109
export DOMAIN=your-domain.com
106-
docker compose up -d
110+
cd deploy/docker && docker compose up -d
107111
```
108112

109113
访问 `https://your-domain.com`,Caddy 自动配置 HTTPS。
@@ -209,6 +213,18 @@ webrtc/
209213

210214
---
211215

216+
## 📊 系统要求
217+
218+
| 场景 | 推荐配置 |
219+
|:-----|:---------|
220+
| 开发测试 | 1核 2GB 内存 |
221+
| 单房间(< 10 人)| 1核 1GB 内存 |
222+
| 50 人 Mesh 房间 | 4核 8GB 内存,良好带宽 |
223+
224+
> **注意:** Mesh 架构将每个参与者互相连接,CPU/带宽使用量随人数呈平方增长。大规模房间建议使用 SFU 架构。
225+
226+
---
227+
212228
## 📚 文档导航
213229

214230
### 📖 指南文档
@@ -239,6 +255,10 @@ webrtc/
239255
| `WS_ALLOWED_ORIGINS` | `*` | 允许的请求来源(逗号分隔,`*` 表示允许所有)|
240256
| `RTC_CONFIG_JSON` | 公共 STUN | 传递给浏览器的 ICE/TURN 配置(JSON)|
241257

258+
> ⚠️ **生产环境安全警告**
259+
> - 生产环境切勿使用 `WS_ALLOWED_ORIGINS=*`,必须设置为你的具体域名
260+
> - TURN 凭证请通过环境变量注入,**切勿提交到 Git**
261+
242262
### ICE/TURN 配置示例
243263

244264
```bash
@@ -315,14 +335,17 @@ services:
315335
# 设置
316336
go mod tidy
317337
338+
# 一键运行所有检查(构建、测试、代码检查、静态分析)
339+
make check
340+
318341
# 运行测试
319342
go test -race ./...
320343
321344
# 运行代码检查
322345
golangci-lint run
323346
324347
# 热重载开发
325-
air
348+
make dev
326349
```
327350

328351
---

0 commit comments

Comments
 (0)