Erlang 릴리스 만들기
rebar3 및 relx와 같은 도구를 사용하여 Erlang 애플리케이션, 종속성 및 Erlang 런타임을 독립 실행형 릴리스로 묶습니다.
Erlang 릴리스 만들기은(는) CoddyKit의 무료 Erlang OTP: Distributed & Fault-Tolerant Systems Programming 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Erlang OTP: Distributed & Fault-Tolerant Systems Programming 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Erlang OTP: Distributed & Fault-Tolerant Systems Programming 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
What are Erlang Releases?
When you develop an Erlang application, it's a collection of modules and configuration files. To deploy it, you need to package it all up.
An Erlang Release is a self-contained, deployable package of your application, its dependencies, and optionally, a specific version of the Erlang Runtime System (ERTS).
- It's like a standalone executable for your Erlang system.
- It simplifies deployment by bundling everything needed to run.
Benefits of a Release
Why go through the effort of creating a release? Releases offer significant advantages for production systems:
- Self-contained: Includes all necessary Erlang libraries and even the Erlang VM itself.
- Simplified Deployment: Just copy the release folder to a server and start it.
- Version Management: Each release has a clear version number, making upgrades and rollbacks easier.
- Foundation for Live Upgrades: Releases are essential for Erlang's famous 'hot code loading' feature (covered in a later lesson!).
Meet rebar3
Building Erlang applications and releases manually can be complex. Fortunately, we have rebar3!
rebar3 is the standard build tool for Erlang. It handles:
- Project creation and management
- Dependency resolution
- Compilation
- Testing
- And, crucially for this lesson, creating releases.
It streamlines the entire development and deployment workflow.
Your Erlang Application Code
Let's start with a very simple Erlang module. In a real application, this would be part of your overall system logic.
For demonstration, we'll create a module with a main/0 function, which can be run directly. This module will be included in our release.
-module(my_release_app).
-export([main/0]).
main() ->
io:format("Hello from my Erlang release application!~n").The Application Resource File
Every Erlang application has an application resource file (.app or .app.src). This file defines metadata about your application, such as its version, description, and which modules it depends on.
rebar3 uses the .app.src file to generate the final .app file during the build process.
{application, my_release_app,
[{description, "My simple release app"},
{vsn, "0.1.0"},
{registered, []},
{applications, [
kernel,
stdlib
]},
{mod, {my_release_app, []}},
{env, []}
]}.Configuring the Release
To tell rebar3 how to build your release, you add a relx section to your rebar.config file. This configuration specifies:
- The name and version of your release.
- Which applications to include.
- If the Erlang Runtime System (ERTS) should be bundled.
For development, we often don't include ERTS to save space.
{apps, [my_release_app]}.
{relx, [{release, {my_release_app, "0.1.0"}, [my_release_app]},
{dev_mode, true},
{include_erts, false},
{extended_start_script, true}]}.Building Your Release Bundle
With your application code, .app.src, and rebar.config in place, building the release is straightforward. rebar3 will compile your code, fetch dependencies, and package everything into a single directory.
This command does all the heavy lifting:
rebar3 releaseInside the Release Package
After running rebar3 release, you'll find your release in _build/default/rel/my_release_app/. The structure typically includes:
- bin/: Contains the start script for your application.
- lib/: All your application's compiled code and dependencies.
- releases/: Release definitions and version information.
- erts/: (Optional) The Erlang Runtime System if
include_ertswas true.
This organized structure makes deployment predictable and reliable.
Running Your Packaged App
Once built, you can start your Erlang application by executing the generated start script. This script handles starting the Erlang VM and loading your application.
Navigate to the release directory and use the bin/<release_name> script.
For our example, you would run (in a shell, not runnable in this environment):
_build/default/rel/my_release_app/bin/my_release_app startRelease Benefits Check
Creating an Erlang release is a crucial step for deployment. Which of the following are primary benefits of packaging an Erlang application as a release?
Recap: Erlang Releases
You've taken a big step towards deploying Erlang applications!
- Erlang Releases package your app, its dependencies, and optionally ERTS.
- rebar3 is the essential tool for building and managing releases.
- The
.app.srcandrebar.configfiles define your application and release. - Releases simplify deployment, versioning, and enable powerful features like live upgrades.
Next, we'll dive into the fascinating world of hot code loading and how to perform live upgrades on running systems!
자주 묻는 질문
“Erlang 릴리스 만들기” 강의는 무료인가요?
네 — “Erlang 릴리스 만들기” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Erlang OTP: Distributed & Fault-Tolerant Systems Programming 강의 전체를 잠금 해제할 수 있습니다. Erlang OTP: Distributed & Fault-Tolerant Systems Programming 강의에는 총 4개의 강의가 포함되어 있습니다.
“Erlang 릴리스 만들기”에서 뭘 배우나요?
rebar3 및 relx와 같은 도구를 사용하여 Erlang 애플리케이션, 종속성 및 Erlang 런타임을 독립 실행형 릴리스로 묶습니다. 브라우저에서 직접 실행하는 실습 코드로 Erlang OTP: Distributed & Fault-Tolerant Systems Programming을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Erlang OTP: Distributed & Fault-Tolerant Systems Programming을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Erlang OTP: Distributed & Fault-Tolerant Systems Programming은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.
“Erlang 릴리스 만들기” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Erlang OTP: Distributed & Fault-Tolerant Systems Programming 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Erlang OTP: Distributed & Fault-Tolerant Systems Programming 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- Erlang 릴리스 만들기
- 핫 코드 로딩 및 업그레이드
- 릴리스 버전 관리 및 배포
- 릴리스 구성과 부팅 스크립트