0Pricing
Erlang OTP: Distributed & Fault-Tolerant Systems Programming · درس

إدارة إصدارات النشر ونشرها

تعرّف على أفضل الممارسات لإدارة إصدارات النشر ونشر التحديثات وإدارة عمليات التراجع في بيئة الإنتاج

إدارة إصدارات النشر ونشرها درس مجاني في Erlang OTP: Distributed & Fault-Tolerant Systems Programming على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Erlang OTP: Distributed & Fault-Tolerant Systems Programming، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Erlang OTP: Distributed & Fault-Tolerant Systems Programming 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Why Version Your Releases?

When you build an Erlang application for production, it's bundled into a release. Just like any software, releases need clear version numbers.

Versioning helps you:

  • Track changes over time.
  • Identify specific builds.
  • Manage compatibility with other systems.
  • Plan for upgrades and rollbacks.

Erlang's Versioning System

In Erlang, versioning happens at different levels. Each individual application (an .app file) has its own version. The overall release (the .rel file) also has a version that typically reflects the entire bundle.

The vsn key in an .app file defines an application's version.

% my_app.app file (conceptual)
{application, my_app,
 [{description, "My Erlang Application"},
  {vsn, "1.0.0"},
  {modules, [my_app_app, my_app_sup]},
  {registered, []},
  {applications, [kernel, stdlib]},
  {mod, {my_app_app, []}},
  {env, []}]}.

Semantic Versioning (SemVer)

A widely adopted standard is Semantic Versioning (SemVer), typically formatted as MAJOR.MINOR.PATCH. It's a great practice to follow for your Erlang applications.

  • MAJOR: Incremented for incompatible API changes.
  • MINOR: Incremented for new functionality in a backward-compatible way.
  • PATCH: Incremented for backward-compatible bug fixes.

This helps users understand the impact of an upgrade.

Applying SemVer in Erlang

You'll typically apply SemVer to your application's vsn in the .app file. When you create a release, its version (relvsn) often matches the main application's version or follows a similar scheme.

Tools like rebar3 manage these versions when building releases.

% my_app.app file
{application, my_app,
 [{description, "My Erlang Service"},
  {vsn, "1.2.3"},
  {modules, [my_app_app, my_app_sup]},
  {registered, []},
  {applications, [kernel, stdlib]},
  {mod, {my_app_app, []}},
  {env, []}]}.

Deployment Strategies Overview

Once you have a versioned Erlang release, how do you get it running in production? There are several strategies, depending on your system's requirements for uptime and complexity.

  • Cold Deployment: Simplest, involves downtime.
  • Hot Upgrades: Zero-downtime (covered in previous lesson).
  • Blue/Green or Canary Deployments: More advanced, often used with orchestration tools.

Cold Deployment: Simple Restart

A cold deployment is the most straightforward method. You stop your currently running Erlang system completely, replace its files with the new release, and then start the new version.

This method always incurs downtime, making it suitable for systems where brief interruptions are acceptable.

# Stop the old release
/path/to/my_app/bin/my_app stop

# (Replace files with new release)

# Start the new release
/path/to/my_app/bin/my_app start

Hot Upgrades vs. Full Deployment

Recall from the previous lesson that hot code loading allows you to upgrade a running Erlang system without stopping it.

While powerful for applying patches or minor feature additions, hot upgrades are specific to changing *parts* of a running system. A full deployment often refers to the initial setup or a complete replacement of the entire release, sometimes involving a cold restart or more advanced traffic management.

The Importance of Rollbacks

Even with careful testing, new deployments can introduce unexpected issues. A robust deployment strategy always includes a plan for rollbacks.

A rollback means reverting your system to a previous, stable version if the new deployment fails or causes problems. This minimizes the impact of failures and restores service quickly.

Erlang's Rollback Mechanism

Erlang releases are designed to support rollbacks. When you perform a hot upgrade, Erlang generates an .relup script that describes how to move between versions. Crucially, it also knows how to reverse that script to go back.

Even with cold deployments, you can switch back to a previous release by managing your release directories and restarting the desired version.

# Example of a rollback command using release_handler
# This would typically be part of a custom script or release tool

% release_handler:install_release("my_app-1.1.0").
% release_handler:make_permanent("my_app-1.1.0").

# Alternatively, for cold deployment:
# /path/to/my_app_1.1.0/bin/my_app start

Test Your Understanding

Order the steps for a typical cold deployment of an Erlang release.

Summary: Versioning & Deployment

You've learned about the critical aspects of release versioning and deployment in Erlang:

  • Versioning: Use vsn in .app files, ideally following SemVer (MAJOR.MINOR.PATCH), to track and manage changes.
  • Deployment: Understand cold deployment (with downtime) and its distinction from hot upgrades.
  • Rollbacks: Always plan for reverting to a stable previous version to ensure system resilience.

These practices are key to managing robust Erlang applications in production!

الأسئلة الشائعة

هل درس «إدارة إصدارات النشر ونشرها» مجاني؟

نعم — نص درس «إدارة إصدارات النشر ونشرها» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Erlang OTP: Distributed & Fault-Tolerant Systems Programming، انتقل إلى CoddyKit PRO. تتضمن دورة Erlang OTP: Distributed & Fault-Tolerant Systems Programming 4 دروس في المجموع.

ماذا ستتعلم في «إدارة إصدارات النشر ونشرها»؟

تعرّف على أفضل الممارسات لإدارة إصدارات النشر ونشر التحديثات وإدارة عمليات التراجع في بيئة الإنتاج تتمرن على Erlang OTP: Distributed & Fault-Tolerant Systems Programming مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Erlang OTP: Distributed & Fault-Tolerant Systems Programming؟

لا تُشترط خبرة سابقة. Erlang OTP: Distributed & Fault-Tolerant Systems Programming على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.

كم من الوقت يستغرق درس «إدارة إصدارات النشر ونشرها»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Erlang OTP: Distributed & Fault-Tolerant Systems Programming هذا؟

نعم. كل درس في Erlang OTP: Distributed & Fault-Tolerant Systems Programming يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. إنشاء إصدارات Erlang
  2. تحميل الشيفرة وتحديثها دون إيقاف التشغيل
  3. إدارة إصدارات النشر ونشرها
  4. إعداد الإصدار ونصوص الإقلاع
← العودة إلى Erlang OTP: Distributed & Fault-Tolerant Systems Programming