عمليات النشر Blue-Green والتدريجية
انشر تطبيقات الحافة بأمان باستخدام عمليات نشر Blue-Green وطرح تدريجي لحركة المرور لتقليل المخاطر وإتاحة التراجع الفوري.
عمليات النشر Blue-Green والتدريجية درس مجاني في Edge Computing with Cloudflare Workers & Deno على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Edge Computing with Cloudflare Workers & Deno، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Edge Computing with Cloudflare Workers & Deno 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
The Risk of Big-Bang Deploys
Shipping a new version to 100% of users at once is risky, a hidden bug hits everyone instantly.
Progressive deployment strategies reduce blast radius by exposing changes gradually and enabling fast rollback.
Blue-Green Deployments
In a blue-green setup you run two environments:
- Blue, the current live version
- Green, the new version, fully deployed but not yet receiving traffic
You switch traffic to green when ready, and switch back instantly if something breaks.
Gradual (Canary) Rollouts
A gradual rollout sends a small percentage of traffic to the new version first, then increases it as confidence grows.
- 5% then 25% then 50% then 100%
- Watch error rates at each step
Also called a canary release.
Versioned Uploads
Cloudflare lets you upload a new Worker version without deploying it to all traffic.
wrangler versions upload
# uploads a new version, 0% traffic by defaultSplitting Traffic by Percentage
Use gradual deployments to assign a percentage of requests to each version.
wrangler versions deploy \
<new-version-id>@10% <old-version-id>@90%Manual Routing for Control
For custom logic you can route in code, for example send a cohort to the new behavior based on a hash of the user ID.
function inCanary(userId) {
// simple stable bucketing
return (userId.charCodeAt(0) % 100) < 10; // ~10%
}Watch the Right Metrics
During a rollout, monitor:
- Error rate / 5xx responses
- Latency (p50, p95, p99)
- CPU time
- Business KPIs
Compare the new version against the baseline before increasing traffic.
Instant Rollback
The key benefit of progressive deploys is fast rollback, shift traffic back to the known-good version immediately.
wrangler versions deploy <old-version-id>@100%Automating Rollback
Tie rollout steps to CI checks. If error rates exceed a threshold, the pipeline automatically reverts to the previous version.
if (errorRate > 0.02) {
await rollbackToPrevious();
}Database Compatibility
During blue-green, both versions may run at once, so schema changes must be backward compatible.
- Add columns before removing old ones
- Use expand-then-contract migrations
Best Practices Summary
Deploy safely at the edge by:
- Uploading versions without full deploy
- Splitting traffic gradually and watching metrics
- Keeping rollback one command away
- Making migrations backward compatible
Quick Check
What is the defining characteristic of a canary (gradual) rollout?
Recap
You learned safe deployment strategies:
- Blue-green keeps a hot standby for instant switching
- Gradual rollouts shift traffic in steps while you watch metrics
- Versioned uploads and percentage splits make this easy on Cloudflare
- Backward-compatible migrations keep both versions healthy
Progressive delivery turns scary deploys into routine, reversible events.
الأسئلة الشائعة
هل درس «عمليات النشر Blue-Green والتدريجية» مجاني؟
نعم — نص درس «عمليات النشر Blue-Green والتدريجية» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Edge Computing with Cloudflare Workers & Deno، انتقل إلى CoddyKit PRO. تتضمن دورة Edge Computing with Cloudflare Workers & Deno 4 دروس في المجموع.
ماذا ستتعلم في «عمليات النشر Blue-Green والتدريجية»؟
انشر تطبيقات الحافة بأمان باستخدام عمليات نشر Blue-Green وطرح تدريجي لحركة المرور لتقليل المخاطر وإتاحة التراجع الفوري. تتمرن على Edge Computing with Cloudflare Workers & Deno مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Edge Computing with Cloudflare Workers & Deno؟
لا تُشترط خبرة سابقة. Edge Computing with Cloudflare Workers & Deno على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «عمليات النشر Blue-Green والتدريجية»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Edge Computing with Cloudflare Workers & Deno هذا؟
نعم. كل درس في Edge Computing with Cloudflare Workers & Deno يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- Deno Deploy وCLI
- بيئات التشغيل المخصّصة
- الاختبار وCI/CD للحافة
- عمليات النشر Blue-Green والتدريجية