docs(deploy): merge nx god into unified menu and expand README
Consolidate install and ops into a single nx menu with one-click update via update.sh; document all curl install/update entry points in the root README. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,15 +10,19 @@
|
||||
| 安装向导 | `https://你的域名/app/install.html` |
|
||||
| 文档索引 | [docs/README.md](docs/README.md) |
|
||||
|
||||
生产 Docker 栈 **仅含 Nexus 容器**;MySQL / Redis 在宿主机或 1Panel 自行安装。
|
||||
|
||||
---
|
||||
|
||||
## 一键安装(公共仓库,推荐)
|
||||
## 一键命令速查(root · 公共仓库 · 无需令牌)
|
||||
|
||||
在 **root** 登录的 Linux 服务器上执行(仿 [1Panel](https://1panel.cn/) 风格,无需 Gitea Token):
|
||||
|
||||
```bash
|
||||
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/quick-install.sh" | bash
|
||||
```
|
||||
| 场景 | 一条命令 |
|
||||
|------|----------|
|
||||
| **仅装 Nexus**(1Panel 已就绪) | `curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/quick-install.sh" \| bash` |
|
||||
| **重装服务器**(1Panel + Docker + Nexus) | `curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/install-1panel-docker.sh" \| bash` |
|
||||
| **一键更新**(pull + 重建镜像) | `curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/update.sh" \| bash` |
|
||||
| **强制无缓存重建**(entrypoint 变更后) | `curl -fsSL ".../deploy/update.sh" \| bash -s -- --no-cache` |
|
||||
| **已 clone** | `cd /opt/nexus && bash deploy/update.sh` |
|
||||
|
||||
指定资源档位(`1c4g` / `2c8g` 默认 / `4c16g`):
|
||||
|
||||
@@ -26,62 +30,41 @@ curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/quick-in
|
||||
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/quick-install.sh" | bash -s -- --profile 4c16g
|
||||
```
|
||||
|
||||
可选:先下载再执行(便于审计脚本内容):
|
||||
**raw 地址**:`http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/<脚本名>`
|
||||
|
||||
```bash
|
||||
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/quick-install.sh" -o /tmp/quick-install.sh
|
||||
bash /tmp/quick-install.sh --profile 2c8g
|
||||
```
|
||||
|
||||
**raw 地址说明**(匿名可访问,须返回 `#!/` 而非 HTML 404):
|
||||
|
||||
- `http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/<脚本名>`
|
||||
- 等价:`http://66.154.115.8:3000/raw/main/deploy/<脚本名>`
|
||||
|
||||
安装完成后在浏览器打开安装向导,完成 `.env` / MySQL / 管理员初始化。
|
||||
|
||||
**每台新服务器的 NEXUS 密钥自动不同**:安装脚本生成 `NEXUS_SECRET_KEY` / `NEXUS_API_KEY` / `NEXUS_ENCRYPTION_KEY` 写入 `docker/.env.prod`,备份在 `/root/.nexus-install-secrets-*.env`。MySQL/Redis 请自行安装;勿把生产密钥放进 `nexus-1panel.secrets.sh`(仅保留 `NEXUS_GITEA_TOKEN`)。
|
||||
安装完成后浏览器打开安装向导,完成 MySQL(自建)/ Redis(自建)/ 管理员初始化。
|
||||
|
||||
---
|
||||
|
||||
## 已 clone 到本机(跳过再次拉仓)
|
||||
## NX 统一运维菜单
|
||||
|
||||
装好后在服务器输入 **`nx`**(安装脚本会链到 `/usr/local/bin/nx`):
|
||||
|
||||
```bash
|
||||
cd /opt/nexus && git pull
|
||||
bash deploy/install-nexus-fresh.sh --skip-clone
|
||||
nx # 统一菜单:安装 + 一键更新 + 重启 + 日志 + 备份
|
||||
nx update # 非交互一键更新
|
||||
nx update --no-cache
|
||||
nx install-fresh # 全新安装
|
||||
nx health # 健康检查
|
||||
```
|
||||
|
||||
或交互菜单:
|
||||
| 菜单项 | 作用 |
|
||||
|--------|------|
|
||||
| `[4] 一键更新` | pull + 重建 Docker 镜像(等同 `deploy/update.sh`) |
|
||||
| `[5] 重启 Nexus` | 重启 Python 应用 |
|
||||
| `[6] 日志` | 跟踪容器日志 |
|
||||
| `[1][2]` | 安装 / 全新安装向导 |
|
||||
|
||||
```bash
|
||||
nx
|
||||
# 选「全新安装」或子命令: nx install-fresh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## NX 运维菜单(装好后)
|
||||
|
||||
安装脚本会向 `PATH` 注册:
|
||||
全局命令(符号链接):
|
||||
|
||||
| 命令 | 作用 |
|
||||
|------|------|
|
||||
| `nx` | 交互主菜单(安装 / 升级 / 健康检查) |
|
||||
| `nx god` | **上帝菜单**:重启 Python、全栈重启、日志、升级、备份等 |
|
||||
| `nx` | 统一运维菜单 |
|
||||
| `nexus-update` | 等同 `deploy/update.sh` |
|
||||
| `nexus-fresh` | 等同 `install-nexus-fresh.sh` |
|
||||
| `nexus-install` | 快捷安装入口 |
|
||||
| `nexus-install` | 等同 `quick-install.sh` |
|
||||
|
||||
常用子命令:
|
||||
|
||||
```bash
|
||||
nx # 主菜单
|
||||
nx god # 上帝运维菜单
|
||||
nx install-fresh # 全新空库安装 → /app/install.html
|
||||
nx install-auto # 非交互安装(需已配置密钥,默认 2c8g)
|
||||
nx health # 健康检查 / 端口预检
|
||||
```
|
||||
|
||||
底层仍可直接调用:`bash deploy/nexus-1panel.sh install|upgrade|check|ports`
|
||||
> `nx god` 已合并进 `nx` 主菜单,仍可作为兼容别名使用。
|
||||
|
||||
---
|
||||
|
||||
@@ -89,30 +72,41 @@ nx health # 健康检查 / 端口预检
|
||||
|
||||
### 1Panel + Docker 生产(主路径)
|
||||
|
||||
| 脚本 | 用途 |
|
||||
|------|------|
|
||||
| [quick-install.sh](deploy/quick-install.sh) | **公共仓库 curl 入口**;clone + 调用全新安装 |
|
||||
| [install-nexus-fresh.sh](deploy/install-nexus-fresh.sh) | 全新安装(空库 → 安装向导);支持 `--skip-clone`、`--profile` |
|
||||
| [nexus-1panel.sh](deploy/nexus-1panel.sh) | 迁机 / 升级 / 检查 / 端口预检;可被 `nx` 调用 |
|
||||
| [nx](deploy/nx) | 交互主菜单 + 上帝菜单 |
|
||||
| [install-1panel-docker.sh](deploy/install-1panel-docker.sh) | 转调 `nx` 的 Docker 安装包装 |
|
||||
| [upgrade-1panel-docker.sh](deploy/upgrade-1panel-docker.sh) | 转调 `nx` 的升级包装 |
|
||||
| [download-install-fresh.sh](deploy/download-install-fresh.sh) | 从 Gitea API/raw 下载安装脚本(私有库需 Token) |
|
||||
| 脚本 | 用途 | curl 入口 |
|
||||
|------|------|-----------|
|
||||
| [quick-install.sh](deploy/quick-install.sh) | **公共仓库安装入口** | ✅ 上表 |
|
||||
| [install-1panel-docker.sh](deploy/install-1panel-docker.sh) | 1Panel + Docker + Nexus 全链 | ✅ 上表 |
|
||||
| [install-nexus-fresh.sh](deploy/install-nexus-fresh.sh) | 全新空库 → 安装向导 | `bash deploy/install-nexus-fresh.sh --skip-clone` |
|
||||
| [update.sh](deploy/update.sh) | **一键更新**(pull + 重建) | ✅ 上表 |
|
||||
| [upgrade-1panel-docker.sh](deploy/upgrade-1panel-docker.sh) | 转调 `nexus-1panel.sh upgrade` | — |
|
||||
| [nexus-1panel.sh](deploy/nexus-1panel.sh) | 安装 / 升级 / check / ports 底层 | — |
|
||||
| [nx](deploy/nx) | **统一交互菜单** | `nx` |
|
||||
| [uninstall-mysql-compose.sh](deploy/uninstall-mysql-compose.sh) | 卸载遗留 Compose MySQL 容器 | — |
|
||||
| [uninstall-redis-compose.sh](deploy/uninstall-redis-compose.sh) | 卸载遗留 Compose Redis 容器 | — |
|
||||
| [sync-install-wizard-to-container.sh](deploy/sync-install-wizard-to-container.sh) | 热同步 install.html 到容器 | — |
|
||||
| [download-install-fresh.sh](deploy/download-install-fresh.sh) | 下载安装脚本(私有库可选 Token) | — |
|
||||
|
||||
详细说明:[deploy/README-1panel.md](deploy/README-1panel.md)
|
||||
|
||||
### 更新选项
|
||||
|
||||
```bash
|
||||
bash deploy/update.sh # 默认:Git 拉取(若有)+ 重建容器
|
||||
bash deploy/update.sh --check # 仅查 Git
|
||||
bash deploy/update.sh --no-cache # 无缓存重建镜像
|
||||
bash deploy/update.sh --no-backup # 跳过 MySQL 备份
|
||||
```
|
||||
|
||||
### Docker Compose 与档位
|
||||
|
||||
| 路径 | 用途 |
|
||||
|------|------|
|
||||
| [docker/docker-compose.prod.yml](docker/docker-compose.prod.yml) | 生产 Compose(变量化 CPU/内存) |
|
||||
| [docker/docker-compose.prod.yml](docker/docker-compose.prod.yml) | 生产 Compose(**仅 nexus 服务**) |
|
||||
| [docker/profiles/1c4g.env](docker/profiles/1c4g.env) | 1 核 4G |
|
||||
| [docker/profiles/2c8g.env](docker/profiles/2c8g.env) | 2 核 8G(默认) |
|
||||
| [docker/profiles/4c16g.env](docker/profiles/4c16g.env) | 4 核 16G |
|
||||
| [docker/README.md](docker/README.md) | 镜像与本地开发说明 |
|
||||
|
||||
安装参数:`--profile 1c4g|2c8g|4c16g`
|
||||
|
||||
### 经典 SSH / Supervisor 部署(宝塔 / 裸机)
|
||||
|
||||
| 脚本 | 用途 |
|
||||
@@ -122,20 +116,10 @@ nx health # 健康检查 / 端口预检
|
||||
| [deploy-on-server.sh](deploy/deploy-on-server.sh) | 服务器侧部署 |
|
||||
| [deploy-production.sh](deploy/deploy-production.sh) | 生产发布流程 |
|
||||
| [deploy-frontend.sh](deploy/deploy-frontend.sh) | 构建 Vue 前端并打包到 `web/app/` |
|
||||
| [pre_deploy_check.sh](deploy/pre_deploy_check.sh) | **7 道门控**(changelog / 审计 / 测试 / ruff / import / bandit / review) |
|
||||
| [health_monitor.sh](deploy/health_monitor.sh) | cron 健康检查,`/health` 失败重启 |
|
||||
| [db_backup.sh](deploy/db_backup.sh) | MySQL 备份(30 天保留) |
|
||||
| [run_test_api_on_server.sh](deploy/run_test_api_on_server.sh) | 服务器上跑 `test_api` |
|
||||
| [pre_deploy_check.sh](deploy/pre_deploy_check.sh) | **7 道门控** |
|
||||
| [health_monitor.sh](deploy/health_monitor.sh) | cron 健康检查 |
|
||||
| [db_backup.sh](deploy/db_backup.sh) | MySQL 备份 |
|
||||
| [uninstall.sh](deploy/uninstall.sh) | 卸载 |
|
||||
| [check_shell_eol.sh](deploy/check_shell_eol.sh) | Shell 脚本 EOL 检查 |
|
||||
|
||||
### 本地与验收
|
||||
|
||||
| 脚本 | 用途 |
|
||||
|------|------|
|
||||
| [scripts/local_verify.sh](scripts/local_verify.sh) | L2b 本地验证(ruff / import / 前端 typecheck 等) |
|
||||
| [scripts/run_nexus_acceptance.py](scripts/run_nexus_acceptance.py) | L4 验收 |
|
||||
| [verify.py](verify.py) | 快速验证入口 |
|
||||
|
||||
---
|
||||
|
||||
@@ -143,10 +127,12 @@ nx health # 健康检查 / 端口预检
|
||||
|
||||
| 场景 | 做法 |
|
||||
|------|------|
|
||||
| **新 VPS、空 MySQL** | `curl \| bash` 或 `install-nexus-fresh.sh` → 浏览器走完安装向导 |
|
||||
| **已有数据、换机** | `nexus-1panel.sh install`(带备份/恢复逻辑)或 `nx` 迁机流程 |
|
||||
| **仅升级代码/镜像** | `nx` → 升级,或 `upgrade-1panel-docker.sh` / `nexus-1panel.sh upgrade` |
|
||||
| **不必重装整台 VPS** | 在 `/opt/nexus` 内 `git pull` + `nx god` 重启即可 |
|
||||
| **新 VPS、空库** | `curl \| quick-install.sh` → 1Panel 自建 MySQL/Redis → `/app/install.html` |
|
||||
| **已有数据、换机** | `nexus-1panel.sh install --from-env` 或 `nx` → 安装向导 |
|
||||
| **仅升级代码/镜像** | `nx update` 或 `bash deploy/update.sh` |
|
||||
| **不必重装 VPS** | `cd /opt/nexus && nx update` |
|
||||
|
||||
每台新服务器自动生成唯一 `NEXUS_SECRET_KEY` / `NEXUS_API_KEY` / `NEXUS_ENCRYPTION_KEY`(写入 `docker/.env.prod`,备份 `/root/.nexus-install-secrets-*.env`)。MySQL 密码由自建库时自行设定。
|
||||
|
||||
---
|
||||
|
||||
@@ -155,34 +141,27 @@ nx health # 健康检查 / 端口预检
|
||||
```
|
||||
Nexus/
|
||||
├── server/ # FastAPI 后端(Clean Architecture)
|
||||
├── frontend/ # Vue 3 + Vuetify 4 SPA → 构建到 web/app/
|
||||
├── frontend/ # Vue 3 + Vuetify 4 SPA → 构建到 web/app/
|
||||
├── web/app/ # 静态资源挂载点(构建产物 gitignore)
|
||||
├── deploy/ # 安装、门控、健康检查、运维脚本
|
||||
├── deploy/ # 安装、更新、门控、nx 菜单
|
||||
├── docker/ # Compose、镜像、profiles
|
||||
├── docs/ # 设计 / changelog / 审计 / 报告
|
||||
├── tests/ # API 与集成测试
|
||||
└── standards/ # 开发与逐行审计标准
|
||||
```
|
||||
|
||||
启动模式:
|
||||
|
||||
- **无 `.env`**:仅 `/api/install/` + 安装页(安装模式)
|
||||
- **有 `.env`**:完整业务 API + 后台任务
|
||||
|
||||
---
|
||||
|
||||
## 开发
|
||||
|
||||
```bash
|
||||
# 后端(需 .env)
|
||||
pip install -r requirements.txt
|
||||
uvicorn server.main:app --reload --port 8600
|
||||
|
||||
# 前端
|
||||
cd frontend && npm run dev # http://localhost:3000/app/
|
||||
```
|
||||
|
||||
Linux 路径与本地联调:[docs/project/linux-dev-paths.md](docs/project/linux-dev-paths.md) · [UBUNTU-DEV-README.txt](UBUNTU-DEV-README.txt)
|
||||
Linux 路径:[docs/project/linux-dev-paths.md](docs/project/linux-dev-paths.md) · [UBUNTU-DEV-README.txt](UBUNTU-DEV-README.txt)
|
||||
|
||||
---
|
||||
|
||||
@@ -190,12 +169,11 @@ Linux 路径与本地联调:[docs/project/linux-dev-paths.md](docs/project/lin
|
||||
|
||||
| 文档 | 说明 |
|
||||
|------|------|
|
||||
| [docs/README.md](docs/README.md) | 文档总索引(SSOT) |
|
||||
| [docs/README.md](docs/README.md) | 文档总索引 |
|
||||
| [docs/project/nexus-functional-development-guide.md](docs/project/nexus-functional-development-guide.md) | 功能 / API / 14 页 |
|
||||
| [docs/project/AI-HANDOFF-2026-06-03.md](docs/project/AI-HANDOFF-2026-06-03.md) | 当前会话接续 |
|
||||
| [AGENTS.md](AGENTS.md) · [CLAUDE.md](CLAUDE.md) | Agent 薄入口 |
|
||||
|
||||
变更记录:`docs/changelog/` · 门控审计:`docs/audit/`
|
||||
变更:`docs/changelog/` · 门控:`docs/audit/`
|
||||
|
||||
---
|
||||
|
||||
@@ -203,10 +181,9 @@ Linux 路径与本地联调:[docs/project/linux-dev-paths.md](docs/project/lin
|
||||
|
||||
| 用途 | 地址 |
|
||||
|------|------|
|
||||
| 仓库首页(产品说明 / README) | http://66.154.115.8:3000/admin/Nexus |
|
||||
| Git 克隆 / push | http://66.154.115.8:3000/admin/Nexus.git |
|
||||
| 仓库首页 | http://66.154.115.8:3000/admin/Nexus |
|
||||
| Git | http://66.154.115.8:3000/admin/Nexus.git |
|
||||
|
||||
- 分支:`main`
|
||||
- 提交前请通过 `deploy/pre_deploy_check.sh`(7 道门控)
|
||||
分支 `main` · 提交前跑 `deploy/pre_deploy_check.sh`(7 道门控)
|
||||
|
||||
**注意**:`deploy/nexus-1panel.secrets.sh`、根目录 `.env`、`SECRETS.md` 含敏感信息,**勿提交到 Git**。生产密钥仅保存在服务器与本机私密文档中。
|
||||
**勿提交**:`deploy/nexus-1panel.secrets.sh`、根目录 `.env`、`SECRETS.md`
|
||||
|
||||
+82
-74
@@ -1,136 +1,144 @@
|
||||
# 1Panel + Docker 一键部署
|
||||
|
||||
## 重装服务器(推荐:1Panel + Docker + Nexus 一条链)
|
||||
## 脚本速查(公共仓库 · 无需令牌)
|
||||
|
||||
| 脚本 | 用途 | 一条命令 |
|
||||
|------|------|----------|
|
||||
| `quick-install.sh` | 仅装 Nexus(1Panel 已就绪) | `curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/quick-install.sh" \| bash` |
|
||||
| `install-1panel-docker.sh` | 重装服务器全链 | `curl -fsSL ".../install-1panel-docker.sh" \| bash` |
|
||||
| `install-nexus-fresh.sh` | 全新空库安装 | `bash deploy/install-nexus-fresh.sh --skip-clone` |
|
||||
| **`update.sh`** | **一键更新** | `curl -fsSL ".../update.sh" \| bash` |
|
||||
| `nexus-1panel.sh` | 底层 install / upgrade | `bash deploy/nexus-1panel.sh upgrade` |
|
||||
| **`nx`** | **统一运维菜单** | `nx` |
|
||||
|
||||
档位:`--profile 1c4g` · `2c8g`(默认)· `4c16g`
|
||||
|
||||
---
|
||||
|
||||
## 重装服务器(1Panel + Docker + Nexus)
|
||||
|
||||
```bash
|
||||
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/install-1panel-docker.sh" | bash
|
||||
```
|
||||
|
||||
脚本会:未装 1Panel 时提示跑官方安装 → 检测 Docker Compose → 拉代码并启动 Nexus 容器栈。
|
||||
|
||||
4 核 16G:
|
||||
|
||||
```bash
|
||||
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/install-1panel-docker.sh" | bash -s -- --profile 4c16g
|
||||
curl -fsSL ".../install-1panel-docker.sh" | bash -s -- --profile 4c16g
|
||||
```
|
||||
|
||||
已装 1Panel,只装 Nexus:
|
||||
|
||||
```bash
|
||||
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/install-1panel-docker.sh" | bash -s -- --skip-1panel
|
||||
curl -fsSL ".../install-1panel-docker.sh" | bash -s -- --skip-1panel
|
||||
```
|
||||
|
||||
## 仅 Nexus Docker(1Panel 已就绪)
|
||||
## 仅 Nexus Docker
|
||||
|
||||
```bash
|
||||
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/quick-install.sh" | bash
|
||||
```
|
||||
|
||||
安装完成后浏览器打开 `https://api.synaglobal.vip/app/install.html` 完成向导。
|
||||
安装完成后:`https://api.synaglobal.vip/app/install.html`
|
||||
|
||||
## MySQL / Redis(自行安装,脚本不附带)
|
||||
|
||||
Docker 栈**仅含 Nexus 容器**。MySQL 与 Redis 请在宿主机或 1Panel 应用商店单独安装。
|
||||
|
||||
| 服务 | 宿主机监听 | 安装向导步骤 3 填写 |
|
||||
|------|-----------|---------------------|
|
||||
| MySQL | `127.0.0.1:3306` | 主机 `host.docker.internal`,端口 `3306` |
|
||||
| Redis | `127.0.0.1:6379` | 主机 `host.docker.internal`,端口 `6379` |
|
||||
|
||||
安装向导步骤 2:**必须先连通 Redis** 才能进入步骤 3。步骤 3 请填写**自建库**的用户名与密码(脚本不再生成 `MYSQL_PASSWORD`)。
|
||||
|
||||
卸载旧 Compose 内置容器:
|
||||
|
||||
```bash
|
||||
bash /opt/nexus/deploy/uninstall-mysql-compose.sh
|
||||
bash /opt/nexus/deploy/uninstall-mysql-compose.sh --purge-volume
|
||||
bash /opt/nexus/deploy/uninstall-redis-compose.sh
|
||||
bash /opt/nexus/deploy/uninstall-redis-compose.sh --purge-volume
|
||||
```
|
||||
|
||||
## 1Panel 反代(必须在面板 UI 操作)
|
||||
|
||||
**禁止** Agent/脚本直接 `mkdir` 或 `tee` 到 `/opt/1panel/apps/openresty/` — 会破坏 bind mount。
|
||||
|
||||
1. 1Panel → 应用商店 → 安装 **OpenResty**
|
||||
2. 网站 → 创建站点 → 反向代理 `http://127.0.0.1:8600`
|
||||
3. 自定义配置参考:`deploy/1panel/openresty-nexus.conf.example`
|
||||
---
|
||||
|
||||
## 一键更新(日常)
|
||||
|
||||
```bash
|
||||
cd /opt/nexus && bash deploy/update.sh
|
||||
# 或
|
||||
nx update
|
||||
# 或菜单
|
||||
nx # → [4] 一键更新
|
||||
```
|
||||
|
||||
或:`bash deploy/nexus-1panel.sh upgrade` · `nx god` → `b`
|
||||
|
||||
| 选项 | 说明 |
|
||||
|------|------|
|
||||
| `--check` | 仅查 Git 是否有新提交,不重建 |
|
||||
| `--no-cache` | 强制无缓存重建镜像(entrypoint 改了必用) |
|
||||
| `--check` | 仅查 Git,不重建 |
|
||||
| `--no-cache` | 无缓存重建镜像(entrypoint 变更后必用) |
|
||||
| `--no-backup` | 跳过 MySQL 备份 |
|
||||
| `--prune` | 清理悬空镜像 |
|
||||
|
||||
远程一条命令:
|
||||
远程:
|
||||
|
||||
```bash
|
||||
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/update.sh" | bash
|
||||
curl -fsSL ".../update.sh" | bash -s -- --no-cache
|
||||
```
|
||||
|
||||
## 已 clone 到 /opt/nexus
|
||||
---
|
||||
|
||||
## NX 统一菜单
|
||||
|
||||
```bash
|
||||
cd /opt/nexus && git pull
|
||||
bash deploy/install-nexus-fresh.sh --skip-clone
|
||||
nx # 安装 + 一键更新 + 重启 + 日志 + 备份(原「上帝菜单」已合并)
|
||||
nexus-update # 等同 update.sh
|
||||
nexus-fresh # 等同 install-nexus-fresh.sh
|
||||
nexus-install # 等同 quick-install.sh
|
||||
```
|
||||
|
||||
## NX 运维菜单
|
||||
|
||||
```bash
|
||||
nx # 主菜单
|
||||
nx god # 上帝菜单(重启 Python / 升级 / 日志)
|
||||
```
|
||||
|
||||
装好后会注册:`nexus-install` · `nx` · `nexus-fresh`
|
||||
|
||||
## 脚本说明
|
||||
|
||||
| 文件 | 用途 |
|
||||
| 菜单 | 功能 |
|
||||
|------|------|
|
||||
| `install-1panel-docker.sh` | **重装服务器**一键链(1Panel + Docker + Nexus) |
|
||||
| `quick-install.sh` | 仅 Nexus Docker(1Panel 已装好) |
|
||||
| `install-nexus-fresh.sh` | 全新空库安装(被上面两个脚本调用) |
|
||||
| `nexus-1panel.sh` | 迁机 / 升级底层 |
|
||||
| `nx` | 交互菜单 |
|
||||
| `[1]` | 安装向导(档位 / 迁机 / skip-clone) |
|
||||
| `[2]` | 全新安装 → `/app/install.html` |
|
||||
| `[4]` | **一键更新** |
|
||||
| `[5]` | 重启 Nexus |
|
||||
| `[6]` | 日志 |
|
||||
|
||||
## 资源档位
|
||||
---
|
||||
|
||||
`--profile 1c4g` · `2c8g`(默认)· `4c16g`
|
||||
## MySQL / Redis(自行安装)
|
||||
|
||||
## 密钥(每台新服务器唯一)
|
||||
Docker 栈**仅含 Nexus 容器**。
|
||||
|
||||
全新安装(`install-nexus-fresh.sh` / `--fresh`)会调用 `scripts/generate_nexus_secrets.py` 自动生成:
|
||||
| 服务 | 宿主机 | 安装向导步骤 3 |
|
||||
|------|--------|----------------|
|
||||
| MySQL | `127.0.0.1:3306` | `host.docker.internal:3306` |
|
||||
| Redis | `127.0.0.1:6379` | `host.docker.internal:6379` |
|
||||
|
||||
- `NEXUS_SECRET_KEY` / `NEXUS_API_KEY` / `NEXUS_ENCRYPTION_KEY`(与安装向导算法一致)
|
||||
步骤 2 须 Redis 连通;步骤 3 填自建库密码。
|
||||
|
||||
MySQL 密码由你在自建库时设定,安装向导步骤 3 填写。
|
||||
卸载旧 Compose 容器:
|
||||
|
||||
写入 `docker/.env.prod`,备份到 `/root/.nexus-install-secrets-*.env`(chmod 600)。
|
||||
```bash
|
||||
bash deploy/uninstall-mysql-compose.sh
|
||||
bash deploy/uninstall-redis-compose.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 1Panel 反代
|
||||
|
||||
**禁止**脚本改 `/opt/1panel/apps/openresty/`。
|
||||
|
||||
1. 应用商店 → **OpenResty**
|
||||
2. 网站 → 反代 `http://127.0.0.1:8600`
|
||||
3. 参考:`deploy/1panel/openresty-nexus.conf.example`
|
||||
|
||||
---
|
||||
|
||||
## 密钥
|
||||
|
||||
新机自动生成 `NEXUS_SECRET_KEY` / `NEXUS_API_KEY` / `NEXUS_ENCRYPTION_KEY` → `docker/.env.prod`,备份 `/root/.nexus-install-secrets-*.env`。
|
||||
|
||||
MySQL 密码在 1Panel 自建库时设定,向导步骤 3 填写。
|
||||
|
||||
| 场景 | 命令 |
|
||||
|------|------|
|
||||
| 新机(推荐) | `curl \| bash` 或 `install-nexus-fresh.sh` |
|
||||
| 迁机保留旧密钥 | `nexus-1panel.sh install --from-env /path/to/old/.env` |
|
||||
| 显式复用 secrets 文件 | `nexus-1panel.sh install --reuse-secrets`(**勿用于新机**) |
|
||||
| 新机 | `curl \| quick-install.sh` |
|
||||
| 迁机 | `nexus-1panel.sh install --from-env /path/to/.env` |
|
||||
| 更新 | `update.sh` 或 `nx update` |
|
||||
|
||||
**Git 凭据**:仓库已公开,`curl | bash`、`git clone`、`git pull` **均无需令牌**。开发机 `git push` 需在 Gitea 网页登录一次或本机配置 git 凭据(与安装脚本无关)。
|
||||
**Git**:公开仓库 `clone` / `pull` / `curl | bash` 无需令牌。
|
||||
|
||||
## 安装向导 `/app/install.html`
|
||||
---
|
||||
|
||||
生产镜像 `Dockerfile.prod` 已内置 `install.html` + `vendor`(Alpine/Tailwind)。升级后若 404:
|
||||
## 安装向导热修复
|
||||
|
||||
```bash
|
||||
cd /opt/nexus && git pull
|
||||
bash deploy/nexus-1panel.sh upgrade # 会 --build 重建镜像
|
||||
# 或仅同步到当前容器(旧镜像兜底):
|
||||
bash deploy/update.sh --no-cache
|
||||
# 或仅同步静态:
|
||||
bash deploy/sync-install-wizard-to-container.sh
|
||||
```
|
||||
|
||||
@@ -66,7 +66,7 @@ Nexus 6.0 全新安装(1Panel + Docker)
|
||||
-h, --help 显示帮助
|
||||
|
||||
安装后请用浏览器打开: https://域名/app/install.html
|
||||
root 下全局命令: nexus-fresh | nx | nx god
|
||||
root 下全局命令: nexus-fresh | nexus-update | nx
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ install_root_commands() {
|
||||
info " nexus-1panel-docker — 重装服务器(1Panel + Docker + Nexus)"
|
||||
info " nexus-install — 仅 Nexus Docker(curl 入口)"
|
||||
info " nexus-1panel — 底层 install/upgrade 脚本"
|
||||
info " nx — 主菜单 / nx god 上帝菜单"
|
||||
info " nx — 统一运维菜单(安装 + 一键更新 + 重启)"
|
||||
info " nexus-fresh — 全新安装脚本"
|
||||
info " nexus-update — 一键更新(pull + 重建镜像)"
|
||||
}
|
||||
@@ -292,9 +292,9 @@ phase_post() {
|
||||
echo -e "${GREEN}║${NC} 目标: http://127.0.0.1:${port} ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}║${NC} 示例: ${NEXUS_ROOT}/deploy/1panel/openresty-nexus.conf.example ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}║${NC} ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}║${NC} ${YELLOW}③ 日常运维(上帝菜单)${NC} ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}║${NC} nx god # 重启 Python / 升级 / 日志 / 备份 ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}║${NC} nx # 主菜单 ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}║${NC} ${YELLOW}③ 日常运维${NC} ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}║${NC} nx # 统一菜单(一键更新 / 重启 / 日志) ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}║${NC} nexus-update # 等同 deploy/update.sh ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ verify_health() {
|
||||
info "浏览器: https://${NEXUS_DOMAIN}/app/"
|
||||
fi
|
||||
echo ""
|
||||
info "运维菜单: nx 或 bash $root/deploy/nx god"
|
||||
info "运维菜单: nx 或 bash $root/deploy/update.sh"
|
||||
info " (安装 nx 命令: ln -sf $root/deploy/nx /usr/local/bin/nx)"
|
||||
check_ports_post "$root"
|
||||
return 0
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Nexus NX — 一键安装 + 上帝菜单(1Panel Docker 生产栈)
|
||||
# Nexus NX — 统一运维菜单(安装 + 升级 + 日常运维)
|
||||
#
|
||||
# bash deploy/nx 交互菜单
|
||||
# bash deploy/nx install 同菜单「安装」
|
||||
# bash deploy/nx god 上帝菜单(运维)
|
||||
# nx 安装后链到 /usr/local/bin/nx
|
||||
# nx 交互菜单
|
||||
# nx update 一键更新(等同 deploy/update.sh)
|
||||
# nx update --no-cache 无缓存重建镜像
|
||||
# nx install-fresh 全新安装
|
||||
# nx health 健康检查
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
# 经 /usr/local/bin/nx 符号链接调用时,须 readlink 才能找到 deploy/ 目录
|
||||
NX_SELF="$(readlink -f "${BASH_SOURCE[0]}")"
|
||||
NX_DIR="$(cd "$(dirname "$NX_SELF")" && pwd)"
|
||||
# shellcheck source=./nexus-1panel.sh
|
||||
@@ -54,7 +54,8 @@ install_nx_cli() {
|
||||
return 0
|
||||
fi
|
||||
ln -sf "${NX_DIR}/nx" /usr/local/bin/nx 2>/dev/null || true
|
||||
chmod +x "${NX_DIR}/nx" 2>/dev/null || true
|
||||
ln -sf "${NX_DIR}/update.sh" /usr/local/bin/nexus-update 2>/dev/null || true
|
||||
chmod +x "${NX_DIR}/nx" "${NX_DIR}/update.sh" 2>/dev/null || true
|
||||
}
|
||||
|
||||
menu_header() {
|
||||
@@ -62,7 +63,7 @@ menu_header() {
|
||||
clear_screen
|
||||
echo ""
|
||||
echo "╔══════════════════════════════════════════════════════════╗"
|
||||
echo "║ Nexus NX — ${title}"
|
||||
printf "║ Nexus NX — %-44s║\n" "$title"
|
||||
echo "╠══════════════════════════════════════════════════════════╣"
|
||||
echo "║ 域名: ${NEXUS_DOMAIN} 目录: ${NEXUS_ROOT}"
|
||||
if is_stack_installed; then
|
||||
@@ -99,7 +100,7 @@ run_install() {
|
||||
|
||||
menu_install() {
|
||||
while true; do
|
||||
menu_header "安装向导"
|
||||
menu_header "安装"
|
||||
cat <<'EOF'
|
||||
[1] 一键安装(默认 2核8G / 2c8g)
|
||||
[2] 安装 — 4核16G(4c16g)
|
||||
@@ -108,9 +109,7 @@ menu_install() {
|
||||
[5] 已 clone 到 /opt/nexus,仅 pull + 启动(--skip-clone)
|
||||
[6] 全新安装(install-nexus-fresh.sh → /app/install.html)
|
||||
[7] 检查端口 / 防火墙(不安装)
|
||||
[8] 写入 Gitea 令牌(init-token)
|
||||
[9] 返回主菜单
|
||||
[0] 退出
|
||||
[0] 返回
|
||||
|
||||
EOF
|
||||
read -r -p "请选择: " choice
|
||||
@@ -142,19 +141,13 @@ EOF
|
||||
fi
|
||||
pause_enter
|
||||
;;
|
||||
8)
|
||||
read -r -p "Gitea Access Token: " tok
|
||||
cmd_init_token "$tok"
|
||||
pause_enter
|
||||
;;
|
||||
9) return 0 ;;
|
||||
0) exit 0 ;;
|
||||
0) return 0 ;;
|
||||
*) warn "无效选项" ; sleep 1 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
god_restart_nexus() {
|
||||
ops_restart_nexus() {
|
||||
step "重启 Nexus(Python)..."
|
||||
if [[ "$NX_RUNTIME" == "docker" ]]; then
|
||||
compose_cmd "$NEXUS_ROOT" restart nexus
|
||||
@@ -164,19 +157,18 @@ god_restart_nexus() {
|
||||
error "未检测到运行中的 Nexus"
|
||||
return 1
|
||||
fi
|
||||
info "已发送重启"
|
||||
sleep 3
|
||||
curl -sf "http://127.0.0.1:$(nexus_publish_port "$NEXUS_ROOT")/health" && info "/health → ok" || warn "健康检查未通过,请查看日志"
|
||||
verify_health "$NEXUS_ROOT" "重启" || true
|
||||
}
|
||||
|
||||
god_restart_stack() {
|
||||
step "重启全部 Compose 服务..."
|
||||
ops_restart_stack() {
|
||||
step "重启 Compose 栈..."
|
||||
compose_cmd "$NEXUS_ROOT" restart
|
||||
sleep 5
|
||||
verify_health "$NEXUS_ROOT" "重启" || true
|
||||
}
|
||||
|
||||
god_stop_stack() {
|
||||
ops_stop_stack() {
|
||||
warn "将停止 Nexus 容器(MySQL/Redis 为外置服务,不受影响)"
|
||||
read -r -p "确认? [y/N]: " c
|
||||
[[ "$c" == "y" || "$c" == "Y" ]] || return 0
|
||||
@@ -184,12 +176,12 @@ god_stop_stack() {
|
||||
info "已停止"
|
||||
}
|
||||
|
||||
god_start_stack() {
|
||||
ops_start_stack() {
|
||||
compose_cmd "$NEXUS_ROOT" up -d --remove-orphans
|
||||
verify_health "$NEXUS_ROOT" "启动" || true
|
||||
}
|
||||
|
||||
god_logs() {
|
||||
ops_logs() {
|
||||
local svc="${1:-nexus}"
|
||||
echo ""
|
||||
read -r -p "跟踪日志行数 [80]: " n
|
||||
@@ -197,142 +189,159 @@ god_logs() {
|
||||
compose_cmd "$NEXUS_ROOT" logs --tail="$n" -f "$svc"
|
||||
}
|
||||
|
||||
god_status() {
|
||||
ops_status() {
|
||||
if [[ "$NX_RUNTIME" == "docker" ]]; then
|
||||
compose_cmd "$NEXUS_ROOT" ps
|
||||
elif [[ "$NX_RUNTIME" == "supervisor" ]]; then
|
||||
supervisorctl status nexus
|
||||
fi
|
||||
echo ""
|
||||
local port h
|
||||
local port h code
|
||||
port="$(nexus_publish_port "$NEXUS_ROOT")"
|
||||
h=$(curl -sf "http://127.0.0.1:${port}/health" 2>/dev/null || echo "fail")
|
||||
info "/health → ${h}"
|
||||
curl -s -o /dev/null -w " /app/ HTTP %{http_code}\n" "http://127.0.0.1:${port}/app/" 2>/dev/null || true
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${port}/app/install.html" 2>/dev/null || echo "000")
|
||||
info "/app/install.html → HTTP ${code}"
|
||||
}
|
||||
|
||||
god_backup_now() {
|
||||
ops_backup_now() {
|
||||
NO_BACKUP=false
|
||||
backup_mysql "$NEXUS_ROOT"
|
||||
}
|
||||
|
||||
god_upgrade_interactive() {
|
||||
ops_update() {
|
||||
local args=()
|
||||
PRUNE_IMAGES=false
|
||||
NO_BACKUP=false
|
||||
NO_CACHE=false
|
||||
read -r -p "跳过 MySQL 备份? [y/N]: " nb
|
||||
[[ "$nb" == "y" || "$nb" == "Y" ]] && NO_BACKUP=true
|
||||
[[ "$nb" == "y" || "$nb" == "Y" ]] && args+=(--no-backup)
|
||||
read -r -p "无缓存重建镜像? [y/N]: " nc
|
||||
[[ "$nc" == "y" || "$nc" == "Y" ]] && args+=(--no-cache)
|
||||
read -r -p "升级后清理悬空镜像? [y/N]: " pr
|
||||
[[ "$pr" == "y" || "$pr" == "Y" ]] && PRUNE_IMAGES=true
|
||||
cmd_upgrade
|
||||
[[ "$pr" == "y" || "$pr" == "Y" ]] && args+=(--prune)
|
||||
bash "${NX_DIR}/update.sh" "${args[@]}"
|
||||
pause_enter
|
||||
}
|
||||
|
||||
menu_god() {
|
||||
require_installed() {
|
||||
if ! is_stack_installed; then
|
||||
warn "尚未安装,请先使用安装向导"
|
||||
warn "尚未安装,请先使用菜单 [1] 安装"
|
||||
pause_enter
|
||||
return 0
|
||||
return 1
|
||||
fi
|
||||
require_root
|
||||
load_secrets
|
||||
load_saved_profile "$NEXUS_ROOT"
|
||||
detect_runtime
|
||||
|
||||
while true; do
|
||||
menu_header "上帝菜单 · 运维"
|
||||
cat <<EOF
|
||||
── 服务 ──
|
||||
[1] 重启 Nexus(Python 应用)
|
||||
[2] 重启 Compose 栈(仅 Nexus 容器)
|
||||
[3] 启动 Compose 栈
|
||||
[4] 停止 Compose 栈
|
||||
[5] 重建 Nexus 镜像并启动(up -d --build nexus)
|
||||
|
||||
── 观测 ──
|
||||
[6] 状态 + 健康检查
|
||||
[7] 查看 Nexus 日志(跟踪)
|
||||
[8] 查看 Nexus 日志(备用入口)
|
||||
[9] 端口 / 防火墙检查
|
||||
|
||||
── 发布 ──
|
||||
[a] 检查 Git 更新
|
||||
[b] 一键升级(备份 + pull + 重建)
|
||||
[c] 立即备份 MySQL
|
||||
|
||||
── 其他 ──
|
||||
[d] 进入 Nexus 容器 shell
|
||||
[e] 打开 1Panel 反代说明
|
||||
[0] 返回主菜单
|
||||
|
||||
EOF
|
||||
read -r -p "请选择: " choice
|
||||
case "$choice" in
|
||||
1) god_restart_nexus; pause_enter ;;
|
||||
2) god_restart_stack; pause_enter ;;
|
||||
3) god_start_stack; pause_enter ;;
|
||||
4) god_stop_stack; pause_enter ;;
|
||||
5)
|
||||
compose_cmd "$NEXUS_ROOT" up -d --build --remove-orphans nexus
|
||||
verify_health "$NEXUS_ROOT" "重建" || true
|
||||
pause_enter
|
||||
;;
|
||||
6) god_status; pause_enter ;;
|
||||
7) god_logs nexus ;;
|
||||
8) god_logs nexus ;;
|
||||
9)
|
||||
check_ports_preflight "$NEXUS_ROOT"
|
||||
check_ports_post "$NEXUS_ROOT"
|
||||
pause_enter
|
||||
;;
|
||||
a|A)
|
||||
cmd_check
|
||||
pause_enter
|
||||
;;
|
||||
b|B) god_upgrade_interactive ;;
|
||||
c|C) god_backup_now; pause_enter ;;
|
||||
d)
|
||||
compose_cmd "$NEXUS_ROOT" exec nexus bash || compose_cmd "$NEXUS_ROOT" exec nexus sh
|
||||
;;
|
||||
e)
|
||||
info "1Panel → 网站 → 创建站点 ${NEXUS_DOMAIN}"
|
||||
info "反向代理: http://127.0.0.1:$(nexus_publish_port "$NEXUS_ROOT")"
|
||||
info "示例配置: ${NEXUS_ROOT}/deploy/1panel/openresty-nexus.conf.example"
|
||||
pause_enter
|
||||
;;
|
||||
0) return 0 ;;
|
||||
*) warn "无效选项"; sleep 1 ;;
|
||||
esac
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
menu_main() {
|
||||
load_secrets
|
||||
while true; do
|
||||
menu_header "主菜单"
|
||||
if is_stack_installed; then
|
||||
echo " 提示: 安装完成后请用 [2] 上帝菜单 重启 Python / 升级 / 看日志"
|
||||
echo ""
|
||||
fi
|
||||
menu_header "运维菜单"
|
||||
cat <<'EOF'
|
||||
[1] 安装向导(新机 / 迁机)
|
||||
[2] 上帝菜单(重启 Python · 升级 · 日志 · 备份)
|
||||
[3] 快速健康检查
|
||||
── 安装 ──
|
||||
[1] 安装向导(新机 / 迁机 / 档位)
|
||||
[2] 全新安装 → /app/install.html
|
||||
|
||||
── 日常运维(需已安装)──
|
||||
[3] 状态 + 健康检查
|
||||
[4] 一键更新(pull + 重建镜像)★
|
||||
[5] 重启 Nexus(Python)
|
||||
[6] 查看 Nexus 日志
|
||||
[7] 启动 / 停止 Compose 栈
|
||||
[8] 重建镜像并启动(--build nexus)
|
||||
[9] 备份 MySQL
|
||||
|
||||
── 其它 ──
|
||||
[a] 检查 Git 是否有更新
|
||||
[b] 端口 / 防火墙检查
|
||||
[c] 进入 Nexus 容器 shell
|
||||
[d] 1Panel 反代说明
|
||||
[0] 退出
|
||||
|
||||
EOF
|
||||
read -r -p "请选择: " choice
|
||||
case "$choice" in
|
||||
1) menu_install ;;
|
||||
2) menu_god ;;
|
||||
2)
|
||||
require_root
|
||||
exec bash "${NX_DIR}/install-nexus-fresh.sh" --profile "${NEXUS_PROFILE:-2c8g}"
|
||||
;;
|
||||
3)
|
||||
require_root
|
||||
if is_stack_installed; then
|
||||
god_status
|
||||
load_saved_profile "$NEXUS_ROOT"
|
||||
detect_runtime
|
||||
ops_status
|
||||
else
|
||||
check_ports_preflight "$NEXUS_ROOT"
|
||||
fi
|
||||
pause_enter
|
||||
;;
|
||||
4)
|
||||
require_installed || continue
|
||||
ops_update
|
||||
;;
|
||||
5)
|
||||
require_installed || continue
|
||||
ops_restart_nexus
|
||||
pause_enter
|
||||
;;
|
||||
6)
|
||||
require_installed || continue
|
||||
ops_logs nexus
|
||||
;;
|
||||
7)
|
||||
require_installed || continue
|
||||
echo " [1] 启动 [2] 停止 [3] 重启栈"
|
||||
read -r -p "选: " s
|
||||
case "$s" in
|
||||
1) ops_start_stack ;;
|
||||
2) ops_stop_stack ;;
|
||||
3) ops_restart_stack ;;
|
||||
*) warn "无效" ;;
|
||||
esac
|
||||
pause_enter
|
||||
;;
|
||||
8)
|
||||
require_installed || continue
|
||||
read -r -p "无缓存重建? [y/N]: " nc
|
||||
if [[ "$nc" == "y" || "$nc" == "Y" ]]; then
|
||||
compose_cmd "$NEXUS_ROOT" build --no-cache nexus
|
||||
fi
|
||||
compose_cmd "$NEXUS_ROOT" up -d --build --remove-orphans nexus
|
||||
verify_health "$NEXUS_ROOT" "重建" || true
|
||||
pause_enter
|
||||
;;
|
||||
9)
|
||||
require_installed || continue
|
||||
ops_backup_now
|
||||
pause_enter
|
||||
;;
|
||||
a|A)
|
||||
require_root
|
||||
cmd_check
|
||||
pause_enter
|
||||
;;
|
||||
b|B)
|
||||
require_root
|
||||
check_ports_preflight "$NEXUS_ROOT"
|
||||
is_stack_installed && check_ports_post "$NEXUS_ROOT" || true
|
||||
pause_enter
|
||||
;;
|
||||
c|C)
|
||||
require_installed || continue
|
||||
compose_cmd "$NEXUS_ROOT" exec nexus bash || compose_cmd "$NEXUS_ROOT" exec nexus sh
|
||||
;;
|
||||
d|D)
|
||||
info "1Panel → 网站 → 创建站点 ${NEXUS_DOMAIN}"
|
||||
info "反向代理: http://127.0.0.1:$(nexus_publish_port "$NEXUS_ROOT")"
|
||||
info "示例: ${NEXUS_ROOT}/deploy/1panel/openresty-nexus.conf.example"
|
||||
pause_enter
|
||||
;;
|
||||
0) exit 0 ;;
|
||||
*) warn "无效选项"; sleep 1 ;;
|
||||
esac
|
||||
@@ -343,9 +352,18 @@ nx_main() {
|
||||
local sub="${1:-}"
|
||||
load_secrets
|
||||
case "$sub" in
|
||||
""|menu) menu_main ;;
|
||||
""|menu|god|ops|admin)
|
||||
# god/ops 已合并进主菜单,保留别名兼容
|
||||
[[ "$sub" == "god" || "$sub" == "ops" || "$sub" == "admin" ]] && \
|
||||
warn "「上帝菜单」已合并进 nx 主菜单,直接选对应项即可"
|
||||
menu_main
|
||||
;;
|
||||
install) menu_install ;;
|
||||
god|ops|admin) menu_god ;;
|
||||
update|upgrade)
|
||||
require_root
|
||||
shift || true
|
||||
exec bash "${NX_DIR}/update.sh" "$@"
|
||||
;;
|
||||
install-fresh|fresh)
|
||||
require_root
|
||||
exec bash "${NX_DIR}/install-nexus-fresh.sh" "$@"
|
||||
@@ -360,24 +378,26 @@ nx_main() {
|
||||
;;
|
||||
health)
|
||||
require_root
|
||||
is_stack_installed && god_status || check_ports_preflight "$NEXUS_ROOT"
|
||||
is_stack_installed && ops_status || check_ports_preflight "$NEXUS_ROOT"
|
||||
;;
|
||||
-h|--help)
|
||||
cat <<EOF
|
||||
用法: nx [子命令]
|
||||
|
||||
(无) 交互主菜单
|
||||
install 安装向导
|
||||
install-fresh 全新安装(1Panel 风格,/app/install.html)
|
||||
install-auto 非交互安装已有密钥(2c8g)
|
||||
god 上帝菜单(重启/升级/日志)
|
||||
health 健康检查
|
||||
(无) 统一运维菜单(安装 + 升级 + 重启 + 日志)
|
||||
update 一键更新(等同 bash deploy/update.sh)
|
||||
install-fresh 全新安装(/app/install.html)
|
||||
install-auto 非交互安装(默认 2c8g)
|
||||
health 健康检查
|
||||
|
||||
底层仍可使用: bash deploy/nexus-1panel.sh install|upgrade|check|ports
|
||||
god / ops 已合并进主菜单(兼容别名)
|
||||
|
||||
curl 入口:
|
||||
安装 curl -fsSL .../deploy/quick-install.sh | bash
|
||||
更新 curl -fsSL .../deploy/update.sh | bash
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
# 兼容 nexus-1panel.sh 子命令
|
||||
main "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# 2026-06-05 — NX 菜单合并 + README 脚本索引
|
||||
|
||||
## 摘要
|
||||
|
||||
- `deploy/nx`:原「主菜单」与「上帝菜单」合并为统一 `nx` 运维菜单;`[4] 一键更新` 调用 `deploy/update.sh`
|
||||
- `nx god` / `nx ops` 保留为兼容别名,进入同一菜单
|
||||
- 新增子命令:`nx update`(等同 `update.sh`)
|
||||
- 根目录 `README.md`、`deploy/README-1panel.md` 补充一键安装 / 一键更新 curl 表与脚本索引
|
||||
|
||||
## 涉及文件
|
||||
|
||||
- `deploy/nx`
|
||||
- `README.md`
|
||||
- `deploy/README-1panel.md`
|
||||
- `deploy/install-nexus-fresh.sh`
|
||||
- `deploy/nexus-1panel.sh`
|
||||
|
||||
## 验证
|
||||
|
||||
- `bash -n deploy/nx`
|
||||
- 服务器 `nx` → `[4]` 触发 `update.sh`
|
||||
- Gitea 项目页 README 展示完整脚本表
|
||||
Reference in New Issue
Block a user