Showing
3 changed files
with
148 additions
and
0 deletions
announcement/index.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html lang="zh-CN"> | ||
| 3 | +<head> | ||
| 4 | + <meta charset="UTF-8"> | ||
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| 6 | + <title>系统维护公告</title> | ||
| 7 | + <style> | ||
| 8 | + body { | ||
| 9 | + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; | ||
| 10 | + background-color: #f3f4f6; | ||
| 11 | + display: flex; | ||
| 12 | + justify-content: center; | ||
| 13 | + align-items: center; | ||
| 14 | + height: 100vh; | ||
| 15 | + margin: 0; | ||
| 16 | + color: #1f2937; | ||
| 17 | + } | ||
| 18 | + .container { | ||
| 19 | + background-color: white; | ||
| 20 | + padding: 3rem; | ||
| 21 | + border-radius: 1rem; | ||
| 22 | + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); | ||
| 23 | + text-align: center; | ||
| 24 | + max-width: 500px; | ||
| 25 | + width: 90%; | ||
| 26 | + } | ||
| 27 | + .icon { | ||
| 28 | + width: 64px; | ||
| 29 | + height: 64px; | ||
| 30 | + background-color: #f59e0b; | ||
| 31 | + color: white; | ||
| 32 | + border-radius: 50%; | ||
| 33 | + display: flex; | ||
| 34 | + align-items: center; | ||
| 35 | + justify-content: center; | ||
| 36 | + margin: 0 auto 1.5rem; | ||
| 37 | + } | ||
| 38 | + h1 { | ||
| 39 | + font-size: 1.5rem; | ||
| 40 | + font-weight: 700; | ||
| 41 | + margin-bottom: 1rem; | ||
| 42 | + color: #111827; | ||
| 43 | + } | ||
| 44 | + p { | ||
| 45 | + font-size: 1.125rem; | ||
| 46 | + line-height: 1.75rem; | ||
| 47 | + color: #4b5563; | ||
| 48 | + } | ||
| 49 | + </style> | ||
| 50 | +</head> | ||
| 51 | +<body> | ||
| 52 | + <div class="container"> | ||
| 53 | + <div class="icon"> | ||
| 54 | + <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
| 55 | + <rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect> | ||
| 56 | + <path d="M7 11V7a5 5 0 0 1 10 0v4"></path> | ||
| 57 | + </svg> | ||
| 58 | + </div> | ||
| 59 | + <h1>系统维护通知</h1> | ||
| 60 | + <p>系统安全升级中,预计2026年2月6日14:00恢复</p> | ||
| 61 | + <p style="margin-top: 1rem; font-size: 0.875rem; color: #6b7280;">感谢您的使用</p> | ||
| 62 | + </div> | ||
| 63 | +</body> | ||
| 64 | +</html> |
announcement/start_announcement.sh
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) | ||
| 4 | +ENV_FILE="$SCRIPT_DIR/../.env.sh" | ||
| 5 | + | ||
| 6 | +if [ -f "$ENV_FILE" ]; then | ||
| 7 | + echo "Loading configuration from $ENV_FILE" | ||
| 8 | + source "$ENV_FILE" | ||
| 9 | +else | ||
| 10 | + echo "Error: Configuration file not found at $ENV_FILE" | ||
| 11 | + exit 1 | ||
| 12 | +fi | ||
| 13 | + | ||
| 14 | +if [ -z "$LOCAL_FRONTEND_PORT" ]; then | ||
| 15 | + echo "Error: LOCAL_FRONTEND_PORT is not set in .env.sh" | ||
| 16 | + exit 1 | ||
| 17 | +fi | ||
| 18 | + | ||
| 19 | +echo "==================================================" | ||
| 20 | +echo "Starting Maintenance Announcement" | ||
| 21 | +echo "Target Port: $LOCAL_FRONTEND_PORT" | ||
| 22 | +echo "Public Port: ${PUBLIC_FRONTEND_PORT:-Unknown}" | ||
| 23 | +echo "==================================================" | ||
| 24 | + | ||
| 25 | +APP_NAME="${FRONTEND_NAME:-z-image-frontend}" | ||
| 26 | + | ||
| 27 | +if command -v pm2 &> /dev/null; then | ||
| 28 | + echo "Stopping main frontend application ($APP_NAME)..." | ||
| 29 | + pm2 stop "$APP_NAME" 2>/dev/null || echo "Main frontend was not running or could not be stopped." | ||
| 30 | + | ||
| 31 | + MAINTENANCE_APP_NAME="maintenance-announcement-beta" | ||
| 32 | + | ||
| 33 | + echo "Starting announcement page on port $LOCAL_FRONTEND_PORT..." | ||
| 34 | + | ||
| 35 | + if command -v python3 &> /dev/null; then | ||
| 36 | + pm2 delete "$MAINTENANCE_APP_NAME" 2>/dev/null || true | ||
| 37 | + | ||
| 38 | + pm2 start "python3 -m http.server $LOCAL_FRONTEND_PORT" \ | ||
| 39 | + --name "$MAINTENANCE_APP_NAME" \ | ||
| 40 | + --cwd "$SCRIPT_DIR" \ | ||
| 41 | + --watch | ||
| 42 | + | ||
| 43 | + echo "Maintenance announcement started." | ||
| 44 | + pm2 list | ||
| 45 | + else | ||
| 46 | + echo "Error: python3 is not available. Please install python3 to run the simple http server." | ||
| 47 | + exit 1 | ||
| 48 | + fi | ||
| 49 | +else | ||
| 50 | + echo "Error: pm2 is not installed or not in PATH." | ||
| 51 | + exit 1 | ||
| 52 | +fi | ||
| 53 | + | ||
| 54 | +echo "==================================================" | ||
| 55 | +echo "Maintenance page should be visible at:" | ||
| 56 | +echo "http://localhost:$LOCAL_FRONTEND_PORT" | ||
| 57 | +if [ ! -z "$PUBLIC_IP" ] && [ ! -z "$PUBLIC_FRONTEND_PORT" ]; then | ||
| 58 | + echo "http://$PUBLIC_IP:$PUBLIC_FRONTEND_PORT" | ||
| 59 | +fi | ||
| 60 | +echo "==================================================" |
announcement/stop_announcement.sh
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +MAINTENANCE_APP_NAME="maintenance-announcement" | ||
| 4 | + | ||
| 5 | +echo "==================================================" | ||
| 6 | +echo "Stopping Maintenance Announcement" | ||
| 7 | +echo "==================================================" | ||
| 8 | + | ||
| 9 | +if command -v pm2 &> /dev/null; then | ||
| 10 | + if pm2 list | grep -q "$MAINTENANCE_APP_NAME"; then | ||
| 11 | + echo "Stopping and deleting $MAINTENANCE_APP_NAME..." | ||
| 12 | + pm2 stop "$MAINTENANCE_APP_NAME" 2>/dev/null | ||
| 13 | + pm2 delete "$MAINTENANCE_APP_NAME" 2>/dev/null | ||
| 14 | + echo "Maintenance announcement stopped." | ||
| 15 | + else | ||
| 16 | + echo "Process '$MAINTENANCE_APP_NAME' is not running." | ||
| 17 | + fi | ||
| 18 | + pm2 list | ||
| 19 | +else | ||
| 20 | + echo "Error: pm2 is not installed or not in PATH." | ||
| 21 | + exit 1 | ||
| 22 | +fi | ||
| 23 | + | ||
| 24 | +echo "==================================================" |
-
Please register or login to post a comment