다운타임 없는 배포와 핫 업그레이드
롤링 배포, 상태 점검, BEAM의 핫 코드 업그레이드 기능을 사용해 연결을 끊지 않고 새로운 Elixir 릴리스를 배포하는 방법을 배웁니다.
다운타임 없는 배포와 핫 업그레이드은(는) CoddyKit의 무료 Elixir & Phoenix: Scalable Backend Development 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Elixir & Phoenix: Scalable Backend Development 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Elixir & Phoenix: Scalable Backend Development 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Why Zero Downtime Matters
Restarting a server drops in-flight requests and live WebSocket connections. Zero-downtime deploys roll out new code while users stay connected and unaware.
Two Strategies
The BEAM supports two upgrade paths:
- Rolling deploys: start new nodes, drain old ones — simple and common
- Hot code upgrades: swap code inside a running node without restart — powerful but complex
Rolling Deploys
A rolling deploy boots a new release alongside the old, shifts traffic over via a load balancer, then shuts the old one down. Most teams use this because it is straightforward and tooling-friendly.
Health Check Endpoints
Load balancers need to know when a new node is ready. Expose a lightweight health endpoint that returns 200 only when the app can serve traffic.
get "/healthz", HealthController, :check
# def check(conn, _), do: send_resp(conn, 200, "ok")Connection Draining
Before stopping an old node, stop accepting new requests but let active ones finish. This draining avoids cutting users off mid-request.
config :my_app, MyAppWeb.Endpoint,
drainer: [shutdown: 30_000]Database Migrations Safely
Old and new code run side by side during a rolling deploy, so migrations must be backward compatible. Add columns before using them; never rename or drop in a single deploy.
Hot Code Upgrades
The BEAM can replace a module's code in a live system. :code.load_file/1 loads the new version; running processes switch over on their next function call.
:code.purge(MyModule)
:code.load_file(MyModule)Appups and Relups
For full hot upgrades of a release, the BEAM uses appup files (per-application upgrade instructions) and relup files (release-level). Tools like Distillery could generate these.
code_change Callbacks
A long-lived GenServer can migrate its state during a hot upgrade via the code_change/3 callback, reshaping old state into the new format.
def code_change(_old_vsn, state, _extra) do
{:ok, Map.put(state, :version, 2)}
endTrade-offs
Hot upgrades avoid any restart but are hard to test and reason about. Most teams prefer rolling deploys for predictability, reserving hot upgrades for embedded or always-on telecom-style systems.
Rollback Plans
Always have a rollback ready:
- Keep the previous release artifact
- Make migrations reversible or additive only
- Automate rollback in your deploy pipeline
Quick Check
Test your zero-downtime knowledge.
Recap
You learned zero-downtime deployment:
- Rolling deploys drain old nodes while new ones serve
- Health checks tell the load balancer when a node is ready
- Migrations must be backward compatible
- Hot code upgrades swap code live via appup/relup and
code_change - Always keep a rollback plan
Users stay connected through every release.
자주 묻는 질문
“다운타임 없는 배포와 핫 업그레이드” 강의는 무료인가요?
네 — “다운타임 없는 배포와 핫 업그레이드” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Elixir & Phoenix: Scalable Backend Development 강의 전체를 잠금 해제할 수 있습니다. Elixir & Phoenix: Scalable Backend Development 강의에는 총 4개의 강의가 포함되어 있습니다.
“다운타임 없는 배포와 핫 업그레이드”에서 뭘 배우나요?
롤링 배포, 상태 점검, BEAM의 핫 코드 업그레이드 기능을 사용해 연결을 끊지 않고 새로운 Elixir 릴리스를 배포하는 방법을 배웁니다. 브라우저에서 직접 실행하는 실습 코드로 Elixir & Phoenix: Scalable Backend Development을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Elixir & Phoenix: Scalable Backend Development을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Elixir & Phoenix: Scalable Backend Development은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“다운타임 없는 배포와 핫 업그레이드” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Elixir & Phoenix: Scalable Backend Development 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Elixir & Phoenix: Scalable Backend Development 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- Mix Release로 릴리스 빌드하기
- Docker를 활용한 컨테이너화
- 클라우드 배포 전략
- 다운타임 없는 배포와 핫 업그레이드