docs: Update DEPLOYMENT.md with build scripts and API URL configuration

- Add one-click backend setup script documentation
- Document Windows build scripts with --api-url parameter
- Add runtime configuration options for config.json
- Include GitHub Actions CI/CD workflow instructions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-17 07:23:17 +08:00
parent 7075078d9e
commit d3e3205692

View File

@@ -27,6 +27,31 @@ Use the startup script to run all services locally:
## Backend Deployment
### Quick Start (One-Click Setup)
使用一鍵設置腳本自動安裝依賴並啟動服務:
**Linux/macOS/WSL:**
```bash
./scripts/setup-backend.sh start
```
**Windows:**
```batch
.\scripts\setup-backend.bat start
```
**腳本命令:**
| 命令 | 說明 |
|------|------|
| `setup` | 僅設置環境(安裝依賴) |
| `start` | 設置並啟動後端服務(預設) |
| `stop` | 停止後端服務 |
| `--port PORT` | 指定服務端口(預設: 8000 |
| `--no-sidecar` | 不安裝 Sidecar 依賴 |
### Manual Setup
### 1. Setup Environment
```bash
@@ -104,47 +129,100 @@ sudo ./scripts/deploy-backend.sh install --port 8000
## Electron Client Deployment
### 1. Setup
### 1. Prerequisites
- **Windows**: Node.js 18+, Python 3.10+ (for building Sidecar)
- **Disk Space**: 5GB+ recommended (Whisper model + build artifacts)
### 2. Quick Build (Windows)
使用一鍵打包腳本在 Windows 上建置免安裝執行檔:
```batch
# 完整建置(使用預設 localhost
.\scripts\build-client.bat build --clean
# 指定後端 API URL
.\scripts\build-client.bat build --api-url "http://192.168.1.100:8000/api" --clean
# 使用公司伺服器
.\scripts\build-client.bat build --api-url "https://api.company.com/api"
# 僅打包 Electron已打包過 Sidecar
.\scripts\build-client.bat build --skip-sidecar --api-url "http://your-server:8000/api"
```
或使用 PowerShell
```powershell
.\scripts\build-all.ps1 -ApiUrl "http://192.168.1.100:8000/api" -Clean
```
**打包腳本參數:**
| 參數 | 說明 |
|------|------|
| `--api-url URL` | 後端 API URL會寫入 config.json |
| `--skip-sidecar` | 跳過 Sidecar 打包(已打包過時使用) |
| `--clean` | 建置前清理所有暫存檔案 |
### 3. Runtime Configuration
打包後的 exe 會讀取 `config.json` 中的設定:
```json
{
"apiBaseUrl": "http://localhost:8000/api",
"uploadTimeout": 600000,
"appTitle": "Meeting Assistant",
"whisper": {
"model": "medium",
"device": "cpu",
"compute": "int8"
}
}
```
**方式一**:打包時指定(推薦)
```batch
.\scripts\build-client.bat build --api-url "http://your-server:8000/api"
```
**方式二**:打包前手動編輯 `client/config.json`
**方式三**:打包後修改(適合測試)
- 執行檔旁邊的 `resources/config.json` 可在打包後修改
### 4. Manual Setup (Development)
```bash
cd client
# Install dependencies
npm install
```
### 2. Configure Environment
```bash
# Copy example and edit
cp .env.example .env
```
**Environment Variables:**
| Variable | Description | Default |
|----------|-------------|---------|
| `VITE_API_BASE_URL` | Backend API URL | http://localhost:8000/api |
| `VITE_UPLOAD_TIMEOUT` | Upload timeout (ms) | 600000 |
| `WHISPER_MODEL` | Whisper model size | medium |
| `WHISPER_DEVICE` | Execution device | cpu |
| `WHISPER_COMPUTE` | Compute precision | int8 |
### 3. Development
```bash
# Start in development mode
npm start
```
### 4. Build for Distribution
### 5. Build Output
```bash
# Update VITE_API_BASE_URL to production server first
# Then build portable executable
npm run build
```
建置完成後,輸出檔案位於:
- `client/dist/` - Electron 打包輸出
- `build/` - 最終整合輸出(含 exe
The executable will be in `client/dist/`.
**輸出檔案:**
- `Meeting Assistant-1.0.0-portable.exe` - 免安裝執行檔
### 6. GitHub Actions (CI/CD)
也可以使用 GitHub Actions 自動建置:
1. 前往 GitHub Repository → Actions
2. 選擇 "Build Windows Client"
3. 點擊 "Run workflow"
4. 輸入 `api_url` 參數(例如 `http://192.168.1.100:8000/api`
5. 等待建置完成後下載 artifact
## Transcription Sidecar