mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 22:06:38 +08:00
173 lines
4.7 KiB
Markdown
173 lines
4.7 KiB
Markdown
<div align="center">
|
||
|
||
# OpenFlare
|
||
|
||
轻量、自托管的 OpenResty 控制面,用于管理反向代理规则、配置发布、节点同步、TLS 证书与基础可观测能力。
|
||
|
||
</div>
|
||
|
||
<p align="center">
|
||
<a href="https://raw.githubusercontent.com/Rain-kl/OpenFlare/main/LICENSE">
|
||
<img src="https://img.shields.io/github/license/Rain-kl/OpenFlare?color=brightgreen" alt="license">
|
||
</a>
|
||
<a href="https://github.com/Rain-kl/OpenFlare/releases/latest">
|
||
<img src="https://img.shields.io/github/v/release/Rain-kl/OpenFlare?color=brightgreen&include_prereleases" alt="release">
|
||
</a>
|
||
<a href="https://github.com/Rain-kl/OpenFlare/pkgs/container/openflare">
|
||
<img src="https://img.shields.io/badge/GHCR-ghcr.io%2Frain--kl%2Fopenflare-brightgreen" alt="ghcr">
|
||
</a>
|
||
</p>
|
||
|
||
> [!WARNING]
|
||
> 使用 `root` 用户初次登录系统后,务必修改默认密码 `123456`。
|
||
|
||
## 文档
|
||
|
||
**https://open-flare.pages.dev**
|
||
|
||
常用入口:
|
||
|
||
* [快速开始](https://open-flare.pages.dev/guide/quick-start)
|
||
* [部署说明](https://open-flare.pages.dev/guide/deployment)
|
||
* [配置项参考](https://open-flare.pages.dev/reference/configuration)
|
||
* [系统设计](https://open-flare.pages.dev/design/)
|
||
|
||
## 核心能力
|
||
|
||
* 反向代理网站配置与多域名绑定
|
||
* 配置预览、发布、激活与历史回滚
|
||
* Agent 自动注册、心跳、同步、校验、reload 与失败回滚
|
||
* OpenResty 主配置、性能参数、缓存参数与 Lua 资源托管
|
||
* TLS 证书、域名资产、节点凭证与版本状态管理
|
||
* 请求聚合、访问分析、资源快照、健康事件与节点详情
|
||
|
||
## 快速开始
|
||
|
||
### 1. 启动 Server
|
||
|
||
```yaml
|
||
services:
|
||
postgres:
|
||
image: postgres:17-alpine
|
||
restart: unless-stopped
|
||
environment:
|
||
POSTGRES_DB: openflare
|
||
POSTGRES_USER: openflare
|
||
POSTGRES_PASSWORD: replace-with-strong-password
|
||
volumes:
|
||
- postgres-data:/var/lib/postgresql/data
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pg_isready -U openflare -d openflare"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
openflare:
|
||
image: ghcr.io/rain-kl/openflare:latest
|
||
restart: unless-stopped
|
||
depends_on:
|
||
postgres:
|
||
condition: service_healthy
|
||
ports:
|
||
- "3000:3000"
|
||
environment:
|
||
SESSION_SECRET: replace-with-random-string
|
||
DSN: postgres://openflare:replace-with-strong-password@postgres:5432/openflare?sslmode=disable
|
||
GIN_MODE: release
|
||
LOG_LEVEL: info
|
||
|
||
volumes:
|
||
postgres-data:
|
||
```
|
||
|
||
```bash
|
||
docker compose up -d
|
||
```
|
||
|
||
访问地址:`http://localhost:3000`
|
||
|
||
默认账号:
|
||
|
||
* 用户名:`root`
|
||
* 密码:`123456`
|
||
|
||
### 2. 安装 Agent
|
||
|
||
**注意:** 安装agent前需确保存已经安装了Docker, 虽然支持裸Openresty,但未得到充分验证,可能存在未知问题.
|
||
|
||
使用 `discovery_token` 接入:
|
||
|
||
```bash
|
||
curl -fsSL https://raw.githubusercontent.com/Rain-kl/OpenFlare/main/scripts/install-agent.sh | bash -s -- \
|
||
--server-url http://your-server:3000 \
|
||
--discovery-token YOUR_DISCOVERY_TOKEN
|
||
```
|
||
|
||
使用节点专属 `agent_token`:
|
||
|
||
```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
|
||
```
|
||
|
||
安装脚本默认写入 `/opt/openflare-agent`,创建 `openflare-agent.service`,并可重复执行以重装或升级 Agent。
|
||
|
||
### 3. 卸载 Agent
|
||
|
||
如需彻底卸载 Agent 并清空本地数据,可执行:
|
||
|
||
```bash
|
||
curl -fsSL https://raw.githubusercontent.com/Rain-kl/OpenFlare/main/scripts/uninstall-agent.sh | bash
|
||
```
|
||
|
||
卸载脚本会先停止并移除 `openflare-agent.service`、删除整个 `/opt/openflare-agent` 目录,然后根据卸载前保存的 `agent.json` 判断 OpenResty 安装方式:
|
||
|
||
* Docker 模式:删除对应 OpenResty 容器,并尝试移除镜像
|
||
* 本机 `openresty_path` 模式:不改动本机 OpenResty,只提示用户手动卸载
|
||
|
||
### 4. 发布第一份配置
|
||
|
||
1. 登录管理端并新增反代规则
|
||
2. 在发布前查看预览或变更摘要
|
||
3. 激活新版本
|
||
4. 等待 Agent 在后续 heartbeat 中拉取并应用配置
|
||
|
||
版本号格式固定为 `YYYYMMDD-NNN`,历史版本不可变,回滚通过重新激活旧版本完成。
|
||
|
||
|
||
## 界面预览
|
||
|
||
### 仪表盘总览
|
||
|
||

|
||
|
||
### 节点详情
|
||
|
||

|
||
|
||
### 配置新增
|
||
|
||

|
||
|
||
## 管理端与接口
|
||
|
||
管理端当前覆盖:
|
||
|
||
* 反代规则
|
||
* 配置版本
|
||
* 节点管理
|
||
* 应用记录
|
||
* TLS 证书
|
||
* 域名管理
|
||
* 用户管理
|
||
* 设置
|
||
* 版本更新
|
||
* POW 规则
|
||
|
||
登录管理端后,可访问 Swagger UI:`/swagger/index.html`
|
||
|
||
## 开源协议
|
||
|
||
本项目采用 [Apache License 2.0](./LICENSE) 开源。
|