feat: add comprehensive management scripts for CodiMD

Add 9 management scripts to simplify CodiMD operations:
- start.sh: Start services with automatic .env setup
- stop.sh: Stop all services gracefully
- restart.sh: Restart all services
- logs.sh: View real-time logs for any service
- status.sh: Check service status and resource usage
- backup.sh: Backup database, uploads, and environment
- restore.sh: Restore from backups with interactive selection
- update.sh: Update Docker images with automatic backup
- cleanup.sh: Clean unused Docker resources

Add SCRIPTS.md with comprehensive usage documentation and examples.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 17:41:10 +08:00
parent cbe76b1f96
commit 9ea9eb4b61
10 changed files with 548 additions and 0 deletions

46
start.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
# CodiMD 啟動腳本
set -e
echo "🚀 啟動 CodiMD 服務..."
# 檢查 .env 是否存在
if [ ! -f .env ]; then
echo "⚠️ .env 檔案不存在,從 .env.example 複製..."
cp .env.example .env
echo "✅ 已建立 .env 檔案"
echo "⚠️ 請編輯 .env 檔案,設定強密碼和域名"
echo " nano .env"
echo ""
read -p "按 Enter 繼續或 Ctrl+C 取消..."
fi
# 檢查 Docker 是否運行
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker 未運行,請先啟動 Docker"
exit 1
fi
# 啟動服務
docker-compose up -d
echo ""
echo "⏳ 等待服務啟動..."
sleep 5
# 顯示服務狀態
echo ""
echo "📊 服務狀態:"
docker-compose ps
echo ""
echo "✅ CodiMD 已啟動!"
echo ""
echo "🌐 訪問地址:"
echo " 本地: http://localhost:3000"
echo " 外部: http://$(hostname -I | awk '{print $1}'):3000"
echo ""
echo "📝 查看日誌: ./logs.sh"
echo "🛑 停止服務: ./stop.sh"
echo "🔄 重啟服務: ./restart.sh"