mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 14:06:36 +08:00
454542c1d0
- README 默认英文:README.en.md → README.md(英文为默认),中文移至 README.zh-CN.md,语言切换链接同步 - 恢复被删除的 docs/en/ 英文文档(git 历史 cc5e53c5^),删除 4 篇已废弃文件 - 英文导航 config.ts 对齐中文结构(新增 Deployment/Changelog 侧栏,同步 Guide/Design 条目) - 翻译 15 篇中文新增文档:guide 5 篇(certificates/pages-usage/proxy-config/uptime-kuma/zone-domain-migration)+ design 10 篇(zone-design/cloudflare-pointing/waf-orchestration/origin-error-page/edge-cache-design/pages-design/logstore/kuma-design/login-captcha/observability 三篇) - en 首页更新(新增 Pages 特性、tagline 同步);changelog 英文入口指向中文版 - vitepress 构建验证:43 个英文页面全部渲染 注意:29 篇旧英文文档为恢复版,部分内容(如 deployment/server、reference/configuration)可能落后于中文,需后续逐篇同步
150 lines
2.0 KiB
Markdown
150 lines
2.0 KiB
Markdown
# CLI Commands
|
|
|
|
You will learn: Common commands for starting, building, testing, installing, and uninstalling the OpenFlare Server, Admin Frontend, Agent, Swagger, and Documentation site.
|
|
|
|
## Server
|
|
|
|
Start from source:
|
|
|
|
```bash
|
|
cd openflare-server
|
|
export SESSION_SECRET='replace-with-random-string'
|
|
export SQLITE_PATH='./openflare.db'
|
|
export LOG_LEVEL='info'
|
|
go run .
|
|
```
|
|
|
|
Specify listening port and logging directory:
|
|
|
|
```bash
|
|
go run . --port 3000 --log-dir ./logs
|
|
```
|
|
|
|
Run tests:
|
|
|
|
```bash
|
|
cd openflare-server
|
|
GOCACHE=/tmp/openflare-go-cache go test ./...
|
|
```
|
|
|
|
## Frontend
|
|
|
|
Development:
|
|
|
|
```bash
|
|
cd openflare-server/web
|
|
pnpm install
|
|
pnpm dev
|
|
```
|
|
|
|
Build static assets:
|
|
|
|
```bash
|
|
cd openflare-server/web
|
|
pnpm build
|
|
```
|
|
|
|
Linting and testing checks:
|
|
|
|
```bash
|
|
cd openflare-server/web
|
|
pnpm lint
|
|
pnpm typecheck
|
|
pnpm test
|
|
```
|
|
|
|
## Agent
|
|
|
|
Run from source:
|
|
|
|
```bash
|
|
cd openflare-agent
|
|
go run ./cmd/agent -config /path/to/agent.json
|
|
```
|
|
|
|
Compile:
|
|
|
|
```bash
|
|
cd openflare-agent
|
|
go build -o openflare-agent ./cmd/agent
|
|
```
|
|
|
|
Run tests:
|
|
|
|
```bash
|
|
cd openflare-agent
|
|
GOCACHE=/tmp/openflare-go-cache go test ./...
|
|
```
|
|
|
|
## Relay (Server-side)
|
|
|
|
Run from source:
|
|
|
|
```bash
|
|
cd openflare-relay
|
|
go run ./cmd -config /path/to/relay.json
|
|
```
|
|
|
|
Compile:
|
|
|
|
```bash
|
|
cd openflare-relay
|
|
go build -o openflare-relay ./cmd
|
|
```
|
|
|
|
## OpenFlared (Client-side)
|
|
|
|
Run from source:
|
|
|
|
```bash
|
|
cd openflared
|
|
go run ./cmd -config /path/to/flared.json
|
|
```
|
|
|
|
Compile:
|
|
|
|
```bash
|
|
cd openflared
|
|
go build -o openflared ./cmd
|
|
```
|
|
|
|
## Install Agent
|
|
|
|
```bash
|
|
curl -fsSL https://raw.githubusercontent.com/Rain-kl/OpenFlare/main/scripts/install-agent.sh | bash -s -- \
|
|
--server-url http://your-server:3000 \
|
|
--agent-token YOUR_AGENT_TOKEN
|
|
```
|
|
|
|
## Uninstall Agent
|
|
|
|
```bash
|
|
curl -fsSL https://raw.githubusercontent.com/Rain-kl/OpenFlare/main/scripts/uninstall-agent.sh | bash
|
|
```
|
|
|
|
## Swagger
|
|
|
|
Regenerate Swagger documentation:
|
|
|
|
```bash
|
|
go install github.com/swaggo/swag/cmd/swag@v1.16.4
|
|
cd openflare-server
|
|
swag init -g main.go -o docs
|
|
```
|
|
|
|
## Docs
|
|
|
|
Local preview:
|
|
|
|
```bash
|
|
cd docs
|
|
pnpm dev
|
|
```
|
|
|
|
Build:
|
|
|
|
```bash
|
|
cd docs
|
|
pnpm build
|
|
```
|