guide 9 篇(quick-start/first-site/sso/troubleshooting/tunnel-usage/waf-usage/waf-ip-group-expr/credits/index)、deployment 7 篇(deployment/server/agent/relay/openflared/upgrade/index)、reference 3 篇(configuration/cli/index)、design 5 篇(architecture/agent-design/tunnel-design/waf-design/index)全部按中文最新版重写同步;waf-usage/waf-design 按新版 DAG 模型重写;修复 reference 中文锚点链接;vitepress 构建 43 个英文页面全绿
2.5 KiB
Commands & Scripts
You will learn: common start, build, test, install, and uninstall commands for the OpenFlare Server, admin frontend, Agent, Relay, OpenFlared, Swagger, and the docs site.
All commands run at the repo root unless noted otherwise.
Server
Source startup:
cp config.example.yaml config.yaml
go run main.go all
Split processes:
go run main.go api # HTTP API only
go run main.go worker # Asynq Worker only
go run main.go scheduler # scheduled tasks only
Build the binary:
make build-backend
# output: bin/openflare-server
Tests:
GOCACHE=/tmp/openflare-go-cache go test ./...
Quality gate:
make code-check
Auto-format backend Go source (organize imports) and frontend source:
make format
This command uses goimports to organize backend Go imports and the repo-pinned Prettier version to format frontend/ source; build artifacts, dependencies, public static assets, and lock files are ignored.
Frontend
Dev:
cd frontend
pnpm install
pnpm dev
Build the embedded artifact (hosted by the Go Server):
cd frontend
pnpm build:embed
# or at repo root: make build-embedded
Checks:
cd frontend
pnpm lint
pnpm tsc --noEmit --jsx preserve
pnpm check:i18n
Agent
Source run:
go run ./cmd/agent -config /path/to/agent.json
Build:
make build-agent
# or: go build -o bin/openflare-agent ./cmd/agent
Tests:
GOCACHE=/tmp/openflare-go-cache go test ./internal/apps/agent/...
Relay
Source run:
go run ./cmd/relay -config /path/to/relay.json
Build:
make build-relay
# or: go build -o bin/openflare-relay ./cmd/relay
OpenFlared (Tunnel client)
Source run:
go run ./cmd/flared -config /path/to/flared.json
Build:
make build-flared
# or: go build -o bin/flared ./cmd/flared
Install Agent
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
curl -fsSL https://raw.githubusercontent.com/Rain-kl/OpenFlare/main/scripts/uninstall-agent.sh | bash
Swagger
Regenerate the Swagger docs:
make swagger
Access: http://localhost:3000/api/swagger/index.html (default api_prefix /api; only mounted in non-production)
Docs
Local preview:
cd docs
pnpm dev
Build:
cd docs
pnpm build