Skip to content
landfall

Several servers

A site can run on more than one server. landfall deploys it to every server of a group, reads the group as one, and undoes a group deploy on every server.

Everything here is opt-in. A .landfall.json without servers works exactly as before.

When you need it

One server is enough for most sites. Several servers keep a site up when one fails, and let you restart one server while the others serve. They cost more: you run more servers, and state (databases, uploads, sessions) has to live somewhere they all reach.

Words used here

wordmeaning
groupthe servers a site runs on: servers in .landfall.json. The order counts.
primarythe first server of the group. The others are compared with it. Hooks that must run once will run there.
driftthe servers of a group differ: another release, another scale, another .env, or no site at all.
diagramdiagram

Name the servers

List the servers in .landfall.json instead of server:

{
  "name": "blog",
  "servers": ["vps1", "vps2"],
  "domains": ["blog.example.com"]
}
  • Each name must be a server landfall knows (lf server add).
  • A name may appear once. server and servers together are refused.
  • An environment can set its own server or servers. Either one replaces the project's.
  • lf deploy, lf history, lf undo and the site commands work on the whole group. See Change a group.

Pages

pagewhat
Deploy to a groupone release to every server, what it refuses, services on the primary only, part of a group, certificates
Sync and drifthow landfall finds servers that differ, and lf sync to bring them back in line
An edge in frontone landfall server that holds the domains and spreads requests over the group
A private networklf network: a WireGuard network between the servers and the edge
Groups in the web UIthe group view, the Edge card, and where a change goes

Read a group

These commands read every server of the group at once. Run them in the project folder, or name the servers with -s a,b.

# release, state and replicas on each server, and what differs
lf sites info blog
# the same as JSON (a GroupSiteView)
lf sites info blog -s vps1,vps2 --json
# the logs of every server, each line after its server's name
lf logs blog -n 50
# an HTTPS request to each server by its address, not by DNS
lf check blog
  • A server that does not answer within 15 seconds shows as unreachable. The others are not held up.
  • -s <one server> reads only that server, as before.
  • lf check on a group sends each request to the server's own address (as --resolve). It exits 1 when one fails.
  • A tenant login reads one server at a time. Group reads need each server's admin.

Change a group

The site commands run on every server of the group, one after the other. Run them in the project folder, or name the servers with -s a,b.

# set a variable on every server
lf env blog API_URL=https://api.example.com
# three web containers on every server: six on two servers
lf scale blog web=3
# the previous release on every server
lf rollback blog
howcommands
every server; a failure puts the others backenv, secret, domains, auth, scale, weight, autoscale, rollback
every server; a failure stopsrestart, stop, start, release rm, sites rm
every server at once, a block per serverls, stats, disk, traffic, certs
the primary onlytunnel, open, eject, volumes, volume …
refusedadopt, autodeploy
  • One command is one run on every server. lf undo <run id> reverts it on each one.
  • When a server fails, the change goes back on the servers before it and on the failed one. The error names the servers not tried.
  • restart, stop, sites rm and the others in that row leave the servers before a failed one as they are. They stop at the failed server and name the servers already done.
  • sites rm, release rm and domains ask once before they remove something. Every server is read first, and nothing changes until you answer. A server with nothing to remove is not asked.
  • lf autoscale blog without rules reads every server: the rules, each server's count and the total.
  • ls, stats, disk, traffic and certs: a server that does not answer gets its error in its block. The others still show, and the command exits 1.
  • --json, --pull and lf stats --watch read the primary. Pass -s <server> to read another.
  • Values read from stdin (--dotenv -, --password-stdin) are read once and go to every server.
  • -s <one server> changes that server only. landfall warns that the group drifts.
  • Without the project's .landfall.json, a change on one server reads the server's site.json. If the site runs on several servers, landfall warns and names them.
  • Server commands (firewall, users, keys, traefik, harden, update and the like) work on one server. In a group's folder, they ask for it: pass -s <server>.

History and undo

Each server keeps its own journal and numbers its runs itself. A group deploy has one run id on every server.

# the runs of every server; a run on several servers is marked as a group run
lf history
# revert the newest group run on every server
lf undo
# revert a group run by its id, the primary last
lf undo mih3k2x1ab12
# one server's run #4
lf undo 4 -s vps2
  • lf history shows a server that does not answer as vps2: ?, and the runs of the others. With --json, that server has an error.
  • A run number means nothing across servers. On a group, lf undo takes a run id, or none for the newest group run.
  • lf undo -s vps2 reverts on that server only. landfall warns that the group drifts.
  • It checks every server before it changes one, then asks once.
  • If a server fails, it stops and names the servers not reverted yet. Run the same lf undo again.

Limits

  • Site commands change one server after the other. For a moment, the servers differ.
  • lf sync does not revert the servers it already changed when one fails. It names them.
  • Without an edge, every server serves the domains. Your DNS or load balancer decides which server a visitor reaches.
  • The edge is one server. If it fails, the site is down: it is the single point of failure in front of the group.
  • No groups for tenant logins.
  • Volumes are not shared between servers.