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

Construcción de aplicaciones y releases OTP

Empaquete sus GenServers y supervisores en una aplicación OTP adecuada y conviértala en un release listo para desplegar.

Construcción de aplicaciones y releases OTP 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 an OTP Application?

An OTP application is a reusable component with a defined lifecycle: it starts, runs a supervision tree, and stops cleanly. It is the standard unit of packaging in Erlang.

The .app Resource File

Every application has an .app file describing its metadata: name, modules, dependencies, and the callback module that starts it.

{application, myapp,
 [{description, "My App"},
  {vsn, "1.0.0"},
  {modules, [myapp_app, myapp_sup]},
  {applications, [kernel, stdlib]},
  {mod, {myapp_app, []}}]}.

The application Behavior

The module named in mod implements the application behavior with start/2 and stop/1 callbacks.

-module(myapp_app).
-behaviour(application).
-export([start/2, stop/1]).

start/2

start/2 is called when the application launches. It starts the top supervisor and returns its pid.

start(_Type, _Args) ->
    myapp_sup:start_link().

stop/1

stop/1 is called on shutdown for cleanup. Often it simply returns ok.

stop(_State) ->
    ok.

Starting & Stopping

From the shell you can control applications at runtime.

application:start(myapp).
application:stop(myapp).

Application Environment

Configuration lives in the env section of the .app file and is read with application:get_env.

application:get_env(myapp, port).
% => {ok, 8080}

What Is a Release?

A release bundles your application, its dependencies, and a trimmed Erlang runtime into a single self-contained, deployable artifact.

Building with rebar3

The rebar3 build tool creates releases from a relx config in rebar.config.

{relx, [{release, {myapp, "1.0.0"}, [myapp]},
        {dev_mode, false},
        {include_erts, true}]}.

Running a Release

The generated release includes scripts to start, stop, and attach a console to the running node.

% rebar3 release
% _build/default/rel/myapp/bin/myapp foreground

Why Releases Matter

Releases give reproducible deployments: the exact runtime, app versions, and config travel together, and they support hot code upgrades, a hallmark of Erlang systems.

Quick Check

Test your OTP application knowledge.

Recap

You learned to package OTP code.

  • The .app file describes metadata and the start module
  • The application behavior provides start/2 and stop/1
  • Releases bundle app + runtime for reproducible deployment

Preguntas frecuentes

¿La lección «Construcción de aplicaciones y releases OTP» es gratis?

Sí — el texto completo de «Construcción de aplicaciones y releases OTP» 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 «Construcción de aplicaciones y releases OTP»?

Empaquete sus GenServers y supervisores en una aplicación OTP adecuada y conviértala en un release listo para desplegar. 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 «Construcción de aplicaciones y releases OTP»?

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. Comprensión de OTP y los behaviors
  2. Implementación del behavior GenServer
  3. Introducción a los supervisores
  4. Construcción de aplicaciones y releases OTP
← Volver a Erlang OTP: Distributed & Fault-Tolerant Systems Programming