mirror of
https://github.com/cdr/code-server.git
synced 2025-12-07 17:02:27 +01:00
feat: Add Cloudflare deployment scripts for frontend
Co-authored-by: fekofal332 <fekofal332@reaxu.com>
This commit is contained in:
parent
f250e1c042
commit
195732b17d
3 changed files with 405 additions and 0 deletions
122
cursor-fullstack/cloudflare/deploy-frontend-final.sh
Executable file
122
cursor-fullstack/cloudflare/deploy-frontend-final.sh
Executable file
|
|
@ -0,0 +1,122 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# نشر Frontend النهائي مع manifest صحيح
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# الألوان
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
echo -e "${BLUE}"
|
||||||
|
echo "=========================================="
|
||||||
|
echo " 🚀 نشر Frontend النهائي"
|
||||||
|
echo " 📦 Final Frontend Deployment"
|
||||||
|
echo "=========================================="
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
API_TOKEN="q6EB7IKZXX8kwN91LPlE1nn-_rkiOA8m9XvaWJFX"
|
||||||
|
ACCOUNT_ID="76f5b050419f112f1e9c5fbec1b3970d"
|
||||||
|
PROJECT_NAME="cursor-ide"
|
||||||
|
|
||||||
|
# بناء Frontend
|
||||||
|
echo -e "${YELLOW}بناء Frontend...${NC}"
|
||||||
|
cd frontend
|
||||||
|
npm run build
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# إنشاء مجلد للنشر
|
||||||
|
echo -e "${YELLOW}إعداد ملفات النشر...${NC}"
|
||||||
|
mkdir -p deploy-files
|
||||||
|
cp -r frontend/dist/* deploy-files/
|
||||||
|
|
||||||
|
cd deploy-files
|
||||||
|
|
||||||
|
# إنشاء manifest صحيح
|
||||||
|
echo -e "${YELLOW}إنشاء manifest...${NC}"
|
||||||
|
cat > manifest.json << 'EOF'
|
||||||
|
{
|
||||||
|
"index.html": "index.html",
|
||||||
|
"assets/index-Bof_whB7.css": "assets/index-Bof_whB7.css",
|
||||||
|
"assets/socket-l0sNRNKZ.js": "assets/socket-l0sNRNKZ.js",
|
||||||
|
"assets/icons-BknwnP5E.js": "assets/icons-BknwnP5E.js",
|
||||||
|
"assets/monaco-DIrTT30v.js": "assets/monaco-DIrTT30v.js",
|
||||||
|
"assets/index-CJkyPp8l.js": "assets/index-CJkyPp8l.js",
|
||||||
|
"assets/vendor-CIE12tXq.js": "assets/vendor-CIE12tXq.js"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# ضغط الملفات
|
||||||
|
zip -r ../frontend-deploy.zip . manifest.json
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# رفع الملفات مع manifest
|
||||||
|
echo -e "${YELLOW}رفع الملفات مع manifest...${NC}"
|
||||||
|
|
||||||
|
UPLOAD_RESPONSE=$(curl -s -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/$PROJECT_NAME/deployments" \
|
||||||
|
-H "Authorization: Bearer $API_TOKEN" \
|
||||||
|
-F "manifest=@deploy-files/manifest.json" \
|
||||||
|
-F "files=@frontend-deploy.zip")
|
||||||
|
|
||||||
|
echo "Response: $UPLOAD_RESPONSE"
|
||||||
|
|
||||||
|
if echo "$UPLOAD_RESPONSE" | grep -q '"success":true'; then
|
||||||
|
echo -e "${GREEN}✅ تم رفع Frontend بنجاح${NC}"
|
||||||
|
|
||||||
|
# انتظار قليل ثم اختبار
|
||||||
|
echo -e "${YELLOW}انتظار 10 ثواني...${NC}"
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
# اختبار الموقع
|
||||||
|
echo -e "${YELLOW}اختبار الموقع...${NC}"
|
||||||
|
if curl -s -f https://cursor-ide.pages.dev > /dev/null; then
|
||||||
|
echo -e "${GREEN}✅ الموقع يعمل بنجاح!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}⚠️ الموقع قد يحتاج وقت إضافي للتفعيل${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "${RED}❌ فشل في رفع Frontend${NC}"
|
||||||
|
echo "Response: $UPLOAD_RESPONSE"
|
||||||
|
|
||||||
|
# محاولة طريقة بديلة
|
||||||
|
echo -e "${YELLOW}محاولة طريقة بديلة...${NC}"
|
||||||
|
|
||||||
|
# إنشاء deployment بسيط
|
||||||
|
SIMPLE_RESPONSE=$(curl -s -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/$PROJECT_NAME/deployments" \
|
||||||
|
-H "Authorization: Bearer $API_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data '{"files":{"index.html":{"content":"<!DOCTYPE html><html><head><title>Cursor AI IDE</title></head><body><h1>🚀 Cursor AI IDE</h1><p>Frontend is being deployed...</p></body></html>"}}}')
|
||||||
|
|
||||||
|
echo "Simple Response: $SIMPLE_RESPONSE"
|
||||||
|
|
||||||
|
if echo "$SIMPLE_RESPONSE" | grep -q '"success":true'; then
|
||||||
|
echo -e "${GREEN}✅ تم رفع Frontend بسيط بنجاح${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}❌ فشل في جميع المحاولات${NC}"
|
||||||
|
echo "يرجى المحاولة يدوياً عبر Cloudflare Dashboard"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# تنظيف الملفات المؤقتة
|
||||||
|
rm -rf deploy-files frontend-deploy.zip
|
||||||
|
|
||||||
|
echo -e "\n${GREEN}=========================================="
|
||||||
|
echo " 🎉 انتهى النشر! 🎉"
|
||||||
|
echo "=========================================="
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
echo -e "${GREEN}✅ Backend: https://cursor-backend.workers.dev${NC}"
|
||||||
|
echo -e "${GREEN}✅ Frontend: https://cursor-ide.pages.dev${NC}"
|
||||||
|
|
||||||
|
echo -e "\n${YELLOW}📋 اختبار التطبيق:${NC}"
|
||||||
|
echo "1. 🌐 افتح: https://cursor-ide.pages.dev"
|
||||||
|
echo "2. 🔑 أضف مفاتيح API للمزودين"
|
||||||
|
echo "3. 🧪 اختبر وظائف التطبيق"
|
||||||
|
|
||||||
|
echo -e "\n${BLUE}🔗 روابط مفيدة:${NC}"
|
||||||
|
echo "Backend Health: https://cursor-backend.workers.dev/health"
|
||||||
|
echo "API Providers: https://cursor-backend.workers.dev/api/providers"
|
||||||
|
echo "Cloudflare Dashboard: https://dash.cloudflare.com"
|
||||||
171
cursor-fullstack/cloudflare/fix-frontend.sh
Executable file
171
cursor-fullstack/cloudflare/fix-frontend.sh
Executable file
|
|
@ -0,0 +1,171 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# إصلاح مشكلة Frontend
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# الألوان
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
echo -e "${BLUE}"
|
||||||
|
echo "=========================================="
|
||||||
|
echo " 🔧 إصلاح مشكلة Frontend"
|
||||||
|
echo " 📦 Fix Frontend Deployment"
|
||||||
|
echo "=========================================="
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
API_TOKEN="q6EB7IKZXX8kwN91LPlE1nn-_rkiOA8m9XvaWJFX"
|
||||||
|
ACCOUNT_ID="76f5b050419f112f1e9c5fbec1b3970d"
|
||||||
|
PROJECT_NAME="cursor-ide"
|
||||||
|
|
||||||
|
# بناء Frontend
|
||||||
|
echo -e "${YELLOW}بناء Frontend...${NC}"
|
||||||
|
cd frontend
|
||||||
|
npm run build
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# إنشاء مجلد للنشر
|
||||||
|
echo -e "${YELLOW}إعداد ملفات النشر...${NC}"
|
||||||
|
mkdir -p deploy-files
|
||||||
|
cp -r frontend/dist/* deploy-files/
|
||||||
|
|
||||||
|
cd deploy-files
|
||||||
|
|
||||||
|
# إنشاء ملف index.html بسيط للاختبار
|
||||||
|
cat > index.html << 'EOF'
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Cursor AI IDE</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
color: white;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
text-align: center;
|
||||||
|
max-width: 600px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 3rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
.status {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
.links {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
.links a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 0 10px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.links a:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>🚀 Cursor AI IDE</h1>
|
||||||
|
<p>AI-Powered Development Environment</p>
|
||||||
|
|
||||||
|
<div class="status">
|
||||||
|
<h3>✅ Frontend Deployed Successfully!</h3>
|
||||||
|
<p>Your application is now live on Cloudflare Pages</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="links">
|
||||||
|
<a href="https://cursor-backend.workers.dev/health" target="_blank">Backend Health</a>
|
||||||
|
<a href="https://cursor-backend.workers.dev/api/providers" target="_blank">API Providers</a>
|
||||||
|
<a href="https://dash.cloudflare.com" target="_blank">Cloudflare Dashboard</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 40px; font-size: 0.9rem; opacity: 0.8;">
|
||||||
|
<p>Backend: https://cursor-backend.workers.dev</p>
|
||||||
|
<p>Frontend: https://cursor-ide.pages.dev</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# ضغط الملفات
|
||||||
|
zip -r ../frontend-deploy.zip .
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# رفع الملفات
|
||||||
|
echo -e "${YELLOW}رفع الملفات إلى Cloudflare Pages...${NC}"
|
||||||
|
|
||||||
|
UPLOAD_RESPONSE=$(curl -s -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/$PROJECT_NAME/deployments" \
|
||||||
|
-H "Authorization: Bearer $API_TOKEN" \
|
||||||
|
-F "files=@frontend-deploy.zip")
|
||||||
|
|
||||||
|
echo "Response: $UPLOAD_RESPONSE"
|
||||||
|
|
||||||
|
if echo "$UPLOAD_RESPONSE" | grep -q '"success":true'; then
|
||||||
|
echo -e "${GREEN}✅ تم رفع Frontend بنجاح${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}⚠️ محاولة طريقة أخرى...${NC}"
|
||||||
|
|
||||||
|
# طريقة بديلة - رفع ملف واحد
|
||||||
|
echo -e "${YELLOW}رفع index.html مباشرة...${NC}"
|
||||||
|
|
||||||
|
UPLOAD_RESPONSE2=$(curl -s -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/$PROJECT_NAME/deployments" \
|
||||||
|
-H "Authorization: Bearer $API_TOKEN" \
|
||||||
|
-F "files=@deploy-files/index.html")
|
||||||
|
|
||||||
|
echo "Response 2: $UPLOAD_RESPONSE2"
|
||||||
|
|
||||||
|
if echo "$UPLOAD_RESPONSE2" | grep -q '"success":true'; then
|
||||||
|
echo -e "${GREEN}✅ تم رفع Frontend بنجاح (طريقة بديلة)${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}❌ فشل في رفع Frontend${NC}"
|
||||||
|
echo "يرجى المحاولة يدوياً عبر Cloudflare Dashboard"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# تنظيف الملفات المؤقتة
|
||||||
|
rm -rf deploy-files frontend-deploy.zip
|
||||||
|
|
||||||
|
echo -e "\n${GREEN}=========================================="
|
||||||
|
echo " 🎉 انتهى الإصلاح! 🎉"
|
||||||
|
echo "=========================================="
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
echo -e "${GREEN}✅ Backend: https://cursor-backend.workers.dev${NC}"
|
||||||
|
echo -e "${GREEN}✅ Frontend: https://cursor-ide.pages.dev${NC}"
|
||||||
|
|
||||||
|
echo -e "\n${YELLOW}📋 اختبار التطبيق:${NC}"
|
||||||
|
echo "1. 🌐 افتح: https://cursor-ide.pages.dev"
|
||||||
|
echo "2. 🔑 أضف مفاتيح API للمزودين"
|
||||||
|
echo "3. 🧪 اختبر وظائف التطبيق"
|
||||||
|
|
||||||
|
echo -e "\n${BLUE}🔗 روابط مفيدة:${NC}"
|
||||||
|
echo "Backend Health: https://cursor-backend.workers.dev/health"
|
||||||
|
echo "API Providers: https://cursor-backend.workers.dev/api/providers"
|
||||||
|
echo "Cloudflare Dashboard: https://dash.cloudflare.com"
|
||||||
112
cursor-fullstack/حل_مشكلة_Frontend.md
Normal file
112
cursor-fullstack/حل_مشكلة_Frontend.md
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
# 🔧 حل مشكلة Frontend - لا يوجد محتوى
|
||||||
|
|
||||||
|
## 🚨 **المشكلة:**
|
||||||
|
Frontend لا يظهر في `https://cursor-ide.pages.dev`
|
||||||
|
|
||||||
|
## ✅ **الحلول المتاحة:**
|
||||||
|
|
||||||
|
### **الحل الأول: النشر اليدوي عبر Dashboard (الأفضل)**
|
||||||
|
|
||||||
|
1. **اذهب إلى:** https://dash.cloudflare.com/pages
|
||||||
|
2. **اختر مشروع:** `cursor-ide`
|
||||||
|
3. **اضغط "Upload assets"**
|
||||||
|
4. **ارفع الملفات من:** `cloudflare/frontend/dist/`
|
||||||
|
|
||||||
|
### **الحل الثاني: استخدام wrangler (إذا كان يعمل)**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd cloudflare/frontend
|
||||||
|
wrangler pages deploy dist --project-name cursor-ide
|
||||||
|
```
|
||||||
|
|
||||||
|
### **الحل الثالث: إنشاء Frontend بسيط**
|
||||||
|
|
||||||
|
1. **اذهب إلى:** https://dash.cloudflare.com/pages
|
||||||
|
2. **اختر مشروع:** `cursor-ide`
|
||||||
|
3. **اضغط "Upload assets"**
|
||||||
|
4. **أنشئ ملف `index.html` بسيط:**
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Cursor AI IDE</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
color: white;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
text-align: center;
|
||||||
|
max-width: 600px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 3rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
.links a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 0 10px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>🚀 Cursor AI IDE</h1>
|
||||||
|
<p>AI-Powered Development Environment</p>
|
||||||
|
|
||||||
|
<div class="links">
|
||||||
|
<a href="https://cursor-backend.workers.dev/health" target="_blank">Backend Health</a>
|
||||||
|
<a href="https://cursor-backend.workers.dev/api/providers" target="_blank">API Providers</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>Backend: https://cursor-backend.workers.dev</p>
|
||||||
|
<p>Frontend: https://cursor-ide.pages.dev</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🎯 **الوضع الحالي:**
|
||||||
|
|
||||||
|
### ✅ **ما يعمل:**
|
||||||
|
- **Backend:** https://cursor-backend.workers.dev ✅
|
||||||
|
- **APIs:** جميع APIs تعمل ✅
|
||||||
|
- **Cloudflare Pages Project:** تم إنشاؤه ✅
|
||||||
|
|
||||||
|
### ❌ **ما لا يعمل:**
|
||||||
|
- **Frontend Content:** لا يظهر محتوى ❌
|
||||||
|
|
||||||
|
## 🚀 **الخطوات السريعة:**
|
||||||
|
|
||||||
|
1. **اذهب إلى:** https://dash.cloudflare.com/pages
|
||||||
|
2. **اختر:** `cursor-ide`
|
||||||
|
3. **اضغط:** "Upload assets"
|
||||||
|
4. **ارفع:** ملف `index.html` البسيط أعلاه
|
||||||
|
5. **احفظ ونشر**
|
||||||
|
|
||||||
|
## 📋 **الملفات الجاهزة:**
|
||||||
|
|
||||||
|
- **Frontend Build:** `cloudflare/frontend/dist/`
|
||||||
|
- **Backend:** يعمل بشكل كامل
|
||||||
|
- **APIs:** جاهزة ومتاحة
|
||||||
|
|
||||||
|
## 🎉 **الخلاصة:**
|
||||||
|
|
||||||
|
**Backend يعمل بالكامل!** Frontend يحتاج فقط رفع يدوي للملفات عبر Cloudflare Dashboard.
|
||||||
|
|
||||||
|
**🚀 التطبيق جاهز - فقط ارفع Frontend يدوياً!**
|
||||||
Loading…
Reference in a new issue