Getting started

A fresh Ubuntu 26.04 host with Docker installed, from init to its first app. The output below comes from test hosts, shown as myhost with the account admin.

1. Answer the questions

seawall init

On a terminal a first init asks up to four questions. Type a number and press enter, or press enter for the default.

How should stacks run?
  › 1 Compose: no Portainer, each stack's secrets in a 0600 .env beside it
    2 Portainer: a web editor, each stack's secrets in its database
  [1]
Which reverse proxy?
  › 1 Nginx Proxy Manager: hosts and certificates in a web UI
    2 Traefik: routes from container labels
    3 Caddy: routes in a Caddyfile
    4 None: nothing on ports 80 and 443
  [1]
Leave anything out?
    1 monitoring  Prometheus, Grafana, cAdvisor and node-exporter (security facts and the image check need it)
    2 crowdsec    attack detection on the SSH and proxy logs, bans in nftables
    3 firewall    ufw rules for SSH, HTTP, HTTPS and metrics
    4 updates     daily security updates
  [none] numbers to leave out:
QuestionChoicesFlag
How should stacks run?Compose or Portainer--manager compose, --manager portainer
Which reverse proxy?Nginx Proxy Manager, Traefik, Caddy or none--proxy npm, traefik, caddy, none
Who runs the reverse proxy?Compose or PortainerNo flag. Set npm = "portainer" under [manager.stacks]
Leave anything out?monitoring, crowdsec, firewall, updates--skip STEP

A flag answers its question. A question is also skipped when a proxy already runs, or when the host has a config. A host with a Portainer container and no manager in its config is asked how stacks run even so, and off a terminal it needs --manager. The proxy question comes only with Portainer and a proxy to start. Its answer goes under [manager.stacks]. Off a terminal the proxy runs with Compose unless that entry says otherwise. Leaving monitoring out also leaves out the security facts and the image check, since both publish through node-exporter. seawall commands are the same with Portainer or Compose. With Compose each stack's secrets are in a 0600 .env beside its compose file. stack migrate moves a running stack between the two. This walkthrough takes the defaults.

2. Read the plan

> Setting up myhost (Ubuntu 26.04.1 LTS)
Docker
  ✓ Docker Engine 29.9.0 and Compose 5.6.0, from Docker's apt repo
  → cap each container's log at 10 MB × 3 files, so logs can't fill the disk
  → add admin to the docker group, so seawall can run Docker without sudo
  → create the proxy network, which the proxy reaches apps on
Stacks
  ✓ Compose runs each stack from its folder in ~/docker
  → run Nginx Proxy Manager as the way in for web apps
  → run Prometheus, Grafana, cAdvisor and node-exporter for graphs and alerts
  → run Loki and Alloy, so the host's logs are kept and the log alerts can read them
  → run CrowdSec to spot addresses that attack SSH and the proxy
  ✓ every stack lives in ~/docker
Host
  → check this host's security facts every minute (each part on its own interval), for the alert rules
  → check every running container for a newer image, daily at 06:00 UTC
  → add ufw rules: only SSH, HTTP and HTTPS come in once ufw is on
  → install security updates automatically every day
…
sudo asks for your password for the steps root does.
Carry out these steps? [y/N]

Lines with ✓ are in place already. Lines with → are the steps to carry out. Answer y to go ahead. Any other answer prints "nothing changed" and writes nothing. ~/docker is the default stacks folder. paths.stacks sets another.

3. Run init

After y, seawall writes your answers to ~/.config/seawall/seawall.toml as manager.default, proxy.kind and [init] skip. Then it runs the steps one at a time. sudo asks for your password for the steps root does. On a new host it stops after the docker group.

Carry out these steps? [y/N] y
==> cap each container's log at 10 MB × 3 files, so logs can't fill the disk
✓ container logs are capped at 10m × 3 files
==> add admin to the docker group, so seawall can run Docker without sudo
! admin is in the docker group, but this login started before that: log out and back in, then run `seawall init --yes` again (the steps done show ✓)

Log out, log back in and run seawall init --yes. It asks no questions and keeps your answers. With Portainer it asks for an admin password, or reads SEAWALL_PORTAINER_PASSWORD.

…
✓ seawall facts runs every minute
✓ seawall images check runs daily at 06:00 UTC
✓ wrote /home/admin/.config/seawall/seawall.toml
Next: the web UIs listen only on this host's 127.0.0.1. From your own machine:
  Nginx Proxy Manager: ssh -N -L 8181:127.0.0.1:81 admin@myhost, then http://localhost:8181/
    login: the email and password you set on its first page
  Grafana: ssh -N -L 3000:127.0.0.1:3000 admin@myhost, then http://localhost:3000/
    login: admin, password GF_SECURITY_ADMIN_PASSWORD in the .env beside monitoring's compose file

The web UIs listen on 127.0.0.1 only. Run the ssh -N -L line it prints from your machine to open one. Later runs of init leave out what [init] skip lists. seawall init --only crowdsec still runs a step you left out.

Off a terminal init asks nothing. Without --yes it prints the plan. With --yes it carries it out, taking its answers from the flags and the config.

4. Check the host

seawall status
seawall doctor
seawall security

status lists what needs attention. status --watch reads it again after each change Docker reports. On a new host init starts the first update check as it installs the timer. Its results show when that run ends. seawall images check runs it again.

5. Add an app

seawall new

The wizard asks what you are making, then the image. For this host the answers were an app behind the proxy, louislam/uptime-kuma:2.5.6, the domain status.example.com and the data folder /app/data. Each other question kept its default. At the end it shows the compose file and lints it.

✓ passes the hardening lint (0 warnings)
Write these files? [y/N] y
✓ wrote /home/admin/docker/uptime-kuma
Next: `seawall stack new uptime-kuma` (dry run), then add --yes to create it
seawall stack new uptime-kuma         # the plan
seawall stack new uptime-kuma --yes
uptime-kuma: a new stack run by Compose from ~/docker/uptime-kuma; env from this shell: none (kept in ~/docker/uptime-kuma/.env, mode 0600)
  volume uptime-kuma_data: made first and handed to 1001:1001, the user uptime-kuma runs as
✓ uptime-kuma_data is 1001:1001's
✓ healthy                                                                 2.4s

Then add a proxy host for the domain in Nginx Proxy Manager. Forward it to uptime-kuma:3001 over the proxy network.

6. List the stacks

seawall stack ls
STACK               BY         STATE    UP   UPDATE  SAFETY  DISK
seawall-logging     compose  running  3/3          ✓       same
seawall-monitoring  compose  running  5/5          ✓       same
seawall-security    compose  running  1/1          ✓       same
uptime-kuma         compose  running  1/1          ✓       same
npm                 compose  running  1/1          ✓       same

Next read How commands work and Stacks.

init steps

seawall init         # the plan
seawall init --yes   # runs the missing steps

init is tested on Ubuntu 26.04 and Debian 13. Each step checks first. A step already in place shows ✓ and is left alone. With --yes it runs the missing steps one at a time and stops at the first that fails. Run it again to carry on from there. Joining the docker group needs a new login. init stops there once.

StepWhat it sets up
dockerChecks Docker Engine and Compose are installed. You install Docker yourself. init links Docker's guide and stops without it.
runtime-accessWith runtime.owner set, gives its rootless runtime a socket the access group reaches. Each member has that runtime's power over its containers.
runtimeSays which runtime seawall uses. --runtime switches it through a Docker context.
logsCaps each container's log at 10 MB × 3 files.
live-restoreAn offer. A plain run names it and changes nothing. --only live-restore --yes turns it on in daemon.json, keeps the old file in ~/backups/host/ and reloads Docker without restarting a container. Swarm mode can't be used with it.
docker-rebindInstalls seawall-docker-rebind.service, part of docker.service. An upgrade of Docker makes a new socket file, and a container that bind-mounts the old one can't reach Docker. After each start of the engine the unit restarts those containers, as you, each said first in the journal. Nothing is redeployed or pulled, and Docker itself is never restarted.
log-levelAn offer. Docker logs at info unless daemon.json asks for debug. --only log-level --yes sets info. Docker reads it at its next restart, or at once where live-restore is on or nothing runs. A value you set by hand is kept.
userland-proxyAn offer on Docker 28 or later. Off, published ports go through iptables alone. It's a severe change, as IPv6 visitors to a container without IPv6 are lost, so on a terminal you type ipv6 to make it. Off a terminal --confirm ipv6 takes its place. It's refused while a port is published on [::1]. Docker restarts to take it, keeping the old daemon.json in ~/backups/host/. With live-restore on, init then names any container that lost Docker's DNS and the command that mends it.
groupAdds you to the docker group.
networkCreates the proxy network the reverse proxy reaches apps on.
managerRuns stacks with Compose from their folders. --manager portainer runs Portainer with an admin password you choose instead.
proxyRuns Nginx Proxy Manager on ports 80 and 443. --proxy traefik, caddy or none picks another.
monitoringRuns Prometheus, Grafana, cAdvisor and node-exporter with seawall's alert rules, in the stack seawall-monitoring. A host set up before keeps monitoring. monitoring.stack names another stack they run in.
loggingRuns Loki and Alloy beside seawall's monitoring, in the stack seawall-logging (logging on a host set up before). Logs are kept 30 days by default. Loki sits on its own network with only Alloy and Grafana, and nothing can delete its logs.
infra-routesWith monitoring.grafana_url or portainer.url set, routes Grafana and Portainer through the host's proxy. Portainer is root on the host, so it gets a route only behind an access list from portainer.allow, at most one public /16 or /48 without a typed confirm. An empty list turns its route off.
notificationsRoutes sev0 and sev1 to the Pages destinations at once, sev2 and sev3 to the Rollup destinations at 09:00.
crowdsecRuns CrowdSec on the SSH and proxy logs, in the stack seawall-security (crowdsec on a host set up before). Installs its nftables bouncer from CrowdSec's apt repo, signed by a key pinned in seawall.
crowdsec-apiAdds a read-only bouncer so the Security tab reads bans from CrowdSec's API.
crowdsec-hubKeeps CrowdSec's hub items current every day. An item you edited is named and kept, and CrowdSec keeps its decisions through the reload.
stacksChecks every stack lives in the stacks folder.
run-usersChecks the uid range for stacks' own users is free on this host.
factsInstalls the timers that run seawall facts every minute. Its root unit also copies the host files cloud.host_files lists, for the config backup.
auditInstalls auditd from the distribution's archive with seawall's three rule files. The third watches writes to Docker's and containerd's own files, outside /var/lib/docker. If other rules already watch the same files, the step stops.
rulesKeeps seawall's alert rule files to this version's, as monitoring.packs picks them.
backupsInstalls the nightly database backup timer.
imagesInstalls the daily image update check at 06:00 UTC and the hourly automatic-update timer, which takes nothing until [updates.auto] sets a level.
firewallAdds ufw rules for SSH, HTTP, HTTPS (443/udp with Caddy) and the metrics scrape, where ufw has no other rules, and leaves ufw off. Keep your login open, run sudo ufw enable, then open a new SSH login; if it fails, run sudo ufw disable.
updatesTurns on daily security updates.
host-upgradeAn offer. Upgrades Docker's and CrowdSec's packages, which unattended-upgrades skips. --only host-upgrade --yes takes it. Docker's upgrade restarts every container, so you type docker to confirm.
upgradesAsks, on a terminal, whether Docker, the CrowdSec bouncer and Tailscale upgrade unattended: Docker off, patch releases only (live restore keeps the containers running) or every release, the bouncer and Tailscale on or off. Tailscale is asked only where it is installed. Its upgrade restarts tailscaled, so a session over it drops for a few seconds. Unchosen, nothing is written. The choice is [host.auto_upgrades] in seawall config, and seawall's two apt files follow it. Root's record and rollback (Root and sudo) cover Docker and the bouncer. For 15 minutes after each of their upgrades the facts run compares the containers, the units and the bouncer's table with the minute before; HostUpgradeWorse (sev1) names what is worse.
sshReports password logins, root login and X11. --only ssh --yes sets CIS's settings, as host fix sshd does. The change undoes itself unless a second login keeps it.
sudoNotes when sudo asks no password for any command.
seawall init --only backups --yes
seawall init --skip firewall

Each stack init writes uses today's newest release of each image in the major seawall tested, pinned by digest. At the end it saves the settings it found to ~/.config/seawall/seawall.toml. It also prints the ssh -N -L line that reaches each web UI it published on 127.0.0.1.

seawall doctor checks the permissions of the config, token and backups. It also checks that Docker, sudo, Portainer and Grafana answer. seawall posture scores the host against best practice and names a command for each gap.