Compose sites
A site can be a whole Compose project: the app, its database, a worker. The same compose.yaml runs locally
with docker compose up and on the server with lf deploy. lf init writes one for an existing project:
lf init --postgres # compose.yaml (app + db + volume) and compose.override.yaml (local ports)
echo POSTGRES_PASSWORD=dev > .env # local only
docker compose up --build # http://localhost:3000
lf deploy -e POSTGRES_PASSWORD=$(openssl rand -hex 16) # the first time; later just lf deployA compose file with only a database or a cache in it, next to an app, is not a Compose site. landfall deploys the app and runs those services beside it (see Deploy a site).
services:
app:
build: .
env_file: [{ path: .env, required: false }]
environment:
DATABASE_URL: postgres://app:${POSTGRES_PASSWORD}@db:5432/app
depends_on: { db: { condition: service_healthy } }
x-landfall:
port: 3000 # Traefik serves the site's domains from here
admin:
image: adminer
x-landfall: { port: 8080, domains: [db.example.com] } # its own domains
db:
image: postgres:17-alpine
environment: { POSTGRES_USER: app, POSTGRES_DB: app, POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:?}" }
volumes: [db:/var/lib/postgresql/data]
healthcheck: { test: pg_isready -U app, interval: 5s }
volumes:
db:-
x-landfallon a service routes it:portis where Traefik sends requests,domainsgives it its own (a bare name or@works as in-d). One routed service withoutdomainsserves the site's domains, which-dandlf domainsmanage. Services withoutx-landfall(the database) stay off Traefik's network. -
More ports of one service:
routessends further ports to their own domains, andprivatenames ports that are never routed (reach them withlf tunnel <site> <name>).subdomain: adminservesadmin.<domain>for every domain of the site, and followslf domains:x-landfall: port: 3000 # the site's domains routes: - { port: 3001, subdomain: admin } # admin.<each site domain> - { port: 9000, domains: [s3.example.com] } private: cms: 3002 # lf tunnel blog cms manage: { port: 3003, path: /manage } # lf tunnel blog manage opens http://localhost:3003/manageA service with only private ports opens the one named like it (else its first) with
lf tunnel <site> <service>. -
Only from some addresses:
allowonx-landfall(for itsport) or on a route takes IP addresses and CIDR ranges; Traefik answers everyone else with 403 (anipallowlistmiddleware, checked before any login):x-landfall: port: 3000 routes: - { port: 3001, subdomain: admin, allow: [10.0.0.0/8, 203.0.113.7] }A route can also have its own login instead of the site's, or none:
lf auth -r admin -u anna,lf auth -r hooks --public(Day-to-day). -
A compose.yaml without
x-landfalldeploys as it is. landfall routes the HTTP ports its services publish (ports:) orexpose:: the first service withbuild:(else one on a usual web port) gets the site's domains with its first port, every other port a subdomain (<service>or<service>-<port>). Side tools (Adminer, phpMyAdmin, pgAdmin, Mailpit, MailHog, Portainer, Dozzle, Swagger UI…) never get the main domains, even when they come first. Databases, mail and other non-HTTP ports stay internal.lf deployprints this route plan and marks new routes; every routed port is public, so check it.lf initwrites the plan down asx-landfallin your compose.yaml (shows the diff), and anyx-landfallturns this off for the whole file. -
Published
ports:stay local. A published port would bypass Traefik and the firewall, so on the server the release's override resets them (ports: !reset []). Your compose.yaml is not changed, andlf initmoves them tocompose.override.yaml, whichdocker composemerges locally andlf deployleaves out. Withx-landfallset,ports:is refused instead; to publish a port on the server anyway, addx-landfall: { publish: true }to that service. -
Named volumes keep your data across deploys and rollbacks.
lf sites rmkeeps them, so deploying the site again finds its data;lf sites rm --volumesdeletes them (each backed up first,lf undobrings them back).lf volumebacks them up and copies them to and from your machine (Volumes and backups). Each deploy gets a new release folder, so a writable bind mount like./datais refused: write data to a named volume (read-only./dist:…:rois fine). -
Images built on the server are tagged
<site>-<service>:<release>, so a rollback runs the exact image again. -
Variables in
compose.yamlcome from the site's.envon the server (-e,--dotenv,lf env).${VAR:?}makes a missing one fail the deploy before anything changes. -
Your own
traefik.*labels win: a service with its own router keeps them and landfall adds only the network. -
-f other.yamldeploys another file from the project folder; it is saved in.landfall.json. Sites need Docker Compose 2.24 or newer on the server (lf update --compose).
The static, Dockerfile and image kinds are Compose sites too: landfall writes their compose.yaml for you.