Failover
When a node dies or an app stops responding, the Hub moves the app to another node by itself. In testing, an app on a node that was switched off was reachable again from another node about 40 seconds later.
How it works
Section titled “How it works”- Health checks. Every 10 seconds the Hub requests
/healthfrom each running app over the private network. Any answer below 500 counts as up (so an app without a/healthroute, answering 404, is fine). No answer within 3 seconds, a 5xx error, or an offline node counts as a failure. - Three strikes. After 3 failures in a row (about 30 seconds) the app is failed over. One slow response or a quick restart does not move it. Meanwhile the project shows degraded.
- Pick a node. The Hub picks the best online node other than the current one, preferring the master node: see how the target node is chosen.
- Redeploy. The app is deployed there the normal way — same image, secrets and settings. While this happens the project shows migrating.
- Switch. Once the new copy runs, the domain route points at it.
How the target node is chosen
Section titled “How the target node is chosen”Only nodes that are online, not in maintenance, not the app’s current node, and that haven’t failed to take this app in the last 30 minutes are candidates. They’re ranked like this:
- Room first. Nodes with at least 10% of their memory and 5% of their disk free come before those without. If no node has room, the best of the rest is still used rather than none.
- The master node next, if it has room.
- Then a score: the node’s health score blended with how reliably it has stayed up, minus a penalty for recent drops. Uptime counts for more than the health score (60% against 40%), and each 1% a node was down in the last 7 days costs 3 points of its uptime part. Each outage in the last 24 hours takes off a further 15 points. A node with no uptime record yet is judged on its health score alone.
- Ties go to the node whose name comes first.
So a laptop that looks healthy right now but dropped three times today loses
to a steady server with a lower health score. See
Node availability and load for where those numbers come
from, and asdl-hub move <app> to see the ranking for an app.
A bad release
Section titled “A bad release”A new version that never comes up isn’t a node failure, and moving it to another node wouldn’t help. When an app starts failing within 10 minutes of a deploy that changed its image, the Hub puts the previous version back instead: see Roll back a deploy.
If the new node fails too
Section titled “If the new node fails too”A node that fails to take over the app (the deploy fails, or it doesn’t pick up the job within a minute) is skipped for that app for 30 minutes, and the next health check failure tries the next node.
When no node is left, the project is marked failed. It is not retried automatically after that; deploy or Redeploy it once a node is available.
When the dead node comes back
Section titled “When the dead node comes back”The Hub queues removal of the app’s old container on the dead node. As soon as that node is back online, it removes the stale copy — so the app never ends up running twice. The app stays on its new node.
Master node
Section titled “Master node”In Settings → Master node you can choose a preferred node. While it is online, projects are kept on it (moved there if they run elsewhere) and it is the first choice for failovers. When it goes offline, the best other node is used instead, as ranked above.
What failover doesn’t do
Section titled “What failover doesn’t do”- It isn’t zero-downtime. Only one copy of an app runs at a time, so expect about 30–60 seconds of downtime while it moves.
- It doesn’t move data stored on the node’s disk (volumes). Keep data in an external database or storage.
- It can’t protect against the Hub server going down. All traffic comes in through the Hub, so if its server is down, every app is unreachable. Nodes keep running their containers, and routing resumes when the Hub is back.