Files
OpenFlare/docs/en/reference/cli.md
T
2026-06-02 00:13:39 +08:00

2.0 KiB

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:

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:

go run . --port 3000 --log-dir ./logs

Run tests:

cd openflare_server
GOCACHE=/tmp/openflare-go-cache go test ./...

Frontend

Development:

cd openflare_server/web
pnpm install
pnpm dev

Build static assets:

cd openflare_server/web
pnpm build

Linting and testing checks:

cd openflare_server/web
pnpm lint
pnpm typecheck
pnpm test

Agent

Run from source:

cd openflare_agent
go run ./cmd/agent -config /path/to/agent.json

Compile:

cd openflare_agent
go build -o openflare-agent ./cmd/agent

Run tests:

cd openflare_agent
GOCACHE=/tmp/openflare-go-cache go test ./...

Relay (Server-side)

Run from source:

cd openflare_relay
go run ./cmd -config /path/to/relay.json

Compile:

cd openflare_relay
go build -o openflare-relay ./cmd

OpenFlared (Client-side)

Run from source:

cd openflared
go run ./cmd -config /path/to/flared.json

Compile:

cd openflared
go build -o openflared ./cmd

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 Swagger documentation:

go install github.com/swaggo/swag/cmd/swag@v1.16.4
cd openflare_server
swag init -g main.go -o docs

Docs

Local preview:

cd docs
pnpm dev

Build:

cd docs
pnpm build