0Pricing
Erlang OTP: Distributed & Fault-Tolerant Systems Programming · Lección

Configuración de releases y scripts de arranque

Domine sys.config y los scripts de arranque para configurar los entornos de las aplicaciones y controlar la secuencia exacta de inicio de un release de Erlang.

Configuración de releases y scripts de arranque es una lección gratuita de Erlang OTP: Distributed & Fault-Tolerant Systems Programming en CoddyKit. Esta es la lección 4 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Erlang OTP: Distributed & Fault-Tolerant Systems Programming, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

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_system

Quick Check

Test your release configuration knowledge.

Recap

You learned how releases are configured and started:

  • sys.config sets the application environment per deployment
  • Read values with application:get_env/2
  • The .rel file is compiled into a boot script
  • Boot scripts start applications in dependency order
  • Use permanent apps for core services and env vars for secrets

Preguntas frecuentes

¿La lección «Configuración de releases y scripts de arranque» es gratis?

Sí — el texto completo de «Configuración de releases y scripts de arranque» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming, actualiza a CoddyKit PRO. El curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming incluye 4 lecciones en total.

¿Qué aprenderé en «Configuración de releases y scripts de arranque»?

Domine sys.config y los scripts de arranque para configurar los entornos de las aplicaciones y controlar la secuencia exacta de inicio de un release de Erlang. Practicas Erlang OTP: Distributed & Fault-Tolerant Systems Programming con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar Erlang OTP: Distributed & Fault-Tolerant Systems Programming?

No se requiere experiencia previa. Erlang OTP: Distributed & Fault-Tolerant Systems Programming en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 4 de 4.

¿Cuánto tiempo toma la lección «Configuración de releases y scripts de arranque»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de Erlang OTP: Distributed & Fault-Tolerant Systems Programming?

Sí. Cada lección de Erlang OTP: Distributed & Fault-Tolerant Systems Programming incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Creación de releases de Erlang
  2. Carga y actualización de código en caliente
  3. Versionado y despliegue de releases
  4. Configuración de releases y scripts de arranque
← Volver a Erlang OTP: Distributed & Fault-Tolerant Systems Programming