da0424a268
Step 2 now detects whether host MySQL is listening; init-db fails fast with 1Panel setup guidance on error 2003. Co-authored-by: Cursor <cursoragent@cursor.com>
4.5 KiB
4.5 KiB
1Panel + Docker 一键部署
脚本速查(公共仓库 · 无需令牌)
| 脚本 | 用途 | 一条命令 |
|---|---|---|
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)
curl -fsSL "http://66.154.115.8:3000/admin/Nexus/raw/branch/main/deploy/install-1panel-docker.sh" | bash
4 核 16G:
curl -fsSL ".../install-1panel-docker.sh" | bash -s -- --profile 4c16g
已装 1Panel,只装 Nexus:
curl -fsSL ".../install-1panel-docker.sh" | bash -s -- --skip-1panel
仅 Nexus Docker
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
一键更新(日常)
cd /opt/nexus && bash deploy/update.sh
# 或
nx update
# 或菜单
nx # → [4] 一键更新
| 选项 | 说明 |
|---|---|
--check |
仅查 Git,不重建 |
--no-cache |
无缓存重建镜像(entrypoint 变更后必用) |
--no-backup |
跳过 MySQL 备份 |
--prune |
清理悬空镜像 |
远程:
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
NX 全局命令
安装 / 升级 / 首次运行 nx 会自动注册到 /usr/local/bin:
# 手动注册(任意目录可用 nx)
NEXUS_ROOT=/opt/nexus bash /opt/nexus/deploy/install-nx-cli.sh
nx # 统一运维菜单
nexus-update # 等同 update.sh
nexus-fresh # 等同 install-nexus-fresh.sh
nexus-install # 等同 quick-install.sh
| 菜单 | 功能 |
|---|---|
[1] |
安装向导(档位 / 迁机 / skip-clone) |
[2] |
全新安装 → /app/install.html |
[4] |
一键更新 |
[5] |
重启 Nexus |
[6] |
日志 |
MySQL / Redis(自行安装)
Docker 栈仅含 Nexus 容器。Nexus 容器通过 host.docker.internal 访问宿主机上的 MySQL/Redis。
| 服务 | 宿主机 | 安装向导步骤 3 |
|---|---|---|
| MySQL | 127.0.0.1:3306 |
host.docker.internal:3306 |
| Redis | 127.0.0.1:6379 |
host.docker.internal:6379 |
1Panel 安装 MySQL(步骤 3 之前必做)
- 应用商店 → 安装 MySQL(保持默认,会暴露宿主机
3306) - 数据库 → 创建库
nexus、用户nexus(仅授权nexus库),记下密码 - 安装向导步骤 3:主机保持预填的
host.docker.internal,库名/用户名nexus,填入上一步密码
若报 Can't connect to MySQL server on 'host.docker.internal',通常是 MySQL 尚未安装或未启动。在服务器验证:
docker exec nexus-prod-nexus-1 sh -c 'timeout 2 bash -c "</dev/tcp/host.docker.internal/3306"' && echo MySQL_OK
步骤 2 会 TCP 检测 MySQL/Redis 是否已安装;步骤 4 再验证账号密码与 Redis 连通。
卸载旧 Compose 容器:
bash deploy/uninstall-mysql-compose.sh
bash deploy/uninstall-redis-compose.sh
1Panel 反代
禁止脚本改 /opt/1panel/apps/openresty/。
- 应用商店 → OpenResty
- 网站 → 反代
http://127.0.0.1:8600 - 参考:
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 | quick-install.sh |
| 迁机 | nexus-1panel.sh install --from-env /path/to/.env |
| 更新 | update.sh 或 nx update |
Git:公开仓库 clone / pull / curl | bash 无需令牌。
安装向导热修复
cd /opt/nexus && git pull
bash deploy/update.sh --no-cache
# 或仅同步静态:
bash deploy/sync-install-wizard-to-container.sh