Try it locally
You can try landfall without renting a server. A Docker container on your machine plays the server. It runs Ubuntu with systemd, sshd, ufw and its own Docker, like a fresh VPS. landfall cannot tell the difference: setup, deploys, rollbacks, undo, groups, edges, tenants and the web UI all work.
You need Docker and Node 22.4 or newer. The first part takes about five minutes.
| part | what you do |
|---|---|
| Steps 1 to 5 | start one test server, set it up, deploy a site, look around |
| Several servers | one site on two servers, with a third one in front that balances them |
| Tenants | give another person their own Docker on the test server |
| Clean up | remove every test server |
1. Get lf and the helpers
# the published CLI
npm i -g landfall
# everything this page creates lives in ~/landfall-try
mkdir -p ~/landfall-try && cd ~/landfall-try
# a few shell helpers for test servers; read it first, it is short
curl -fsSLO https://raw.githubusercontent.com/ph1p/landfall/main/test/e2e/ubuntu/try.sh
# load them into this shell
. ./try.shLoading try.sh does three things:
- It points lf at
~/landfall-tryfor this shell. Your real servers in~/.config/landfalland~/.ssh/configstay untouched. - It creates the key
~/landfall-try/key, which only the test servers accept. - It defines these commands:
| command | what it does |
|---|---|
try_up <name> <ssh port> <https port> | starts a test server, the container landfall-try-<name>. The first time, it builds the image. |
try_cert <name> | gives the server's Traefik a self-signed certificate for *.localhost |
try_ip <name> | prints the server's address on Docker's network |
try_files <name> | copies the server's /opt/landfall to ~/landfall-try/files/<name> |
try_down | removes every test server |
In a new shell, run cd ~/landfall-try && . ./try.sh again.
Check:
# prints the installed version
lf --version2. Start a test server
# the test server "demo": ssh on port 2201, HTTPS on port 8443
try_up demo 2201 8443The first run builds the image landfall-try. That takes a few minutes.
try_up ends with ready and prints the setup command for the next step.
The ports listen on your machine only.
3. Set up the server
# set it up: deploy user, ufw, Docker check, Traefik, ssh alias "demo"
lf setup demo --host 127.0.0.1 --port 2201 --key ~/landfall-try/key --email you@example.com --staging -y
# Let's Encrypt cannot reach a container on your machine: a self-signed certificate instead
try_cert demo--staginguses Let's Encrypt's test service.- Names under
.localhostalways point at your own machine. No DNS is involved. - The security notes at the end of setup (loose kernel settings, waiting updates) are expected here.
- Setup creates the user
deploy. From now on, landfall logs in asdeploy, as on a real server.
Check:
# the server, its OS, Docker and Traefik
lf server info demo4. Deploy a site
# a static site: a folder with an index.html
mkdir -p ~/landfall-try/hello && cd ~/landfall-try/hello
echo '<h1>hello from landfall</h1>' > index.html
# deploy it to the test server
lf deploy -s demo -d hello.localhost -ydeploy ends with a warning that it could not reach https://hello.localhost.
It checks port 443, but the test server listens on 8443. The site is fine.
Check:
# prints <h1>hello from landfall</h1>; -k because the certificate is self-signed
curl -k https://hello.localhost:8443In a browser, open https://hello.localhost:8443 and accept the certificate warning.
The site remembers its domain. Deploy a second release:
# a new release; the old one stays for rollback
echo '<h1>version 2</h1>' > index.html && lf deploy -yRight after a deploy, the site can answer 404 page not found for a few seconds.
Traefik needs that long to notice the new container.
5. Look around
lf ls # sites on the server
lf sites info hello # services, domains and every release
lf logs hello # container logs
lf rollback hello -y # back to the previous release
lf history # every change landfall made on the server
lf undo # take back the last one
lf ssh demo # a shell on the test server
lf ui # the web UI in your browserEverything landfall keeps on the server is a plain file under /opt/landfall.
Copy it to your machine and look:
# copy the server's files, then list them without the release contents
try_files demo && find ~/landfall-try/files/demo -maxdepth 4 -not -path '*/releases/*/*'| path | what |
|---|---|
README | what the folder is, for whoever logs in after you |
journal.log | every change landfall made. lf history reads it, lf undo replays its undo commands |
landfall.json | the server's landfall settings |
traefik/ | Traefik's Compose project and config |
sites/hello/releases/ | one folder per deploy, named by date and time |
sites/hello/current | a symlink to the live release |
sites/hello/site.json | the site's domains, services and release history |
The copy does not follow later changes. Run try_files demo again for a fresh one.
Editing the copy changes nothing on the server.
Any project deploys the same way: a Node app, a Dockerfile, a Compose file. See Deploy a site. Nothing can break: the server is a container you throw away.
Optional: several servers
One site can run on a group of servers, with an edge in front that balances them. You start three more test servers:
vps1andvps2form the group. Both run the site.vps1is the primary.edge1is the edge. It holds the domain and sends each request to one of the two.
The test servers reach each other on Docker's network, as on a private network.
You do not need lf network here.
Start the servers
# three more test servers
try_up vps1 2202 8444
try_up vps2 2203 8445
try_up edge1 2204 8446
# set up each one, as in step 3
lf setup vps1 --host 127.0.0.1 --port 2202 --key ~/landfall-try/key --email you@example.com --staging -y
lf setup vps2 --host 127.0.0.1 --port 2203 --key ~/landfall-try/key --email you@example.com --staging -y
lf setup edge1 --host 127.0.0.1 --port 2204 --key ~/landfall-try/key --email you@example.com --staging -y
# the edge ends HTTPS for the domain, so it needs the certificate
try_cert edge1
# vps1 and vps2 trust the edge: they take the visitor's address from its headers
lf traefik behind $(try_ip edge1) -s vps1 -y
lf traefik behind $(try_ip edge1) -s vps2 -yCheck:
# lists demo, vps1, vps2 and edge1
lf server lsDeploy to the group
The site is whoami, a small server that answers with its container's name. That shows which server answered.
# a Compose project
mkdir -p ~/landfall-try/shop && cd ~/landfall-try/shop
cat > compose.yaml <<'EOF'
services:
web:
image: traefik/whoami
x-landfall:
port: 80
tls: lb
healthcheck: { path: / }
EOF
# the group: vps1 comes first, so it is the primary
echo '{"servers": ["vps1", "vps2"]}' > .landfall.json
# one release, on vps1 first, then on vps2
lf deploy -d shop.localhost -ytls: lbmeans a load balancer in front ends HTTPS.- The edge checks the health check path on each server.
deploywarns that it could not reachhttps://shop.localhost. The edge is not in place yet.
Check:
# both servers run the same release; the state is "ok"
lf sites infoPut the edge in front
# edge1 holds shop.localhost and balances vps1 and vps2
lf edge add edge1 -yedge add warns that shop.localhost has no DNS record. Names under .localhost need none.
Check:
# four requests through the edge: two container names, taking turns
for i in 1 2 3 4; do curl -sk https://shop.localhost:8446 | grep Hostname; doneIf curl prints nothing, wait a few seconds. The edge needs them to load its new route.
Work with the group
Run these in ~/landfall-try/shop. .landfall.json names the group and the edge.
lf edge # each server's weight, state and health
lf edge shop vps2=off -y # the edge sends nothing to vps2; curl shows one name
lf edge shop vps2=on -y # vps2 takes requests again
lf scale shop web=3 -s vps1 -y # three web containers on vps1 only
lf sites info # reports drift: vps2 runs one
lf sync -y # vps2 follows the primary
lf deploy -y # the edge takes each server out while it switches
lf history -s vps1 # a group deploy is one run on every serverSee Deploy to a group, Sync and drift and An edge in front. In the web UI, the site shows as a group with an Edge card. See Groups in the web UI.
Optional: tenants
Tenants give other people their own rootless Docker on your server. The test server has everything they need (Requirements).
You play two people here:
- you, the admin, with the server
demofrom step 3. - anna, the tenant. landfall creates the Linux user
annaondemo. She logs in with her own key,~/landfall-try/anna.
# anna's key pair: the public half goes to the admin, the private half is her login
ssh-keygen -q -t ed25519 -N "" -f ~/landfall-try/annaAdd the tenant with lf
# you: add anna with her key and domains
lf tenant add anna -s demo --key ~/landfall-try/anna.pub -d anna.localhost -d '*.anna.localhost' --force
# anna: register her login and start her Traefik
lf server add anna --host 127.0.0.1 --port 2201 --user anna -i ~/landfall-try/anna
lf traefik setup -s anna --email you@example.com --staging -yThe first tenant needs --force: it moves Traefik to the host network, which restarts it.
Or add the tenant in the web UI
Start lf ui from a shell that loaded try.sh. Otherwise, the UI writes to your real config.
-
As you, open Tenants on
demoand click Add tenant:field value User annaPublic key the output of cat ~/landfall-try/anna.pubDomains anna.localhost *.anna.localhostThe first tenant restarts Traefik. The UI asks you to confirm. The invite it shows next is for a real tenant. Here, anna's key is
~/landfall-try/anna. -
As anna, click Add server:
field value Name annaAddress 127.0.0.1User annaSSH port 2201Private key file ~/landfall-try/annaUncheck Set it up now. A tenant cannot set up the server.
-
Open Traefik on
annaand click Install it. This starts anna's own Traefik.
Deploy as anna
# a self-signed certificate for anna's domains, in anna's Traefik
try_cert demo anna
# deploy the hello site as anna
cd ~/landfall-try/hello && lf deploy -s anna -d blog.anna.localhost -yThe central Traefik passes blog.anna.localhost to anna's Traefik, still encrypted.
Check:
# the hello page, served by anna's Traefik
curl -k https://blog.anna.localhost:8443
# only anna's sites; lf ls -s demo does not show them
lf ls -s annaClean up
# remove every test server and its data
try_down
# remove keys, config, sites and copied files
rm -rf ~/landfall-tryOpen a new shell to work with your real servers again.
Troubleshooting
| problem | fix |
|---|---|
try_up: command not found | The shell has not loaded the helpers. Run cd ~/landfall-try && . ./try.sh. |
port is already allocated | Another program uses the port. Pick another one in try_up, and use the same ssh port in --port. |
Conflict. The container name … is already in use | That test server exists. Use it, or remove all of them with try_down. |
try_up never says ready | The container needs --privileged, which some Docker setups refuse. Check docker logs landfall-try-demo. |
hello.localhost does not resolve | Some systems do not resolve *.localhost. Add 127.0.0.1 hello.localhost to /etc/hosts. |
curl: (35) or a TLS error | Traefik answers only names it has a certificate for. Run try_cert demo again. |
404 page not found | Right after a deploy, wait a few seconds. Otherwise check the domain with lf sites info hello. |
REMOTE HOST IDENTIFICATION HAS CHANGED | A new container has a new host key. Run rm ~/landfall-try/known_hosts. |
vps1 does not trust the edge | Run lf traefik behind $(try_ip edge1) -s vps1 -y. |
Permission denied (publickey) as anna | The server anna uses the wrong key. It needs ~/landfall-try/anna. |
anna cannot run a command | Tenants run only their own commands. Server-wide commands need the admin server, demo. |
Try your own changes
In a checkout of the repository, use your build of lf and load the helpers from the checkout:
# lf from the checkout, for this shell
pnpm install && pnpm build && alias lf="node $PWD/dist/cli.mjs"
# the helpers; the image is built from this checkout
docker build -t landfall-try test/e2e/ubuntu && . test/e2e/ubuntu/try.shlandfall's end-to-end tests use the same image:
# every section against fresh containers
pnpm e2e
# setup, then only these sections and what they build on
E2E_ONLY="multi edge" pnpm e2e