Add install script for clone-first one-click deployment.
Prompt for repo URL and install directory, auto git clone, then run project setup. Keep deploy.py for in-repo updates only. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,23 +8,47 @@ Flask + SQLite 的局域网导航聚合:左侧分组与服务列表,右侧 i
|
||||
|
||||
**默认端口:** `5070`(可通过环境变量 `NAV_PORT` 修改)
|
||||
|
||||
## 一键部署
|
||||
## 一键部署(无需预先克隆)
|
||||
|
||||
在**空目录或新服务器**上,只需运行安装脚本,按提示输入 Git 仓库地址即可自动克隆并完成部署:
|
||||
|
||||
```bash
|
||||
# Linux / macOS
|
||||
bash scripts/deploy.sh
|
||||
# Linux / macOS(推荐:一条命令,无需先 git clone)
|
||||
curl -fsSL https://git.bz121.com/dekun/LocalNav/raw/main/scripts/install.sh | bash
|
||||
|
||||
# 或本地已有 install 脚本时
|
||||
bash scripts/install.sh
|
||||
python scripts/install.py
|
||||
|
||||
# Windows PowerShell
|
||||
.\scripts\deploy.ps1
|
||||
|
||||
# 或直接
|
||||
python scripts/deploy.py
|
||||
.\scripts\install.ps1
|
||||
```
|
||||
|
||||
脚本会自动:检测 Python 环境、创建虚拟环境、安装依赖、从 `.env.example` 生成 `.env`、写入 `NAV_SECRET_KEY` 与默认账号。
|
||||
运行后会提示:
|
||||
|
||||
1. **Git 仓库地址**(默认 `https://git.bz121.com/dekun/LocalNav.git`)
|
||||
2. **安装目录**(Linux 默认 `/opt/LocalNav`,Windows 默认 `./LocalNav`)
|
||||
|
||||
随后自动:`git clone` → 创建虚拟环境 → 安装依赖 → 生成 `.env` 与 `NAV_SECRET_KEY`。
|
||||
|
||||
非交互安装(使用默认值):
|
||||
|
||||
```bash
|
||||
python scripts/install.py -y
|
||||
# 或指定参数
|
||||
python scripts/install.py --repo https://git.bz121.com/dekun/LocalNav.git --dir /opt/LocalNav
|
||||
```
|
||||
|
||||
**默认登录:** `admin` / `admin123`(生产环境请尽快在「系统设置」中修改密码)
|
||||
|
||||
**已安装后的更新**(在项目目录内):
|
||||
|
||||
```bash
|
||||
cd /opt/LocalNav
|
||||
git pull
|
||||
python scripts/deploy.py # 或 bash scripts/deploy.sh
|
||||
```
|
||||
|
||||
配置:将 `.env.example` 复制为 `.env` 并填写变量(与 `app.py` 同目录);详见说明文档「环境变量与 `.env`」一节。
|
||||
|
||||
进程守护(可选):`pm2 start ecosystem.config.cjs`(需已安装 PM2),详见 [部署与使用说明.md](./部署与使用说明.md) 中「9.7 使用 PM2」。
|
||||
|
||||
Reference in New Issue
Block a user