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

Configuração de Versões e Scripts de Arranque

Domine sys.config e os scripts de arranque para configurar ambientes de aplicações e controlar a sequência exata de inicialização de uma versão Erlang.

Configuração de Versões e Scripts de Arranque é 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 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

Perguntas Frequentes

A aula “Configuração de Versões e Scripts de Arranque” é grátis?

Sim — o texto completo de “Configuração de Versões e Scripts de Arranque” é 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 “Configuração de Versões e Scripts de Arranque”?

Domine sys.config e os scripts de arranque para configurar ambientes de aplicações e controlar a sequência exata de inicialização de uma versão Erlang. 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 “Configuração de Versões e Scripts de Arranque”?

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. Criação de releases Erlang
  2. Carregamento e atualização dinâmica de código
  3. Versionamento e implantação de releases
  4. Configuração de Versões e Scripts de Arranque
← Voltar para Erlang OTP: Distributed & Fault-Tolerant Systems Programming