# Telfax 生產環境部署指南 ## 系統需求 - macOS 10.14 或更新版本 - USB 數據機(已測試:V90, USR5637) - 已安裝 Rust 工具鏈(用於編譯) - 管理員權限(用於安裝服務) --- ## 快速部署(V90 Class 2) ### 1. 編譯發布版本 ```bash cd /path/to/telfax cargo build --release ``` ### 2. 安裝服務 ```bash sudo ./deployment/install-macos.sh ``` ### 3. 配置服務 編輯配置文件: ```bash nano /usr/local/etc/telfax/config.toml ``` **重要配置項:** ```toml # 認證令牌(必須修改!) [[auth.tokens]] token = "your-secure-token-here" # 修改為安全令牌 permissions = "admin" # V90 數據機(Class 2 生產環境) [[modems]] device = "/dev/cu.usbmodem123456781" # 確認設備路徑 name = "V90-Primary" class = 2 # 使用 Class 2(穩定) priority = 1 enabled = true phone_number = "25289852" # 設定電話號碼 # 傳真設定 [fax] station_id = "+886-2-25289852" # 設定傳真號碼 header = "Your Company Name" # 設定公司名稱 default_class = 2 # 預設使用 Class 2 ``` ### 4. 啟動服務 ```bash # 載入服務 sudo launchctl load -w /Library/LaunchDaemons/com.telfax.server.plist # 檢查狀態 sudo launchctl list | grep telfax # 查看日誌 tail -f /usr/local/var/log/telfax/telfax.log ``` ### 5. 測試 API ```bash # 健康檢查 curl http://localhost:3000/health # 查看狀態(需要認證) curl -H "Authorization: Bearer your-secure-token-here" \ http://localhost:3000/api/v1/status # 查看數據機狀態 curl -H "Authorization: Bearer your-secure-token-here" \ http://localhost:3000/api/v1/modems # 查看 Prometheus 指標 curl http://localhost:9090/metrics ``` --- ## 發送傳真測試 ### 準備測試文件 ```bash # 創建測試封面頁 cat > test_cover.json <