dsh-ops-kit 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -54
- package/README.zh-CN.md +154 -0
- package/docs/DETAIL.md +55 -26
- package/docs/USAGE.zh-CN.md +192 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +4 -2
- package/docs/ROADMAP.md +0 -134
package/README.md
CHANGED
|
@@ -1,47 +1,91 @@
|
|
|
1
1
|
# dsh-ops-kit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
|
23
|
-
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
3
|
+
**English** | [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Server operations from a DeepSeek Harness chat: **34 tools plus a sidebar panel**,
|
|
6
|
+
no SDK, and no credentials stored by the plugin.
|
|
7
|
+
|
|
8
|
+
🔒 marks an action that needs `confirm: true` — the tool fails closed instead of
|
|
9
|
+
asking in a second turn.
|
|
10
|
+
|
|
11
|
+
## Connect and inventory
|
|
12
|
+
|
|
13
|
+
| Tool | What it does |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `ops_hosts` | list / add / update / remove SSH hosts (`~/.dsh/ops-kit/hosts.json`) |
|
|
16
|
+
| `ops_ssh_test` | connectivity, latency and the auth kind actually used |
|
|
17
|
+
| `ops_ssh_install_key` | install this machine's public key using the stored password |
|
|
18
|
+
| `ops_inventory` | read-only scan: listening ports, services, containers, nginx sites, java processes, crontab, mounts |
|
|
19
|
+
|
|
20
|
+
## Look at a host (read-only)
|
|
21
|
+
|
|
22
|
+
| Tool | What it does |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `ops_status` | uptime + load, memory, root disk, failed systemd units, containers |
|
|
25
|
+
| `ops_check_all` | every host in parallel, one summary row each, appends to history |
|
|
26
|
+
| `ops_health` | 0–100 score plus the issues worth fixing first |
|
|
27
|
+
| `ops_metrics` | CPU / memory / disk samples over a window (capped at 20 000 rows) |
|
|
28
|
+
| `ops_ps` | top processes by CPU or memory |
|
|
29
|
+
| `ops_disk` | directory sizes one level below a path |
|
|
30
|
+
| `ops_logs` | journal unit or log-file tail |
|
|
31
|
+
| `ops_files` | directory listing with sizes and mtimes |
|
|
32
|
+
| `ops_ssl` | certificate subject, issuer, expiry for one domain |
|
|
33
|
+
| `ops_diagnose` | plain-language diagnosis with suggested next actions |
|
|
34
|
+
|
|
35
|
+
## Change something
|
|
36
|
+
|
|
37
|
+
| Tool | What it does |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `ops_run` | one shell command; a destructive denylist needs 🔒 |
|
|
40
|
+
| `ops_batch` | the same command on several hosts in parallel |
|
|
41
|
+
| `ops_service` | `systemctl status/logs/start/stop/restart` (start/stop/restart 🔒) |
|
|
42
|
+
| `ops_docker` | `docker ps/logs/inspect/restart` (restart 🔒) |
|
|
43
|
+
| `ops_kill` | TERM / KILL / HUP one pid 🔒 |
|
|
44
|
+
| `ops_cleanup` | vacuum the journal, truncate rotated logs 🔒 |
|
|
45
|
+
| `ops_monitors` | http / port / process / service / script heartbeat checks |
|
|
46
|
+
|
|
47
|
+
## Config and files
|
|
48
|
+
|
|
49
|
+
| Tool | What it does |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `ops_config` | scheduler settings: interval, disk threshold, timeouts, quick commands, AI model |
|
|
52
|
+
| `ops_config_file` | read one configuration file |
|
|
53
|
+
| `ops_save_config` | write a config file after backing it up 🔒 |
|
|
54
|
+
| `ops_file_history` | `.bak.<ts>` versions of a file, diff, rollback 🔒 |
|
|
55
|
+
|
|
56
|
+
## Backups, certificates, schedule, deploy
|
|
57
|
+
|
|
58
|
+
| Tool | What it does |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `ops_backup` | MySQL dump or directory archive, list, restore, delete, retention N |
|
|
61
|
+
| `ops_cert` | certificate days left, `certbot renew --dry-run`, real renewal |
|
|
62
|
+
| `ops_cron` | list / add / remove crontab entries |
|
|
63
|
+
| `ops_deploy` | git pull → build → restart → health check, automatic rollback |
|
|
64
|
+
|
|
65
|
+
## Alerts and AI
|
|
66
|
+
|
|
67
|
+
| Tool | What it does |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `ops_channels` | alert delivery to Feishu / DingTalk / WeCom / any webhook, plus test send |
|
|
70
|
+
| `ops_alerts` | recent alerts from the scheduled checks |
|
|
71
|
+
| `ops_ask` | natural-language question; the model runs read-only commands itself |
|
|
72
|
+
| `ops_ai_command` | turn an intent into ONE command, without executing it |
|
|
73
|
+
| `ops_ai_models` | providers and models the ops AI can use |
|
|
28
74
|
|
|
29
75
|
## Design
|
|
30
76
|
|
|
31
|
-
- **
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
base64-encoded, not encrypted, so treat that file as a secret.
|
|
77
|
+
- **No SDK, no credential storage by default.** Key authentication goes through
|
|
78
|
+
the system `ssh` client in `BatchMode`, so the plugin never reads your keys.
|
|
79
|
+
Password authentication uses the plugin's own `ssh2` client and is the only
|
|
80
|
+
case where a secret is stored (see below).
|
|
81
|
+
- **Password or key.** A host can be added with only IP + user + password; that
|
|
82
|
+
path needs `ssh2` present in the profile. A host without a stored password
|
|
83
|
+
uses the system `ssh` client and your keys or agent.
|
|
39
84
|
- **Inventory outside the profile.** Hosts live in
|
|
40
85
|
`$DSH_HOME/ops-kit/hosts.json` (default `~/.dsh/ops-kit/hosts.json`), so
|
|
41
86
|
upgrading or removing the plugin does not lose them.
|
|
42
87
|
- **Read/write separation.** Health checks are always read-only. Anything that
|
|
43
|
-
changes a service or container requires `confirm: true
|
|
44
|
-
refuses a short list of destructive commands without it.
|
|
88
|
+
changes a service or container requires `confirm: true`.
|
|
45
89
|
- **Bounded output.** Tool results are clipped at 8 KB with an explicit
|
|
46
90
|
truncation marker, so a runaway log line cannot flood the model context.
|
|
47
91
|
|
|
@@ -51,6 +95,10 @@ stored by the plugin.
|
|
|
51
95
|
dsh plugin --profile desktop add dsh-ops-kit
|
|
52
96
|
```
|
|
53
97
|
|
|
98
|
+
A task-oriented walkthrough (setup checks, the ten panel pages, setting defaults,
|
|
99
|
+
data sensitivity, troubleshooting) is in
|
|
100
|
+
[docs/USAGE.zh-CN.md](docs/USAGE.zh-CN.md) — written in Chinese.
|
|
101
|
+
|
|
54
102
|
Local development install (directory):
|
|
55
103
|
|
|
56
104
|
```
|
|
@@ -59,14 +107,13 @@ Plugins → Add plugin → select this directory
|
|
|
59
107
|
|
|
60
108
|
## Panel
|
|
61
109
|
|
|
62
|
-
The bundle
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
The panel talks to the host half
|
|
110
|
+
The bundle ships a sidebar page (**Ops**) with ten sub-pages per host: overview,
|
|
111
|
+
monitor, config, apps, logs, files, terminal (real PTY), backups, tasks, deploy.
|
|
112
|
+
The overview lists hosts and runs one host or all hosts at once; runs are
|
|
113
|
+
recorded in `$DSH_HOME/ops-kit/history.json`. The panel talks to the host half
|
|
114
|
+
through `/ops-kit/api/*`.
|
|
66
115
|
|
|
67
|
-
|
|
68
|
-
**Actions** panel that lists running systemd services and containers with
|
|
69
|
-
Logs / Restart / Stop buttons. Restart and stop ask for confirmation first.
|
|
116
|
+
Restart, stop, restore and rollback all ask for confirmation in the panel first.
|
|
70
117
|
|
|
71
118
|
## First run
|
|
72
119
|
|
|
@@ -82,18 +129,13 @@ nginx 最近 50 行日志
|
|
|
82
129
|
把 web-1 上的 my-api 重启一下(我确认)
|
|
83
130
|
```
|
|
84
131
|
|
|
85
|
-
## Limits (deliberately not implemented
|
|
132
|
+
## Limits (deliberately not implemented)
|
|
86
133
|
|
|
87
|
-
- No
|
|
88
|
-
- No
|
|
89
|
-
- No metric history or alerting: `ops_status` is a point-in-time snapshot.
|
|
134
|
+
- No cloud APIs (Aliyun / Tencent / AWS). This kit only speaks SSH.
|
|
135
|
+
- No application-level deploys beyond `ops_deploy` (no Docker Compose, no k8s).
|
|
90
136
|
- No Windows remoting: SSH to Windows works only if the host runs an SSH server
|
|
91
137
|
with a POSIX-like shell.
|
|
92
|
-
|
|
93
|
-
## License
|
|
94
|
-
|
|
95
|
-
MIT
|
|
96
|
-
|
|
138
|
+
- Metric retention is a bounded row cap, not a time-series database.
|
|
97
139
|
|
|
98
140
|
## 0.3.0 — backups, health score, certificates, cron, config history, deploy
|
|
99
141
|
|
|
@@ -109,9 +151,6 @@ MIT
|
|
|
109
151
|
- **One-click deploy.** git pull → build → restart → health check, with an
|
|
110
152
|
automatic rollback to the previous commit when the health check fails.
|
|
111
153
|
|
|
112
|
-
Panel navigation: overview → server detail with ten sub-pages
|
|
113
|
-
(summary, monitor, config, apps, logs, files, terminal, backups, tasks, deploy).
|
|
114
|
-
|
|
115
154
|
## Alert delivery
|
|
116
155
|
|
|
117
156
|
Alerts produced by the scheduler (host down, disk pressure, failed units, monitor
|
|
@@ -124,3 +163,7 @@ failures, certificate expiry) are pushed to the configured channels:
|
|
|
124
163
|
Each channel chooses which levels it receives (critical / warning / info). The
|
|
125
164
|
same alert is not resent within 10 minutes. Channels live in
|
|
126
165
|
`~/.dsh/ops-kit/channels.json` with mode 0600, because the URL itself is a secret.
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# dsh-ops-kit
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
在 DeepSeek Harness 的对话里做服务器运维:**34 个工具 + 一个侧栏面板**,无需安装 SDK,
|
|
6
|
+
插件默认不保存任何凭据。
|
|
7
|
+
|
|
8
|
+
> **完整使用说明见 [docs/USAGE.zh-CN.md](docs/USAGE.zh-CN.md)** —— 前置条件怎么验、面板十个子页各干什么、
|
|
9
|
+
> 设置项默认值、数据放在哪有多敏感、以及连不上时怎么排障。
|
|
10
|
+
|
|
11
|
+
🔒 表示该操作需要 `confirm: true`,缺了会直接拒绝执行,而不是在下一轮再问你。
|
|
12
|
+
|
|
13
|
+
## 连接与清单
|
|
14
|
+
|
|
15
|
+
| 工具 | 作用 |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `ops_hosts` | 列出 / 添加 / 修改 / 删除 SSH 主机(`~/.dsh/ops-kit/hosts.json`) |
|
|
18
|
+
| `ops_ssh_test` | 连通性、延迟,以及实际使用的认证方式 |
|
|
19
|
+
| `ops_ssh_install_key` | 用已存的密码把本机公钥装到目标机 |
|
|
20
|
+
| `ops_inventory` | 只读盘点:监听端口、服务、容器、nginx 站点、java 进程、crontab、挂载 |
|
|
21
|
+
|
|
22
|
+
## 只看不改(只读)
|
|
23
|
+
|
|
24
|
+
| 工具 | 作用 |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `ops_status` | 运行时长与负载、内存、根分区磁盘、失败的 systemd 单元、容器 |
|
|
27
|
+
| `ops_check_all` | 并行检查所有主机,每台一行摘要,并写入历史 |
|
|
28
|
+
| `ops_health` | 0–100 健康分,附最该先修的几条问题 |
|
|
29
|
+
| `ops_metrics` | 某个时间窗内的 CPU / 内存 / 磁盘采样(上限 2 万行) |
|
|
30
|
+
| `ops_ps` | 按 CPU 或内存排序的进程 |
|
|
31
|
+
| `ops_disk` | 某个目录下一层的空间占用 |
|
|
32
|
+
| `ops_logs` | systemd 单元或日志文件的尾部 |
|
|
33
|
+
| `ops_files` | 目录列表,带大小与修改时间 |
|
|
34
|
+
| `ops_ssl` | 某域名的证书主体、签发者、到期时间 |
|
|
35
|
+
| `ops_diagnose` | 用大白话给出诊断和建议的下一步 |
|
|
36
|
+
|
|
37
|
+
## 会改状态的
|
|
38
|
+
|
|
39
|
+
| 工具 | 作用 |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `ops_run` | 执行一条 shell 命令;破坏性命令 🔒 |
|
|
42
|
+
| `ops_batch` | 在多台主机上并行执行同一条命令 |
|
|
43
|
+
| `ops_service` | `systemctl status/logs/start/stop/restart`(启停与重启 🔒) |
|
|
44
|
+
| `ops_docker` | `docker ps/logs/inspect/restart`(重启 🔒) |
|
|
45
|
+
| `ops_kill` | 对单个 pid 发 TERM / KILL / HUP 🔒 |
|
|
46
|
+
| `ops_cleanup` | 整理 journal、截断已轮转日志 🔒 |
|
|
47
|
+
| `ops_monitors` | http / 端口 / 进程 / 服务 / 脚本 心跳检查 |
|
|
48
|
+
|
|
49
|
+
## 配置与文件
|
|
50
|
+
|
|
51
|
+
| 工具 | 作用 |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `ops_config` | 调度设置:检查间隔、磁盘阈值、各类超时、常用命令、AI 模型 |
|
|
54
|
+
| `ops_config_file` | 读取一个配置文件 |
|
|
55
|
+
| `ops_save_config` | 写入配置文件,写前自动备份 🔒 |
|
|
56
|
+
| `ops_file_history` | 文件的 `.bak.<ts>` 历史版本、差异、回滚 🔒 |
|
|
57
|
+
|
|
58
|
+
## 备份、证书、计划任务、发布
|
|
59
|
+
|
|
60
|
+
| 工具 | 作用 |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `ops_backup` | MySQL 导出或目录打包、列出、恢复、删除、保留 N 份 |
|
|
63
|
+
| `ops_cert` | 证书剩余天数、`certbot renew --dry-run`、正式续期 |
|
|
64
|
+
| `ops_cron` | 列出 / 新增 / 删除 crontab 条目 |
|
|
65
|
+
| `ops_deploy` | git pull → 构建 → 重启 → 健康检查,失败自动回滚 |
|
|
66
|
+
|
|
67
|
+
## 告警与 AI
|
|
68
|
+
|
|
69
|
+
| 工具 | 作用 |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `ops_channels` | 告警推送到飞书 / 钉钉 / 企业微信 / 任意 webhook,可测试发送 |
|
|
72
|
+
| `ops_alerts` | 定时检查产生的近期告警 |
|
|
73
|
+
| `ops_ask` | 自然语言提问,由模型自己执行只读命令 |
|
|
74
|
+
| `ops_ai_command` | 把意图转成一条命令,但不执行 |
|
|
75
|
+
| `ops_ai_models` | 运维 AI 可用的 provider 与模型 |
|
|
76
|
+
|
|
77
|
+
## 设计取向
|
|
78
|
+
|
|
79
|
+
- **无 SDK,默认不存凭据。** 密钥认证走系统 `ssh` 客户端(`BatchMode`),插件完全
|
|
80
|
+
不读你的密钥文件。密码认证走插件自带的 `ssh2` 客户端,也是唯一会落盘密钥的场景。
|
|
81
|
+
- **密码或密钥皆可。** 只填 IP + 用户名 + 密码就能添加主机;这条路径要求该 profile
|
|
82
|
+
里已有 `ssh2`。没有存密码的主机则走系统 `ssh` 和你的密钥 / agent。
|
|
83
|
+
- **清单放在 profile 之外。** 主机信息存在 `$DSH_HOME/ops-kit/hosts.json`
|
|
84
|
+
(默认 `~/.dsh/ops-kit/hosts.json`),升级或卸载插件都不会丢。
|
|
85
|
+
- **读写分离。** 健康检查永远只读;任何改变服务或容器状态的操作都需要 `confirm: true`。
|
|
86
|
+
- **输出有上限。** 结果超过 8 KB 会被截断并显式标注,避免一行失控日志冲爆上下文。
|
|
87
|
+
|
|
88
|
+
## 安装
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
dsh plugin --profile desktop add dsh-ops-kit
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
本地开发安装(目录方式):
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Plugins → Add plugin → 选中该目录
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 面板
|
|
101
|
+
|
|
102
|
+
bundle 提供一个侧栏页面(**Ops**),每台主机十个子页:概览、监控、配置、应用、
|
|
103
|
+
日志、文件、终端(真 PTY)、备份、计划任务、发布。概览页可跑单机或全部主机的检查,
|
|
104
|
+
每次运行记录到 `$DSH_HOME/ops-kit/history.json`。面板通过 `/ops-kit/api/*` 与 Host 侧通信。
|
|
105
|
+
|
|
106
|
+
重启、停止、恢复、回滚在面板里都会先要求确认。
|
|
107
|
+
|
|
108
|
+
## 首次使用
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
ops_hosts action=add name=web-1 host=10.0.0.11 user=deploy key=~/.ssh/id_ed25519 defaultHost=true
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
然后直接问就行:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
看一下 web-1 的状态
|
|
118
|
+
nginx 最近 50 行日志
|
|
119
|
+
把 web-1 上的 my-api 重启一下(我确认)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 刻意未做的部分
|
|
123
|
+
|
|
124
|
+
- **不接云厂商 API**(阿里云 / 腾讯云 / AWS):这套工具只说 SSH。
|
|
125
|
+
- **不做超出 `ops_deploy` 的应用级发布**:不碰 Docker Compose,也不碰 k8s。
|
|
126
|
+
- **不做 Windows 远程**:只有当 Windows 主机自己跑了 SSH 服务且提供类 POSIX shell 时才行。
|
|
127
|
+
- **指标保留是行数上限,不是时序数据库。**
|
|
128
|
+
|
|
129
|
+
## 0.3.0 —— 备份、健康分、证书、计划任务、配置历史、一键发布
|
|
130
|
+
|
|
131
|
+
- **备份与恢复。** 数据库用 `mysqldump`,目录用 `tar.gz`,默认存在 `/home/backup`,
|
|
132
|
+
保留 N 份,一键恢复。
|
|
133
|
+
- **健康分。** 每台主机 0–100,附最要紧的两三条问题,显示在服务器详情页。
|
|
134
|
+
- **证书。** 探测每个 nginx `server_name` 的到期日;正式续期前先
|
|
135
|
+
`certbot renew --dry-run`;在 14 / 7 / 3 天时告警。
|
|
136
|
+
- **计划任务。** 服务器 crontab 可在面板里查看和编辑。
|
|
137
|
+
- **配置历史。** 每个 `.bak.<ts>` 版本都能做差异对比并回滚。
|
|
138
|
+
- **一键发布。** git pull → 构建 → 重启 → 健康检查;健康检查失败时自动回滚到上一个提交。
|
|
139
|
+
|
|
140
|
+
## 告警推送
|
|
141
|
+
|
|
142
|
+
调度器产生的告警(主机失联、磁盘压力、单元失败、监控失败、证书到期)会推送到已配置的渠道:
|
|
143
|
+
|
|
144
|
+
- `feishu` → `{"msg_type":"text","content":{"text":...}}`
|
|
145
|
+
- `dingtalk` / `wecom` → `{"msgtype":"text","text":{"content":...}}`
|
|
146
|
+
- `webhook` → `{"text":...,"alerts":[...]}`,给其余任意接收方
|
|
147
|
+
|
|
148
|
+
每个渠道可单独选择接收哪些级别(critical / warning / info)。同一条告警 10 分钟内
|
|
149
|
+
不会重复发送。渠道配置在 `~/.dsh/ops-kit/channels.json`,权限 0600 —— 因为 webhook
|
|
150
|
+
URL 本身就是密钥。
|
|
151
|
+
|
|
152
|
+
## 许可证
|
|
153
|
+
|
|
154
|
+
MIT
|
package/docs/DETAIL.md
CHANGED
|
@@ -1,42 +1,71 @@
|
|
|
1
|
-
# Ops kit — server operations from chat
|
|
1
|
+
# Ops kit — server operations from a chat
|
|
2
2
|
|
|
3
3
|
## What it is
|
|
4
4
|
|
|
5
|
-
A
|
|
6
|
-
|
|
7
|
-
never
|
|
5
|
+
A DeepSeek Harness bundle for running Linux servers without leaving the
|
|
6
|
+
conversation. It contributes **34 agent tools and a sidebar panel**, and it
|
|
7
|
+
never needs an agent installed on the target host.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Authentication is either your existing SSH key / ssh-agent (through the system
|
|
10
|
+
`ssh` client in `BatchMode`, so the plugin never reads your key files) or a
|
|
11
|
+
password you store per host (through the plugin's own `ssh2` client, the only
|
|
12
|
+
path that keeps a secret on disk).
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
`$DSH_HOME/ops-kit/hosts.json` (default `~/.dsh/ops-kit/hosts.json`).
|
|
13
|
-
- `ops_status` — one call returns uptime/load, memory, root disk, failed systemd
|
|
14
|
-
units and running containers. Read-only by construction: it runs a fixed
|
|
15
|
-
command string.
|
|
16
|
-
- `ops_run` — one free-form command. A short denylist (filesystem formatting,
|
|
17
|
-
`rm -rf /`, `dd` to a block device, shutdown/reboot) requires `confirm=true`.
|
|
18
|
-
- `ops_service` — `systemctl` status/logs/start/stop/restart for one unit.
|
|
19
|
-
- `ops_docker` — `docker ps/logs/inspect/restart`.
|
|
14
|
+
## What it adds
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
- **Inventory and connect** — host list, connectivity/latency test, public-key
|
|
17
|
+
installation, a read-only scan of ports, services, containers, nginx sites,
|
|
18
|
+
java processes, crontab and mounts.
|
|
19
|
+
- **Look at a host, read-only** — status snapshot, parallel check of every host,
|
|
20
|
+
0–100 health score, CPU/memory/disk samples, top processes, directory sizes,
|
|
21
|
+
log tails, file listings, certificate expiry, and a plain-language diagnosis.
|
|
22
|
+
- **Change something, with confirm guards** — one shell command, the same command
|
|
23
|
+
across hosts, systemd start/stop/restart, docker restart, killing a pid,
|
|
24
|
+
journal cleanup, and monitor management. Everything that changes state
|
|
25
|
+
requires `confirm: true` and fails closed instead of asking in a second turn.
|
|
26
|
+
- **Config and files** — read a config file, write one after backing it up, and
|
|
27
|
+
diff or roll back any `.bak.<ts>` version.
|
|
28
|
+
- **Backups, certificates, schedule, deploy** — MySQL dump or directory archive
|
|
29
|
+
with retention and restore, certificate probing with `certbot renew --dry-run`,
|
|
30
|
+
crontab editing, and git pull → build → restart → health check with automatic
|
|
31
|
+
rollback when the health check fails.
|
|
32
|
+
- **Alerts and AI** — delivery to Feishu / DingTalk / WeCom / any webhook with
|
|
33
|
+
per-channel levels and 10-minute dedupe, plus a natural-language `ops_ask` that
|
|
34
|
+
runs read-only commands itself.
|
|
35
|
+
|
|
36
|
+
## Panel
|
|
37
|
+
|
|
38
|
+
A sidebar page with ten sub-pages per host: overview, monitor, config, apps,
|
|
39
|
+
logs, files, terminal (a real PTY), backups, tasks and deploy. The overview runs
|
|
40
|
+
one host or all hosts and records each run in history. Restart, stop, restore and
|
|
41
|
+
rollback all ask for confirmation in the panel first.
|
|
23
42
|
|
|
24
43
|
## Requirements
|
|
25
44
|
|
|
26
|
-
- macOS or Linux host running DSH
|
|
27
|
-
-
|
|
45
|
+
- macOS or Linux host running DSH with `ssh` on `PATH`.
|
|
46
|
+
- Key or ssh-agent authentication already working for each host (`ssh -o
|
|
47
|
+
BatchMode=yes user@host true` must succeed) — or `ssh2` present in the profile
|
|
48
|
+
if you use stored passwords.
|
|
28
49
|
- Remote Linux with `systemctl` for the service tools; Docker is optional and
|
|
29
|
-
detected per call.
|
|
50
|
+
detected per call. Privileged actions need the host configured with
|
|
51
|
+
`sudo: true` and `sudo -n` allowed on the target.
|
|
30
52
|
|
|
31
53
|
## Data and safety
|
|
32
54
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
State lives in `$DSH_HOME/ops-kit/` (default `~/.dsh/ops-kit/`), deliberately
|
|
56
|
+
outside the profile so upgrading or removing the bundle never loses the
|
|
57
|
+
inventory: `hosts.json`, `config.json`, `history.json`, `state.json`,
|
|
58
|
+
`alerts.json`, `channels.json`, and — only when passwords are used —
|
|
59
|
+
`secrets.json`.
|
|
60
|
+
|
|
61
|
+
`secrets.json` and `channels.json` are mode 0600. Passwords in `secrets.json`
|
|
62
|
+
are **base64-encoded, not encrypted**; treat that file as a secret. Webhook URLs
|
|
63
|
+
are secrets too, which is why `channels.json` is 0600.
|
|
64
|
+
|
|
65
|
+
Tool output is clipped at 8 KB with an explicit truncation marker.
|
|
37
66
|
|
|
38
67
|
## Limitations
|
|
39
68
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- Windows targets need an SSH server with a POSIX shell.
|
|
69
|
+
- SSH only: no cloud provider APIs, no Docker Compose or k8s orchestration.
|
|
70
|
+
- Metric retention is a bounded row cap, not a time-series database.
|
|
71
|
+
- Windows targets need an SSH server with a POSIX-like shell.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# dsh-ops-kit 使用说明
|
|
2
|
+
|
|
3
|
+
面向「第一次装上、想把一台服务器管起来」的人。
|
|
4
|
+
工具参数不在这里罗列 —— 那是模型读的 schema,会随版本变;这里只写**前置条件、典型流程、设置项和排障**。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. 前置条件(先看这条,能省掉一半排障)
|
|
9
|
+
|
|
10
|
+
插件连服务器有两条路径,先确定你走哪条:
|
|
11
|
+
|
|
12
|
+
| 路径 | 需要什么 | 适合 |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| **密钥 / ssh-agent**(默认) | 本机系统 `ssh` 能免密登录目标机(`ssh 用户@IP` 直接进去) | 大多数情况,推荐 |
|
|
15
|
+
| **密码** | 该 profile 里已装有 `ssh2` 包 | 临时机器、还没配密钥 |
|
|
16
|
+
|
|
17
|
+
先在**自己终端**里验一下,这一步过了插件才可能通:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
ssh -o BatchMode=yes 用户@IP 'echo ok' # 输出 ok 才算通
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`BatchMode=yes` 很关键 —— 插件就是用这个模式跑的,凡是会弹交互提示(比如首次连接确认主机指纹、或要求输密码)的情况,插件会**直接失败**。
|
|
24
|
+
|
|
25
|
+
### 还要满足
|
|
26
|
+
|
|
27
|
+
- **目标机有 POSIX shell**:Windows 机器只有当它自己跑了 SSH 服务且带类 POSIX shell 时才行。
|
|
28
|
+
- **需要 root 的操作要免密 sudo**:在主机配置里打开 `sudo: true`,且目标机允许 `sudo -n`(NOPASSWD)。否则「重启服务」这类动作会以权限错误失败,读操作不受影响。
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. 五分钟跑通
|
|
33
|
+
|
|
34
|
+
### 第一步:加主机
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
ops_hosts action=add name=web-1 host=10.0.0.11 user=deploy key=~/.ssh/id_ed25519 defaultHost=true
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
只填 IP + 用户 + 密码也能加(会存进 `secrets.json`),但建议走密钥。
|
|
41
|
+
|
|
42
|
+
### 第二步:验连通
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
ops_ssh_test host=web-1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
返回 `ok`、延迟、以及实际用的认证方式。**这一步不通就别往下走**,先回到第 1 节。
|
|
49
|
+
|
|
50
|
+
> 如果加了密码、但连不上并提示 `ssh2 is not installed in this profile`,说明这个 profile 缺 `ssh2`。要么装上它,要么改用密钥(此时可先跑 `ops_ssh_install_key host=web-1`,用已存的密码把本机公钥装上去,之后就不需要密码了)。
|
|
51
|
+
|
|
52
|
+
### 第三步:看一眼
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
ops_status host=web-1
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
一次给出:运行时长与负载、内存、根分区磁盘、失败的 systemd 单元、Docker 容器。
|
|
59
|
+
|
|
60
|
+
想一次看全部主机:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
ops_check_all
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 第四步:打开面板
|
|
67
|
+
|
|
68
|
+
侧边栏 **Ops** 页。这里能增删主机、跑单机检查、批量下命令;后面第 3 节细说。
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 3. 面板十个子页
|
|
73
|
+
|
|
74
|
+
从「多机概览」点进某台机器,左侧是十个子页:
|
|
75
|
+
|
|
76
|
+
| 子页 | 干什么 |
|
|
77
|
+
|---|---|
|
|
78
|
+
| **概览** | 健康分、关键指标、证书到期、备份状态 |
|
|
79
|
+
| **监控** | 该机的监控项(http / 端口 / 进程 / 服务 / 脚本),可增删测 |
|
|
80
|
+
| **配置** | 浏览常见配置文件,改之前自动备份 `.bak.<时间戳>`,可看历史并回滚 |
|
|
81
|
+
| **应用** | 正在跑的服务与容器,带 日志 / 重启 / 停止 |
|
|
82
|
+
| **日志** | systemd 单元或任意日志文件的尾部 |
|
|
83
|
+
| **文件** | 目录列表、大小、修改时间 |
|
|
84
|
+
| **终端** | 网页里的 SSH 终端(需要 `ssh2`) |
|
|
85
|
+
| **备份** | 备份列表、一键恢复、删除 |
|
|
86
|
+
| **计划任务** | crontab 可视化增删 |
|
|
87
|
+
| **发布** | 一键发布任务:git pull → 构建 → 重启 → 健康检查 |
|
|
88
|
+
|
|
89
|
+
**重启 / 停止 / 回滚 / 恢复都会先弹确认**,不会点了就执行。
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 4. 常用任务怎么说
|
|
94
|
+
|
|
95
|
+
不需要记工具名,直接说人话:
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
看一下 web-1 的状态
|
|
99
|
+
web-1 上 nginx 最近 50 行日志
|
|
100
|
+
磁盘满了,看看 / 下面谁占的空间
|
|
101
|
+
把 web-1 上的 my-api 重启一下(我确认)
|
|
102
|
+
所有机器上跑一下 uptime
|
|
103
|
+
web-1 的证书还有几天
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 提问式诊断
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
ops_ask host=web-1 question="mysql 还活着吗,为什么连不上"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
模型会自己挑**只读**命令去查并给结论;遇到要改状态的命令,它只返回「需要确认」,不会擅自执行。
|
|
113
|
+
|
|
114
|
+
### 批量
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
ops_batch command="df -h" hosts=[web-1,web-2]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
不给 `hosts` 就是全部主机。破坏性命令必须带 `confirm`。
|
|
121
|
+
|
|
122
|
+
### 备份
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
ops_backup host=web-1 action=backup type=mysql database=app
|
|
126
|
+
ops_backup host=web-1 action=list
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
默认存在 `/home/backup`,默认保留 7 份,恢复和删除都要确认。
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 5. 设置项(`ops_config`)
|
|
134
|
+
|
|
135
|
+
留空调用就是读当前值。默认值如下:
|
|
136
|
+
|
|
137
|
+
| 键 | 默认 | 范围 | 说明 |
|
|
138
|
+
|---|---|---|---|
|
|
139
|
+
| `enabled` | `true` | — | 是否开启后台定时检查 |
|
|
140
|
+
| `intervalMinutes` | `10` | 1–1440 | 后台检查间隔(分钟) |
|
|
141
|
+
| `diskWarnPercent` | `90` | 50–99 | 根分区超过此比例告警 |
|
|
142
|
+
| `metricsMinutes` | `5` | 1–60 | 指标采样间隔(分钟) |
|
|
143
|
+
| `timeoutSec` | `25` | 5–300 | 通用请求超时 |
|
|
144
|
+
| `scanSec` | `90` | 10–600 | 清单扫描超时(主机多或慢时调大) |
|
|
145
|
+
| `actionSec` | `45` | 10–600 | 动作与取日志超时 |
|
|
146
|
+
| `quickCommands` | 6 条常用命令 | 最多 12 条 | 终端下方的快捷键 |
|
|
147
|
+
| `aiEnabled` | `true` | — | 是否启用 `ops_ask` 的 AI 诊断 |
|
|
148
|
+
| `aiProvider` / `aiModel` | 空 = 用 DSH 默认模型 | — | 指定运维 AI 用哪个模型 |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 6. 数据存在哪、有多敏感
|
|
153
|
+
|
|
154
|
+
全部在 `$DSH_HOME/ops-kit/`(默认 `~/.dsh/ops-kit/`),**刻意放在 profile 之外**,所以升级或卸载插件都不会丢。
|
|
155
|
+
|
|
156
|
+
| 文件 | 内容 | 敏感度 |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| `hosts.json` | 主机清单 | 低 |
|
|
159
|
+
| `secrets.json` | 密码,**base64 编码而非加密**,权限 0600 | **高,等同密钥** |
|
|
160
|
+
| `channels.json` | 告警渠道 URL,权限 0600 | **高,URL 本身就是密钥** |
|
|
161
|
+
| `history.json` | 每次检查的历史 | 低 |
|
|
162
|
+
| `config.json` | 上面那张设置表 | 低 |
|
|
163
|
+
| `state.json` / `alerts.json` | 调度状态与告警记录 | 低 |
|
|
164
|
+
|
|
165
|
+
请注意 `secrets.json` 里**不是加密的**:任何能读这个文件的人都能拿到服务器密码。要么改用密钥认证,要么确保这台机器的账户权限是干净的。
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 7. 排障
|
|
170
|
+
|
|
171
|
+
| 现象 | 原因与处理 |
|
|
172
|
+
|---|---|
|
|
173
|
+
| `ops_ssh_test` 不通,但手敲 `ssh` 能进 | 插件用 `BatchMode`,不处理交互。把主机指纹先加进 `known_hosts`,或改用密钥 |
|
|
174
|
+
| 提示 `ssh2 is not installed in this profile` | 用的是密码路径但 profile 里没 `ssh2`。装 `ssh2`,或改用密钥(`ops_ssh_install_key`) |
|
|
175
|
+
| 重启服务报权限错误 | 主机没开 `sudo: true`,或目标机不允 `sudo -n` |
|
|
176
|
+
| 结果末尾有截断标记 | 输出超 8 KB 被裁掉了。缩小范围(`lines=`、更精确的命令)而不是调大上限 |
|
|
177
|
+
| 定时检查没动静 | `ops_config` 里 `enabled` 是否为 true;`scanSec` 是否太小导致大面积超时 |
|
|
178
|
+
| 告警没到 | 渠道 URL 是否过期(群机器人会重置);级别是否匹配;相同告警 10 分钟内不重发 |
|
|
179
|
+
| 面板打不开有数据但空 | 检查该会话是否加载了本插件,以及 `/ops-kit/api` 是否被反代拦截 |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 8. 会改变状态的操作用了会怎样
|
|
184
|
+
|
|
185
|
+
| 操作 | 需要 |
|
|
186
|
+
|---|---|
|
|
187
|
+
| 启停 / 重启服务、重启容器 | `confirm: true` |
|
|
188
|
+
| `ops_run` 执行破坏性命令(`rm -rf /`、`mkfs`、`dd` 写设备、`shutdown`/`reboot`) | `confirm: true`,否则直接拒绝 |
|
|
189
|
+
| 备份恢复与删除、配置回滚、一键发布 | `confirm: true` |
|
|
190
|
+
| 健康检查、`ops_status`、`ops_check_all`、`ops_ssh_test`、`ops_ask` | 只读,不需要确认 |
|
|
191
|
+
|
|
192
|
+
设计原则是**读操作永远可以随便跑,写操作必须有人点头**。
|
package/locale/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Ops kit",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Run Linux servers from the chat: 34 tools and a sidebar panel covering SSH inventory, health checks, logs and processes, backups and restore, certificates, cron, one-click deploy and Feishu/DingTalk/WeCom alerts — every state-changing action asks for confirmation.",
|
|
5
5
|
"detail": "docs/DETAIL.md"
|
|
6
6
|
}
|
|
7
7
|
}
|
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ops-kit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Server operations kit for DeepSeek Harness: server cards, health charts, config browser, app manager and plain-language AI diagnosis — over SSH, no agent install.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
"client.js",
|
|
18
18
|
"cordis.patch.yml",
|
|
19
19
|
"locale/*.json",
|
|
20
|
-
"docs",
|
|
20
|
+
"docs/DETAIL.md",
|
|
21
|
+
"docs/USAGE.zh-CN.md",
|
|
21
22
|
"icon.svg",
|
|
22
23
|
"README.md",
|
|
24
|
+
"README.zh-CN.md",
|
|
23
25
|
"LICENSE"
|
|
24
26
|
],
|
|
25
27
|
"keywords": [
|
package/docs/ROADMAP.md
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# dsh-ops-kit 功能规划(除告警外)
|
|
2
|
-
|
|
3
|
-
> 目标用户:不懂 Linux 的站长 / 小团队负责人。
|
|
4
|
-
> 交互原则:**只看看、点点、说人话**,不出现命令行和原始输出。
|
|
5
|
-
> 本文对比 1Panel、宝塔、Uptime Kuma 的成熟做法,标出我们缺什么、先做什么。
|
|
6
|
-
|
|
7
|
-
## 一、现状盘点(v0.2.x 已具备)
|
|
8
|
-
|
|
9
|
-
| 域 | 已有能力 |
|
|
10
|
-
|---|---|
|
|
11
|
-
| 连接 | 多主机、密钥/密码、连接测试、终端(真 PTY)、命令控制台、keepalive |
|
|
12
|
-
| 监控 | CPU/内存/磁盘/负载/Swap/网络/IO/进程数/TCP/运行时长、历史曲线、每台机器趋势 |
|
|
13
|
-
| 巡检 | 端口、服务、Docker、Nginx 站点、Java 进程、Cron、挂载、SSL 到期 |
|
|
14
|
-
| 服务监控 | http / port / process / service / script 五类、间隔可配、失败写告警 |
|
|
15
|
-
| 运维动作 | 服务启停、容器操作、磁盘清理、进程查看/结束、日志尾随、SSL 检测 |
|
|
16
|
-
| 文件 | 浏览、下载/上传(8MB)、配置读取/写入(自动备份 .bak) |
|
|
17
|
-
| AI | 智能诊断、对话式问答(只读自动执行)、命令生成、`?` 前缀模式、模型可选 |
|
|
18
|
-
| 设置 | 主机管理、常用命令、AI 模型、巡检频率 |
|
|
19
|
-
|
|
20
|
-
**结论**:看得见的部分基本齐了;**看不见的(备份、审计、证书、发布、计划任务)和"出事后怎么救"是空的。**
|
|
21
|
-
|
|
22
|
-
## 二、竞品对照(调研结论)
|
|
23
|
-
|
|
24
|
-
| 能力 | 1Panel | 宝塔 | Uptime Kuma | dsh-ops-kit |
|
|
25
|
-
|---|---|---|---|---|
|
|
26
|
-
| 主机监控 | ✅ | ✅ | — | ✅ |
|
|
27
|
-
| 网站/域名管理 | ✅ | ✅ | — | ⚠️ 只读清单 |
|
|
28
|
-
| 数据库管理/备份 | ✅ 一键备份恢复 + 云存储 | ✅ | — | ❌ |
|
|
29
|
-
| 文件管理 | ✅ | ✅ | — | ✅(无解压/编辑大文件) |
|
|
30
|
-
| 计划任务 | ✅ | ✅ | — | ❌(只看得到 cron) |
|
|
31
|
-
| 应用商店 / 一键部署 | ✅ | ✅ | — | ❌ |
|
|
32
|
-
| 安全模块(WAF、入侵检测) | ⚠️ X Pack | ✅ 免费 | — | ❌ |
|
|
33
|
-
| 证书自动续期 | ✅ | ✅ | — | ⚠️ 只告警 |
|
|
34
|
-
| 告警外发 | ✅ | ✅ | ✅ | ❌(下一步) |
|
|
35
|
-
| AI 助手 | ⚠️ 新加 | ✅ 11.7 新增全局 AI | — | ✅ 原生 |
|
|
36
|
-
| 多机管理 | ⚠️ X Pack | ⚠️ | ✅ 多探针 | ✅ |
|
|
37
|
-
|
|
38
|
-
来源:
|
|
39
|
-
- 1Panel 100 版本说明(应用商店、网站分组、数据库备份加密、计划任务、多机 X-Pack)https://blog.fit2cloud.com/?p=e85626a9-4293-4224-a81e-07232e411cd3
|
|
40
|
-
- 1Panel 功能概览(主机监控、文件、数据库、容器、大模型管理、一键备份恢复)https://pkg.go.dev/github.com/1Panel-dev/1Panel@v1.10.27-lts
|
|
41
|
-
- 宝塔 11.7.0 更新(面板多处 AI 助手、安全模块、网站统计)https://docs.bt.cn/update-log/linux-panel-11-7-0
|
|
42
|
-
- Uptime Kuma 的 MCP 封装(监视器增删改、心跳记录)https://www.mcpworld.com/zh/detail/0490511ba1c563c5db30b5993ec4d11d
|
|
43
|
-
|
|
44
|
-
**差异化机会**:1Panel/宝塔都要在服务器上装一个面板(占资源、暴露端口、要维护),我们**不装 agent,纯 SSH**;且 AI 是原生的,不是外挂。所以产品定位应是"**不装东西的远程运维助手**",而不是再做一个面板。
|
|
45
|
-
|
|
46
|
-
## 三、差距清单(按小白价值排序)
|
|
47
|
-
|
|
48
|
-
> 更新:P0-1 ~ P0-3、P1-4 ~ P1-6 已于 0.3.0 实现(见 CHANGELOG)。
|
|
49
|
-
|
|
50
|
-
### P0|出事能救回来(没有这个不敢用)
|
|
51
|
-
|
|
52
|
-
1. **备份与恢复**
|
|
53
|
-
- MySQL / MariaDB 逻辑备份(`mysqldump --single-transaction`),可选单库或全部
|
|
54
|
-
- 网站目录 / 指定目录打包备份(排除日志、缓存)
|
|
55
|
-
- 保留策略:最近 N 份 / N 天,自动清理
|
|
56
|
-
- 一键恢复(恢复到临时库校验后再切,或覆盖前自动再备份一份)
|
|
57
|
-
- 面板:列表、立即备份、下载、恢复、删除;失败原因用中文说明
|
|
58
|
-
- 验收:给公司服务器配"每天 03:00 备份 mysqld + /www/wwwroot",保留 7 份,列表能看到大小与耗时
|
|
59
|
-
|
|
60
|
-
2. **一键体检 + 健康评分**
|
|
61
|
-
- 首页每台机器一个分数(0–100)+ 一句话结论 + 待办清单(最多 3 条)
|
|
62
|
-
- 检查项:磁盘水位、内存/交换、失败服务、证书剩余天数、端口暴露、root 登录、防火墙、备份是否成功、上次备份时间
|
|
63
|
-
- 每条待办可点「让 AI 解释」「一键修复」(白名单动作)
|
|
64
|
-
- 验收:首页能回答"这台机器现在有什么问题、先做哪件事"
|
|
65
|
-
|
|
66
|
-
3. **证书到期与续期**
|
|
67
|
-
- 扫描 80/443 站点证书,显示剩余天数(已有基础)
|
|
68
|
-
- 支持 certbot 续期(`certbot renew --dry-run` 先预演,再实际续期)
|
|
69
|
-
- 到期前 14/7/3 天写告警
|
|
70
|
-
|
|
71
|
-
### P1|日常省事
|
|
72
|
-
|
|
73
|
-
4. **计划任务(可视化 cron)**
|
|
74
|
-
- 读服务器 crontab(已有),支持新增/停用/删除,语法用表单生成(每天/每周/每月 + 时间 + 命令)
|
|
75
|
-
- 面板内本地任务:备份、清理、体检、自定义工作流
|
|
76
|
-
- 执行历史:最近 20 次,成功/失败/输出摘要
|
|
77
|
-
|
|
78
|
-
5. **配置变更历史 / 回滚**
|
|
79
|
-
- 现在写入会留 `.bak.<ts>`,但没有界面
|
|
80
|
-
- 面板:文件变更记录、diff 预览、一键回滚到上一版
|
|
81
|
-
|
|
82
|
-
6. **部署发布(把代码更新上去)**
|
|
83
|
-
- 表单:目录、拉取方式(git pull / 上传 zip)、构建命令、重启服务、健康检查 URL
|
|
84
|
-
- 一键发布 + 失败自动回滚到上一个版本
|
|
85
|
-
- 与既有 `dsh-server-deploy` 打通,复用它的配置
|
|
86
|
-
|
|
87
|
-
7. **日志中心**
|
|
88
|
-
- 多来源聚合(nginx access/error、应用日志、journal)
|
|
89
|
-
- 关键字过滤 + 时间范围 + 错误聚类(相同堆栈合并计数)
|
|
90
|
-
- "最近 1 小时有哪些报错"一键回答
|
|
91
|
-
|
|
92
|
-
### P2|安全与主动通知
|
|
93
|
-
|
|
94
|
-
8. **告警外发**(已定最后做)
|
|
95
|
-
- 飞书 / 钉钉 / 企业微信机器人 + SMTP 邮件
|
|
96
|
-
- 测试按钮、静默时段、同类合并(10 分钟内同错误只发一次)
|
|
97
|
-
|
|
98
|
-
9. **日报 / 周报**
|
|
99
|
-
- 每天早上推送:磁盘趋势、备份结果、失败服务、证书到期
|
|
100
|
-
- 一周容量预测:"按目前速度,磁盘还能用 18 天"
|
|
101
|
-
|
|
102
|
-
10. **登录与暴露面审计**
|
|
103
|
-
- 最近登录记录(成功/失败)、fail2ban 状态、SSH 密码登录是否开启
|
|
104
|
-
- 公网暴露端口清单 + 风险提示(如 3306/6379 对外)
|
|
105
|
-
|
|
106
|
-
### P3|扩展
|
|
107
|
-
|
|
108
|
-
11. **Docker 应用模板**(MySQL/Redis/PostgreSQL/WordPress/Node 一键起)
|
|
109
|
-
12. **MCP / CLI 导出**:把 `ops_*` 包成 MCP server 和命令行,让 Codex/Claude Code/OpenClaw 也能用(复用同一份配置)
|
|
110
|
-
13. **团队版**:多用户、角色权限、操作审计、凭据加密保管(这是收费点)
|
|
111
|
-
|
|
112
|
-
## 四、不建议做(或明确不做)
|
|
113
|
-
|
|
114
|
-
- **WAF / 入侵检测 / 病毒扫描**:和云厂商安全组、宝塔冲突,维护成本极高
|
|
115
|
-
- **自建面板 agent**:违背"不装东西"的定位
|
|
116
|
-
- **DNS / 域名注册管理**:直接跳转到云厂商控制台即可
|
|
117
|
-
- **K8s / 大规模集群编排**:目标用户不碰
|
|
118
|
-
- **计费/账单**:需要云厂商 API key,敏感且各家不同
|
|
119
|
-
|
|
120
|
-
## 五、建议的落地顺序
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
现在 ──► 备份与恢复(P0-1)──► 一键体检 + 评分(P0-2)──► 证书续期(P0-3)
|
|
124
|
-
──► 计划任务(P1-4)──► 配置回滚(P1-5)──► 发布(P1-6)
|
|
125
|
-
──► 告警外发(P2-8)──► 日报(P2-9)──► 审计(P2-10)
|
|
126
|
-
──► 应用模板 / MCP 导出 / 团队版
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
每项都遵循同一套验收标准:
|
|
130
|
-
|
|
131
|
-
1. 不需要命令行;所有失败有一句中文原因
|
|
132
|
-
2. 危险动作二次确认 + 可回滚
|
|
133
|
-
3. AI 能解释这项功能在做什么
|
|
134
|
-
4. 面板上 30 秒内能找到入口
|