Files
ewoooc/enable_maintenance.sh
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

56 lines
1.5 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 啟用維護模式腳本
echo "=========================================="
echo "啟用維護模式"
echo "=========================================="
# 備份當前 Nginx 配置
echo "1. 備份 Nginx 配置..."
sudo cp /etc/nginx/sites-available/momo /etc/nginx/sites-available/momo.backup
# 創建維護模式配置
echo "2. 創建維護模式配置..."
sudo tee /etc/nginx/sites-available/momo-maintenance > /dev/null << 'EOF'
server {
listen 443 ssl;
server_name mo.wooo.work;
ssl_certificate /etc/letsencrypt/live/mo.wooo.work/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mo.wooo.work/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
root /home/ogt/momo_pro_system;
location / {
try_files /maintenance.html =503;
}
}
server {
listen 80;
server_name mo.wooo.work;
return 301 https://$host$request_uri;
}
EOF
# 切換到維護模式
echo "3. 切換到維護模式..."
sudo ln -sf /etc/nginx/sites-available/momo-maintenance /etc/nginx/sites-enabled/momo
# 測試並重載 Nginx
echo "4. 重載 Nginx..."
sudo nginx -t && sudo systemctl reload nginx
echo ""
echo "=========================================="
echo "✅ 維護模式已啟用"
echo "=========================================="
echo "網址https://mo.wooo.work"
echo "用戶將看到「系統維護中」頁面"
echo ""
echo "恢復正常服務:"
echo " ./disable_maintenance.sh"
echo "=========================================="