fix(devops): 清理舊端口與危險 compose 操作
All checks were successful
CD Pipeline / deploy (push) Successful in 1m45s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m45s
This commit is contained in:
@@ -249,7 +249,7 @@ sys_log.info("[Security] ✅ CSRF 防護已啟用 (Flask-WTF)")
|
|||||||
**測試驗證:**
|
**測試驗證:**
|
||||||
```bash
|
```bash
|
||||||
# 1. 測試 CSRF 防護是否生效
|
# 1. 測試 CSRF 防護是否生效
|
||||||
curl -X POST http://localhost:5888/api/run_task
|
curl -X POST http://localhost/api/run_task
|
||||||
# 預期結果: 400 Bad Request (The CSRF token is missing)
|
# 預期結果: 400 Bad Request (The CSRF token is missing)
|
||||||
|
|
||||||
# 2. 測試附帶正確 CSRF token 的請求
|
# 2. 測試附帶正確 CSRF token 的請求
|
||||||
@@ -289,10 +289,10 @@ curl -X POST http://localhost:5888/api/run_task
|
|||||||
**測試案例:**
|
**測試案例:**
|
||||||
```bash
|
```bash
|
||||||
# 1. 正常下載(應該成功)
|
# 1. 正常下載(應該成功)
|
||||||
curl http://localhost:5888/api/backup/download/momo_system_backup_V9.4_20260112_1430.zip
|
curl http://localhost/api/backup/download/momo_system_backup_V9.4_20260112_1430.zip
|
||||||
|
|
||||||
# 2. 路徑遍歷攻擊(應被阻擋)
|
# 2. 路徑遍歷攻擊(應被阻擋)
|
||||||
curl http://localhost:5888/api/backup/download/../../../etc/passwd
|
curl http://localhost/api/backup/download/../../../etc/passwd
|
||||||
# 預期結果: {"error":"非法路徑"} + 安全日誌警告
|
# 預期結果: {"error":"非法路徑"} + 安全日誌警告
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ usage() {
|
|||||||
echo " restart 重啟 Superset"
|
echo " restart 重啟 Superset"
|
||||||
echo " logs 查看日誌"
|
echo " logs 查看日誌"
|
||||||
echo " status 查看狀態"
|
echo " status 查看狀態"
|
||||||
echo " clean 清除所有資料 (危險)"
|
echo " clean 已停用:避免誤刪 Superset 資料"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ deploy() {
|
|||||||
# 停止服務
|
# 停止服務
|
||||||
stop() {
|
stop() {
|
||||||
log_info "停止 Superset 服務..."
|
log_info "停止 Superset 服務..."
|
||||||
docker compose down
|
docker compose stop
|
||||||
log_success "服務已停止"
|
log_success "服務已停止"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,21 +138,9 @@ status() {
|
|||||||
|
|
||||||
# 清除所有資料
|
# 清除所有資料
|
||||||
clean() {
|
clean() {
|
||||||
log_warn "這將刪除所有 Superset 資料,包括:"
|
log_error "clean 已停用:資料清除必須先完成備份與人工審核"
|
||||||
log_warn " - 儀表板"
|
log_error "如需重建 Superset,請先匯出儀表板、確認 volume 名稱,再由維運人員手動處理"
|
||||||
log_warn " - 圖表"
|
exit 1
|
||||||
log_warn " - 資料集"
|
|
||||||
log_warn " - 資料庫連線設定"
|
|
||||||
echo ""
|
|
||||||
read -p "確定要繼續嗎? (輸入 YES 確認): " confirm
|
|
||||||
|
|
||||||
if [ "$confirm" = "YES" ]; then
|
|
||||||
log_info "停止並清除服務..."
|
|
||||||
docker compose down -v
|
|
||||||
log_success "已清除所有資料"
|
|
||||||
else
|
|
||||||
log_info "已取消"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 主程式
|
# 主程式
|
||||||
|
|||||||
@@ -5,8 +5,10 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
from pathlib import Path
|
||||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
|
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
sys.path.insert(0, str(PROJECT_ROOT))
|
||||||
|
|
||||||
from database.vendor_manager import VendorDatabaseManager
|
from database.vendor_manager import VendorDatabaseManager
|
||||||
from database.vendor_models import EmailSendLog
|
from database.vendor_models import EmailSendLog
|
||||||
@@ -78,7 +80,7 @@ def check_email_status():
|
|||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
print("1. 登入收件信箱檢查:yingpin_chen@pchome.tw")
|
print("1. 登入收件信箱檢查:yingpin_chen@pchome.tw")
|
||||||
print("2. 檢查垃圾郵件資料夾(第一次發送可能被誤判)")
|
print("2. 檢查垃圾郵件資料夾(第一次發送可能被誤判)")
|
||||||
print("3. 查看網頁記錄:http://localhost:5888/vendor-stockout/send-email")
|
print("3. 查看網頁記錄:http://localhost/vendor-stockout/send-email")
|
||||||
print("\n⚠️ 注意:")
|
print("\n⚠️ 注意:")
|
||||||
print(" - 狀態「成功」= Gmail SMTP 已接收郵件")
|
print(" - 狀態「成功」= Gmail SMTP 已接收郵件")
|
||||||
print(" - 但不保證對方信箱一定收到(可能被退信或進垃圾桶)")
|
print(" - 但不保證對方信箱一定收到(可能被退信或進垃圾桶)")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ OpenClaw 簡報生成器 — 精品深色主題 + 原生圖表版 (2026-04-20 v2
|
|||||||
- 頁眉:橘色標題帶 #FF5722
|
- 頁眉:橘色標題帶 #FF5722
|
||||||
- 頁腳:♥ Powered by OpenClaw(深灰 #37474F)
|
- 頁腳:♥ Powered by OpenClaw(深灰 #37474F)
|
||||||
|
|
||||||
圖表對應(來源:web/templates):
|
圖表對應(來源:templates):
|
||||||
daily → 近7日業績柱狀圖(參考 daily_sales.html trendChart)
|
daily → 近7日業績柱狀圖(參考 daily_sales.html trendChart)
|
||||||
weekly → 7日業績柱狀圖 + TOP10 商品表
|
weekly → 7日業績柱狀圖 + TOP10 商品表
|
||||||
monthly → 品類橫條圖(參考 monthly_summary_analysis.html)+ KPI + TOP10
|
monthly → 品類橫條圖(參考 monthly_summary_analysis.html)+ KPI + TOP10
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
cd "$PROJECT_PATH"
|
cd "$PROJECT_PATH"
|
||||||
|
|
||||||
# 1. 啟動 Flask 網頁後台 (Port 5888)
|
# 1. 啟動 Flask 網頁後台 (Port 80)
|
||||||
osascript -e "tell application \"Terminal\" to do script \"cd '$PROJECT_PATH' && source venv/bin/activate && python '$PROJECT_PATH/app.py'\""
|
osascript -e "tell application \"Terminal\" to do script \"cd '$PROJECT_PATH' && source venv/bin/activate && python '$PROJECT_PATH/app.py'\""
|
||||||
|
|
||||||
# 2. 啟動 08:30 定時排程器
|
# 2. 啟動 08:30 定時排程器
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ def test_active_code_no_longer_references_legacy_5888_port():
|
|||||||
ROOT / "tests",
|
ROOT / "tests",
|
||||||
ROOT / "AUTO_IMPORT_README.md",
|
ROOT / "AUTO_IMPORT_README.md",
|
||||||
ROOT / "GOOGLE_DRIVE_SETUP.md",
|
ROOT / "GOOGLE_DRIVE_SETUP.md",
|
||||||
|
ROOT / "start_momo.command",
|
||||||
|
ROOT / "scripts" / "archive" / "check_email_status.py",
|
||||||
]
|
]
|
||||||
|
|
||||||
offenders = []
|
offenders = []
|
||||||
@@ -119,6 +121,7 @@ def test_active_code_no_longer_references_legacy_5888_port():
|
|||||||
def test_executable_scripts_do_not_use_remove_orphans():
|
def test_executable_scripts_do_not_use_remove_orphans():
|
||||||
script_paths = [
|
script_paths = [
|
||||||
ROOT / "scripts",
|
ROOT / "scripts",
|
||||||
|
ROOT / "docker",
|
||||||
ROOT / ".gitea" / "workflows",
|
ROOT / ".gitea" / "workflows",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user