مرجع تقني وافي لربط أي مشروع Laravel مستقبلي بالـ Auto-Deploy دون أي تدخل يدوي
| المفتاح السري (Deploy Secret) | TERKO_DEPLOY_SECRET_2026 مُفعل |
|---|---|
| التوكن (GitHub Token PAT) | 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 تم اختباره بنجاح |
| رابط الـ Webhook (Payload URL) | https://stores.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026 |
| مسار المجلد على السيرفر | /home/saydleya/public_html/stores.saydleyat.com |
| المستودع (Repository) | gabershemy/DrugsStoresApp (Private) |
تعمل Push من GitHub Desktop أو Terminal لجهازك.
يرسل GitHub طلب POST فوري لمسار API على السيرفر.
يتأكد لارافيل من مطابقة TERKO_DEPLOY_SECRET_2026.
يتم سحب الكود عبر التوكن وتفريغ كاش لارافيل فوراً.
إذا كان مستودعك على GitHub خاصاً (Private)، يحتاج السيرفر لتوكن دائم حتى يسحب التحديثات تلقائياً بدون أن يسألك عن اسم المستخدم وكلمة السر في كل عملية.
cpanel-deploy).✓ على صلاحية repo (Full control of private repositories).ghp_... واحفظه معك.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
لا حاجة لإنشاء أي Controller إضافي. نقوم بكتابة المسار كـ Closure Route مباشر وسريع داخل ملف routes/api.php:
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
// ─────────────────────────────────────────────────────────────────────────────
// GitHub Auto-Deploy Webhook (Closure Route)
// ─────────────────────────────────────────────────────────────────────────────
Route::match(['get', 'post'], '/deploy-webhook', function (Request $request) {
// 1. المفتاح السري المعتمد
$secret = env('DEPLOY_SECRET', 'TERKO_DEPLOY_SECRET_2026');
$providedSecret = $request->query('secret') ?: $request->input('secret');
// قائمة المفاتيح المقبولة
$validSecrets = array_filter([$secret, 'TERKO_DEPLOY_SECRET_2026']);
// 2. التحقق من تطابق الـ Secret
if (!empty($validSecrets) && !in_array($providedSecret, $validSecrets, true)) {
return response()->json([
'status' => 'error',
'message' => 'Unauthorized: Invalid deploy secret'
], 403);
}
// 3. الانتقال لمجلد المشروع وسحب التحديثات وتفريغ الكاش
$baseDir = base_path();
$command = "cd {$baseDir} && git pull origin main 2>&1 && php artisan optimize:clear 2>&1";
$output = shell_exec($command);
// 4. إرجاع النتيجة بتنسيق JSON إلى GitHub
return response()->json([
'status' => 'success',
'message' => 'Deployed successfully',
'output' => $output,
'timestamp' => now()->toIso8601String(),
], 200);
});
لأن طلب GitHub يأتي من خارج المتصفح، يجب استثناء الرابط من الـ CSRF Token حتى لا يرفضه السيرفر بخطأ 419 Page Expired:
bootstrap/app.php): ->withMiddleware(function (Middleware $middleware) {
$middleware->validateCsrfTokens(except: [
'api/*',
'deploy-webhook',
]);
})
app/Http/Middleware/VerifyCsrfToken.php):protected $except = [
'api/*',
'deploy-webhook',
];
افتح شاشة Terminal داخل cPanel (أو اتصل بـ SSH)، وانتقل لمجلد الموقع الخاص بك ونفذ هذا السطر الكامل الجاهز للنسخ:
cd /home/saydleya/public_html/stores.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/DrugsStoresApp.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/DrugsStoresApp.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clear
.env ومجلدات storage/ و public/storage مضافة تلقائياً في ملف .gitignore، ولذلك فإن Git لا يمسها ولا يحذفها نهائياً.
الآن نربط الـ Webhook داخل إعدادات مستودع GitHub:
https://stores.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026application/jsonEnable SSL verificationJust the push eventبمجرد الحفظ، سيرسل GitHub اختبار Ping. للتأكد من نجاحه بالكامل:
200 OK.{"status":"success","message":"Deployed successfully","output":"Already up to date.\n..."}
git push تعمله من جهازك سيصل للسيرفر في ثانيتين وبشكل تلقائي تماماً!
ابحث عن اسم المشروع أو اختره مباشرة من القائمة، وانسخ الرابط والأمر بضغطة زر واحدة:
https://agri-sense.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/agri-sense.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Agri-Sense.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Agri-Sense.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://ai-school-new.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/ai-school-new.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/ai_school_new.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/ai_school_new.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://saas-multitenancy-ai-whatsapp-bot.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/saas-multitenancy-ai-whatsapp-bot.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Saas-Multitenancy-Ai-WhatsApp-Bot.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Saas-Multitenancy-Ai-WhatsApp-Bot.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://almobtaker-erp.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/almobtaker-erp.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/almobtaker_erp.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/almobtaker_erp.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://clinic.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/clinic.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/clinic.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/clinic.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://assem-hegazy.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/assem-hegazy.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/assem_hegazy.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/assem_hegazy.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://delta-gas.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/delta-gas.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Delta-Gas.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Delta-Gas.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://dr-mina-clinic.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/dr-mina-clinic.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Dr-Mina-Clinic.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Dr-Mina-Clinic.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://pharmacy-erp.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/pharmacy-erp.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Pharmacy--ERP.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Pharmacy--ERP.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://drugsstoresapp.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/drugsstoresapp.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/DrugsStoresApp.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/DrugsStoresApp.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://eduap-pro.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/eduap-pro.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/EduAp-Pro.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/EduAp-Pro.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://elfeky-agri.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/elfeky-agri.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Elfeky-Agri.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Elfeky-Agri.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://elseknedy.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/elseknedy.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/elseknedy.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/elseknedy.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://family-tree.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/family-tree.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Family-Tree.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Family-Tree.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://hekayet-watan.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/hekayet-watan.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Hekayet-Watan.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Hekayet-Watan.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://hospital.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/hospital.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/hospital.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/hospital.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://mohamedshaat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/mohamedshaat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Hossam-E-Learning.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Hossam-E-Learning.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://icu-medications-pictograms.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/icu-medications-pictograms.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/ICU-Medications-Pictograms.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/ICU-Medications-Pictograms.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://instal-hossam.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/instal-hossam.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/instal_hossam.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/instal_hossam.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://installement-nabil-motorcycle.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/installement-nabil-motorcycle.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Installement_nabil_motorcycle.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Installement_nabil_motorcycle.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://laravel-13-filament-5-master.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/laravel-13-filament-5-master.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Laravel_13_Filament_5_Master.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Laravel_13_Filament_5_Master.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://ai-assistant.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/ai-assistant.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/ai_assistant.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/ai_assistant.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://laravel-installement.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/laravel-installement.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Laravel-Installement.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Laravel-Installement.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://medical-centers-records.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/medical-centers-records.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Medical-Centers-Records.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Medical-Centers-Records.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://medical-rep-crm.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/medical-rep-crm.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Medical_Rep_CRM.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Medical_Rep_CRM.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://osama-abokhalifa.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/osama-abokhalifa.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Osama_Abokhalifa.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Osama_Abokhalifa.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://sales-new.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/sales-new.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Sales_New.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Sales_New.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://poultry-farm.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/poultry-farm.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Poultry-Farm.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Poultry-Farm.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://water-filters-air-condition.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/water-filters-air-condition.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Water-Filters-Air-Condition.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Water-Filters-Air-Condition.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://terko-car-rent.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/terko-car-rent.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Terko-Car-Rent.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Terko-Car-Rent.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://vision.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/vision.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Vision.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Vision.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://adly-khallaf.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/adly-khallaf.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/adly_khallaf.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/adly_khallaf.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://dr-eldemery-new.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/dr-eldemery-new.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/dr-eldemery-new.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/dr-eldemery-new.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://filakitv5.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/filakitv5.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/filakitv5.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/filakitv5.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://indust-dev.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/indust-dev.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/indust_dev.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/indust_dev.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://lens-zatca-new.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/lens-zatca-new.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/lens_zatca_new.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/lens_zatca_new.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://local-dev.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/local-dev.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/local_dev.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/local_dev.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://saleh-tarfayah.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/saleh-tarfayah.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/Saleh-Tarfayah.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/Saleh-Tarfayah.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearhttps://shiba.saydleyat.com/api/deploy-webhook?secret=TERKO_DEPLOY_SECRET_2026cd /home/saydleya/public_html/shiba.saydleyat.com && git init && git remote add origin https://gabershemy:[email protected]/gabershemy/shiba.git || git remote set-url origin https://gabershemy:[email protected]/gabershemy/shiba.git && git fetch origin main && git branch -M main && git reset --hard origin/main && php artisan optimize:clearالسبب: المسار غير مسجل في لارافيل، أو أن ملف routes/api.php معطل في bootstrap/app.php.
الحل: تأكد من وضع كود الـ route في routes/api.php، وتفعيل مسار api في bootstrap/app.php، ثم نفّذ php artisan route:clear.
السبب: تم اعتراض الطلب بواسطة حماية CSRF الخاصة بلارافيل.
الحل: استثنِ api/* و deploy-webhook من حماية CSRF كما هو موضح في الخطوة 3.
السبب: عند فحص الـ Response Body تجد رسالة fatal: not a git repository.
الحل: مجلد الموقع على السيرفر ليس مستودع Git. نفذ أوامر الخطوة 4 في Terminal السيرفر لمرة واحدة.
السبب: السيرفر لا يستطيع سحب المستودع الخاص بدون Personal Access Token.
الحل: تأكد من تضمين التوكن في رابط الـ Remote: https://USER:[email protected]/....