Phase 6.4 - Modular Architecture: - Add lewooogo-brain adapters for LLM providers - Add lewooogo-data dual memory (Redis + PostgreSQL) - Implement consensus engine for multi-agent decisions - Add incident memory service for historical context Phase 9 - Agent Teams (Claude Agent SDK): - Add base agent class with Claude Sonnet 4 integration - Implement action planner, blast radius, and security agents - Add agent API endpoints and proposal workflow - Integrate ADR-009 OpenClaw Agent Teams architecture DevOps & CI/CD: - Add GitHub Actions CI/CD workflows (ci.yaml, cd.yaml) - Add pre-commit hooks and secrets baseline - Add docker-compose for local development - Update Kubernetes network policies Frontend Improvements: - Add auto-healing error boundary component - Update i18n messages for agent features - Enhance dual-state incident card with execution feedback Documentation: - Add 7 ADRs covering MCP, design system, architecture decisions - Update ARCHITECTURE_MEMORY.md with modular design - Add GLOBAL_RULES.md and SOUL.md for project identity Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
151 lines
5.4 KiB
Bash
151 lines
5.4 KiB
Bash
#!/bin/bash
|
||
# =============================================================================
|
||
# AWOOOI Nginx 配置部署腳本
|
||
# =============================================================================
|
||
# 用途: 將 awoooi.wooo.work.conf 部署至 Nginx 反向代理伺服器
|
||
# 目標: 192.168.0.188 (AI + Web 中心) ⚠️ 絕對禁止部署至其他主機
|
||
# 負責人: CIO
|
||
# 日期: 2026-03-21
|
||
#
|
||
# ⚠️ 四主機架構強制校驗 ⚠️
|
||
# | IP | 職責 | Nginx 部署? |
|
||
# |-----------------|------------------------|-------------|
|
||
# | 192.168.0.110 | DevOps 金庫 (Harbor) | ❌ 禁止 |
|
||
# | 192.168.0.112 | Kali Security | ❌ 禁止 |
|
||
# | 192.168.0.188 | AI+Web 中心 (Nginx SSL) | ✅ 唯一目標 |
|
||
# | 192.168.0.120 | K3s Master | ❌ 禁止 |
|
||
# =============================================================================
|
||
|
||
set -e
|
||
|
||
# =============================================================================
|
||
# 配置常量 (四主機架構強制定義)
|
||
# =============================================================================
|
||
NGINX_HOST="192.168.0.188" # ⚠️ 唯一合法目標,禁止修改
|
||
NGINX_USER="root"
|
||
REMOTE_SITES_AVAILABLE="/etc/nginx/sites-available"
|
||
REMOTE_SITES_ENABLED="/etc/nginx/sites-enabled"
|
||
LOCAL_CONF="./ops/nginx/awoooi.wooo.work.conf"
|
||
CONF_NAME="awoooi.wooo.work.conf"
|
||
|
||
# 顏色
|
||
RED='\033[0;31m'
|
||
GREEN='\033[0;32m'
|
||
YELLOW='\033[1;33m'
|
||
BLUE='\033[0;34m'
|
||
NC='\033[0m'
|
||
|
||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
||
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||
|
||
# =============================================================================
|
||
# 前置檢查
|
||
# =============================================================================
|
||
|
||
echo ""
|
||
echo "=============================================="
|
||
echo " AWOOOI Nginx 配置部署"
|
||
echo " 目標: ${NGINX_HOST} (AI + Web 中心)"
|
||
echo "=============================================="
|
||
echo ""
|
||
|
||
# 四主機架構強制校驗
|
||
if [[ "$NGINX_HOST" != "192.168.0.188" ]]; then
|
||
log_error "四主機架構違規!Nginx 必須部署至 192.168.0.188"
|
||
log_error "當前目標: $NGINX_HOST"
|
||
exit 1
|
||
fi
|
||
|
||
# 檢查本地設定檔
|
||
if [ ! -f "$LOCAL_CONF" ]; then
|
||
log_error "設定檔不存在: $LOCAL_CONF"
|
||
exit 1
|
||
fi
|
||
log_success "設定檔存在: $LOCAL_CONF"
|
||
|
||
# 檢查 SSH 連線
|
||
log_info "測試 SSH 連線至 ${NGINX_HOST}..."
|
||
if ! ssh -o ConnectTimeout=5 -o BatchMode=yes ${NGINX_USER}@${NGINX_HOST} "echo 'SSH OK'" > /dev/null 2>&1; then
|
||
log_error "無法透過 SSH 連線至 ${NGINX_HOST}"
|
||
log_warn "請確認 SSH Key 已配置"
|
||
exit 1
|
||
fi
|
||
log_success "SSH 連線成功"
|
||
|
||
# =============================================================================
|
||
# Step 1: 備份現有設定 (如存在)
|
||
# =============================================================================
|
||
|
||
log_info "Step 1: 備份現有設定..."
|
||
ssh ${NGINX_USER}@${NGINX_HOST} "
|
||
if [ -f ${REMOTE_SITES_AVAILABLE}/${CONF_NAME} ]; then
|
||
cp ${REMOTE_SITES_AVAILABLE}/${CONF_NAME} ${REMOTE_SITES_AVAILABLE}/${CONF_NAME}.bak.\$(date +%Y%m%d_%H%M%S)
|
||
echo '已備份現有設定'
|
||
else
|
||
echo '無現有設定需備份'
|
||
fi
|
||
"
|
||
|
||
# =============================================================================
|
||
# Step 2: 傳輸設定檔
|
||
# =============================================================================
|
||
|
||
log_info "Step 2: 傳輸設定檔..."
|
||
scp -q "$LOCAL_CONF" ${NGINX_USER}@${NGINX_HOST}:${REMOTE_SITES_AVAILABLE}/${CONF_NAME}
|
||
log_success "設定檔已傳輸"
|
||
|
||
# =============================================================================
|
||
# Step 3: 建立 Symlink 並測試
|
||
# =============================================================================
|
||
|
||
log_info "Step 3: 啟用設定並測試..."
|
||
ssh ${NGINX_USER}@${NGINX_HOST} "
|
||
# 建立 symlink
|
||
ln -sf ${REMOTE_SITES_AVAILABLE}/${CONF_NAME} ${REMOTE_SITES_ENABLED}/${CONF_NAME}
|
||
|
||
# 測試設定語法
|
||
nginx -t
|
||
"
|
||
log_success "Nginx 設定語法正確"
|
||
|
||
# =============================================================================
|
||
# Step 4: 重載 Nginx
|
||
# =============================================================================
|
||
|
||
log_info "Step 4: 重載 Nginx..."
|
||
ssh ${NGINX_USER}@${NGINX_HOST} "systemctl reload nginx"
|
||
log_success "Nginx 已重載"
|
||
|
||
# =============================================================================
|
||
# Step 5: 驗證
|
||
# =============================================================================
|
||
|
||
log_info "Step 5: 驗證部署..."
|
||
ssh ${NGINX_USER}@${NGINX_HOST} "
|
||
echo '--- 已啟用的站點 ---'
|
||
ls -la ${REMOTE_SITES_ENABLED}/ | grep awoooi
|
||
echo ''
|
||
echo '--- Nginx 狀態 ---'
|
||
systemctl status nginx --no-pager | head -5
|
||
"
|
||
|
||
# =============================================================================
|
||
# 完成
|
||
# =============================================================================
|
||
|
||
echo ""
|
||
echo "=============================================="
|
||
echo -e "${GREEN} AWOOOI Nginx 部署完成!${NC}"
|
||
echo "=============================================="
|
||
echo ""
|
||
echo "部署資訊:"
|
||
echo " - 設定檔: ${REMOTE_SITES_AVAILABLE}/${CONF_NAME}"
|
||
echo " - 目標主機: ${NGINX_HOST} (AI + Web 中心)"
|
||
echo ""
|
||
echo "下一步:"
|
||
echo " 1. 確認 SSL 憑證已申請 (Let's Encrypt)"
|
||
echo " 2. 測試 https://awoooi.wooo.work"
|
||
echo ""
|