إعداد الإصدار ونصوص الإقلاع
أتقن sys.config ونصوص الإقلاع لإعداد بيئات التطبيقات والتحكم في تسلسل بدء التشغيل الدقيق لإصدار Erlang.
إعداد الإصدار ونصوص الإقلاع درس مجاني في Erlang OTP: Distributed & Fault-Tolerant Systems Programming على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Erlang OTP: Distributed & Fault-Tolerant Systems Programming، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Erlang OTP: Distributed & Fault-Tolerant Systems Programming 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
What Is Release Configuration?
A release bundles your applications, the Erlang runtime, and configuration. Two files drive runtime behaviour: sys.config for application settings and the boot script for the startup sequence.
The Application Environment
Each OTP application has an environment — a set of key/value parameters. You read them at runtime with application:get_env/2.
application:get_env(my_app, port).sys.config Structure
sys.config is a single Erlang term: a list of {App, [{Key, Value}]} tuples that override application defaults at boot.
[
{my_app, [{port, 8080}, {pool_size, 10}]},
{kernel, [{logger_level, info}]}
].Overriding Defaults
Values in sys.config override those in each app .app file. This lets one codebase run differently per environment (dev, staging, prod) just by swapping config.
Reading Config at Runtime
Inside a gen_server init, pull configured values so behaviour follows the environment.
init([]) ->
{ok, Port} = application:get_env(my_app, port),
{ok, listen(Port)}.What Is a Boot Script?
The boot script (.script compiled to .boot) lists every application and module to load, and the order to start them. The runtime follows it to bring the system up deterministically.
Generated from the .rel File
You describe a release in a .rel file. Tools like systools or rebar3 turn it into the boot script.
{release,
{"my_system", "1.0.0"},
{erts, "13.0"},
[{kernel, "8.0"}, {stdlib, "4.0"}, {my_app, "1.0.0"}]}.Start Phases
Applications start in dependency order. If my_app lists kernel and stdlib as dependencies, the boot script guarantees they start first.
Permanent vs Temporary Apps
In the boot script an application can be permanent (its crash takes down the node), transient, or temporary. Choose permanent for core services.
Layered Config with config/0
You can split configuration across files and merge them, or use runtime os:getenv/1 reads for secrets that should not live in sys.config.
init([]) ->
Url = os:getenv("DATABASE_URL"),
{ok, connect(Url)}.Applying a Custom Config File
At node startup you point to a config file with the -config flag, letting one release run with different settings just by swapping the file.
erl -config /etc/my_system/prod.config -boot my_systemQuick Check
Test your release configuration knowledge.
Recap
You learned how releases are configured and started:
sys.configsets the application environment per deployment- Read values with
application:get_env/2 - The
.relfile is compiled into a boot script - Boot scripts start applications in dependency order
- Use permanent apps for core services and env vars for secrets
الأسئلة الشائعة
هل درس «إعداد الإصدار ونصوص الإقلاع» مجاني؟
نعم — نص درس «إعداد الإصدار ونصوص الإقلاع» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Erlang OTP: Distributed & Fault-Tolerant Systems Programming، انتقل إلى CoddyKit PRO. تتضمن دورة Erlang OTP: Distributed & Fault-Tolerant Systems Programming 4 دروس في المجموع.
ماذا ستتعلم في «إعداد الإصدار ونصوص الإقلاع»؟
أتقن sys.config ونصوص الإقلاع لإعداد بيئات التطبيقات والتحكم في تسلسل بدء التشغيل الدقيق لإصدار Erlang. تتمرن على Erlang OTP: Distributed & Fault-Tolerant Systems Programming مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Erlang OTP: Distributed & Fault-Tolerant Systems Programming؟
لا تُشترط خبرة سابقة. Erlang OTP: Distributed & Fault-Tolerant Systems Programming على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «إعداد الإصدار ونصوص الإقلاع»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Erlang OTP: Distributed & Fault-Tolerant Systems Programming هذا؟
نعم. كل درس في Erlang OTP: Distributed & Fault-Tolerant Systems Programming يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- إنشاء إصدارات Erlang
- تحميل الشيفرة وتحديثها دون إيقاف التشغيل
- إدارة إصدارات النشر ونشرها
- إعداد الإصدار ونصوص الإقلاع