OTP-Anwendungen und Releases erstellen
Verpacken Sie Ihre GenServers und Supervisoren in eine vollständige OTP-Anwendung und bündeln Sie sie zu einem deploybaren Release.
OTP-Anwendungen und Releases erstellen ist eine kostenlose Erlang OTP: Distributed & Fault-Tolerant Systems Programming-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Erlang OTP: Distributed & Fault-Tolerant Systems Programming-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Erlang OTP: Distributed & Fault-Tolerant Systems Programming-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
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 foregroundWhy 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
.appfile describes metadata and the start module - The
applicationbehavior providesstart/2andstop/1 - Releases bundle app + runtime for reproducible deployment
Lerne Erlang mit einem KI-Tutor — kostenlos
Schreibe und führe echten Code in deinem Browser aus, bekomme sofortige Hilfe von einem 24/7 KI-Tutor und setze dein Lernen im Web oder in der App fort.
- Kurse
- 12
- Lektionen
- 48
Häufig gestellte Fragen
Ist die Lektion „OTP-Anwendungen und Releases erstellen“ kostenlos?
Ja — der vollständige Text von „OTP-Anwendungen und Releases erstellen“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Erlang OTP: Distributed & Fault-Tolerant Systems Programming-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Erlang OTP: Distributed & Fault-Tolerant Systems Programming-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „OTP-Anwendungen und Releases erstellen“?
Verpacken Sie Ihre GenServers und Supervisoren in eine vollständige OTP-Anwendung und bündeln Sie sie zu einem deploybaren Release. Du übst Erlang OTP: Distributed & Fault-Tolerant Systems Programming mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Erlang OTP: Distributed & Fault-Tolerant Systems Programming zu starten?
Keine Vorkenntnisse erforderlich. Erlang OTP: Distributed & Fault-Tolerant Systems Programming auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „OTP-Anwendungen und Releases erstellen“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Erlang OTP: Distributed & Fault-Tolerant Systems Programming-Lektion Code schreiben und ausführen?
Ja. Jede Erlang OTP: Distributed & Fault-Tolerant Systems Programming-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- OTP und Behaviors verstehen
- GenServer-Behavior implementieren
- Einführung in Supervisoren
- OTP-Anwendungen und Releases erstellen