e42dc77127
Step 2 blocks until Redis connects; uninstall-redis-compose.sh removes legacy nexus-prod-redis container without touching host/1Panel Redis. Co-authored-by: Cursor <cursoragent@cursor.com>
109 lines
3.7 KiB
Markdown
109 lines
3.7 KiB
Markdown
# 1Panel + Docker 一键部署
|
||
|
||
## 重装服务器(推荐: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
|
||
```
|
||
|
||
已装 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
|
||
```
|
||
|
||
## 仅 Nexus Docker(1Panel 已就绪)
|
||
|
||
```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` 完成向导。
|
||
|
||
## Redis(自行安装,脚本不附带)
|
||
|
||
Docker 栈仅含 **MySQL + Nexus**。Redis 请在宿主机或 1Panel 应用商店单独安装,监听 `127.0.0.1:6379`(或改 `docker/.env.prod` 的 `NEXUS_REDIS_URL`)。
|
||
|
||
安装向导步骤 2:**必须先连通 Redis** 才能进入步骤 3。步骤 3 Redis 主机填 **`host.docker.internal`**,端口 `6379`。
|
||
|
||
卸载旧 Compose Redis 容器:
|
||
|
||
```bash
|
||
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`
|
||
|
||
## 已 clone 到 /opt/nexus
|
||
|
||
```bash
|
||
cd /opt/nexus && git pull
|
||
bash deploy/install-nexus-fresh.sh --skip-clone
|
||
```
|
||
|
||
## 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` | 交互菜单 |
|
||
|
||
## 资源档位
|
||
|
||
`--profile 1c4g` · `2c8g`(默认)· `4c16g`
|
||
|
||
## 密钥(每台新服务器唯一)
|
||
|
||
全新安装(`install-nexus-fresh.sh` / `--fresh`)会调用 `scripts/generate_nexus_secrets.py` 自动生成:
|
||
|
||
- `MYSQL_ROOT_PASSWORD` / `MYSQL_PASSWORD`
|
||
- `NEXUS_SECRET_KEY` / `NEXUS_API_KEY` / `NEXUS_ENCRYPTION_KEY`(与安装向导算法一致)
|
||
|
||
写入 `docker/.env.prod`,备份到 `/root/.nexus-install-secrets-*.env`(chmod 600)。
|
||
|
||
| 场景 | 命令 |
|
||
|------|------|
|
||
| 新机(推荐) | `curl \| bash` 或 `install-nexus-fresh.sh` |
|
||
| 迁机保留旧密钥 | `nexus-1panel.sh install --from-env /path/to/old/.env` |
|
||
| 显式复用 secrets 文件 | `nexus-1panel.sh install --reuse-secrets`(**勿用于新机**) |
|
||
|
||
**Gitea 令牌**:公共仓库 `curl | bash` / `git clone` **不需要**配置。仅私人仓库时可选 `/root/.nexus-deploy.env` 或 `nexus-1panel.sh init-token`。
|
||
|
||
## 安装向导 `/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/sync-install-wizard-to-container.sh
|
||
```
|