0Pricing
Erlang OTP: Distributed & Fault-Tolerant Systems Programming · Aula

Criar Aplicações e Versões OTP

Empacote os seus GenServers e supervisores numa aplicação OTP adequada e reúna-a numa versão implementável.

Criar Aplicações e Versões OTP é uma aula grátis de Erlang OTP: Distributed & Fault-Tolerant Systems Programming no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Erlang OTP: Distributed & Fault-Tolerant Systems Programming, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em 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

Perguntas Frequentes

A aula “Criar Aplicações e Versões OTP” é grátis?

Sim — o texto completo de “Criar Aplicações e Versões OTP” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming, atualize para CoddyKit PRO. O curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming inclui 4 aulas no total.

O que vou aprender em “Criar Aplicações e Versões OTP”?

Empacote os seus GenServers e supervisores numa aplicação OTP adequada e reúna-a numa versão implementável. Você pratica Erlang OTP: Distributed & Fault-Tolerant Systems Programming com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Erlang OTP: Distributed & Fault-Tolerant Systems Programming?

Nenhuma experiência prévia é necessária. Erlang OTP: Distributed & Fault-Tolerant Systems Programming no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.

Quanto tempo leva a aula “Criar Aplicações e Versões OTP”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Erlang OTP: Distributed & Fault-Tolerant Systems Programming?

Sim. Cada aula de Erlang OTP: Distributed & Fault-Tolerant Systems Programming inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Compreendendo OTP e comportamentos
  2. Implementação do comportamento GenServer
  3. Introdução aos supervisores
  4. Criar Aplicações e Versões OTP
← Voltar para Erlang OTP: Distributed & Fault-Tolerant Systems Programming