Skip to main content

Server configuration

The panel never edits a daemon's configuration files. It writes intent, a description of what each daemon should run, and each daemon's package turns that into the daemon's own configuration: it renders the files, checks them with the daemon's own validator, installs them and reloads the daemon. Configuration, in the admin app's System menu, shows whether every daemon did.

How a setting reaches a daemon​

The intent is one JSON document per object in /var/lib/elpan/intent/<kind>/<key>.json, such as accounts/<username>.json or vhosts/<hostname>.json, and belongs to the panel's own user. There are 15 kinds: accounts, appservers, databases, ipgroups, mail-addresses, mail-domains, mail-relays, dkim-key, dkim, server, certificates, ip-certificates, vhosts, browser-verifications and web-server. Each kind has a .head file holding the revision of its latest change.

Each daemon's package ships a transformer, /usr/lib/elpan/<svc>/elpan-<svc>-confgen, started by a path unit that watches the kinds it reads and by a timer every minute. A run waits a few seconds for a burst of the panel's writes to settle, renders every object of its kinds, validates the result, installs only the files that differ, removes the files it owns that nothing renders any more, and reloads the daemon when that changed something. Then it writes its report to /run/elpan/confgen/<package>.json, which is what the screen reads. A change in the panel usually reaches the daemon within half a minute.

A transformer owns only the files it writes. Anything else in its directories stays, and a file of its own that was edited or removed by hand is put back on the next run. Your own configuration goes in the drop-ins.

PackageWhat its transformer configuresUnits
elpan-firewallThe firewall rules of the accounts and their app servers.elpan-firewall-apply
elpan-resolverThe local resolver's records of the databases' host names.elpan-resolver-conf
elpan-dnsThe name server's listening addresses.elpan-dns-conf
elpan-cronWhich accounts may run scheduled tasks.elpan-cron-rebuild
elpan-systemdThe address each account's own containers publish their ports on by default (Podman defaults per account).elpan-systemd-confgen
elpan-mail-inThe incoming mail server: domains, addresses, forwarders, groups, lists, certificates.elpan-mail-in-maps
elpan-mail-outThe outgoing mail server: the server's names, the domains' outgoing gateways and the client certificates they are shown.elpan-mail-out-maps
elpan-rspamdThe mail filter's maps, the domains' DKIM selectors and the server's DKIM keys.elpan-rspamd-confgen
elpan-mail-relayWhere the mail services that relay their mail send it.elpan-mail-relay-confgen
elpan-mail-localThe mailbox server's certificates.elpan-mail-local-confgen
elpan-ftpThe certificates of FTPS and SFTP.elpan-ftp-confgen
elpan-httpdThe websites' Apache virtual hosts, one server per shared IP address group.elpan-httpd-confgen
elpan-nginxThe web front: server blocks, certificates, browser verification.elpan-nginx-reload
elpan-haproxyHTTP/3 and its certificates.elpan-haproxy-reload

Each unit name is a .path, a .service (the run) and a .timer; a run's log is journalctl -u <unit>.service. elpan-haproxy and elpan-ftp are optional components (Sizing profiles).

Why the panel does not write the files

The panel runs without root. The package that ships a daemon knows its validator and how to reload it, so it checks a whole configuration before it touches the running one, and a configuration the daemon would reject never reaches it.

The Configuration screen​

Configuration is in the System menu, after DNS Publication Failures. When every daemon runs what the panel wrote, it says Every daemon runs the configuration the panel wrote. Otherwise it lists:

  • Problems: one row per transformer that is not fine, with the details of its state.
  • Refused Objects: what a transformer refused (below).
  • Transformers: every one, with its state, what it configures, its last run, its build, and for each kind it reads the revision it applied against the kind's head.
  • Intent, collapsed: per kind, the number of documents, the head and when it last changed.

A transformer writes its report only when something it reads changed, so an old Last run on a quiet server is not a fault.

Each transformer has one state, the first of these that applies:

StateMeaningWhat to do
UnreadableIts report exists and cannot be read; the screen shows why.Read the run's log.
No reportNothing since the server started: the transformer has not run, or its package is missing. Reports live in /run, so a reboot clears them until the first run after it.Check that the package is installed and its .path and .timer units are active.
Waiting for the panelThe panel has not written a kind it reads yet, which is a fresh install before server init. Nothing is installed until it does.Initialize the server.
FailedThe last run failed and installed nothing; the daemon keeps its last good configuration. The row shows the failure, and Failing since or It has never succeeded.Fix the cause; it is tried again every minute.
BehindA kind it reads changed more than two minutes ago, and its last successful run read an older revision.Check its units. The screen reloads every 15 seconds while a transformer is behind.
OKIt runs the configuration the panel wrote.
Not installedAn optional component this server does not have.

The admin app's home page shows a Configuration section only when a transformer is in a problem state or has refused objects, one line each, linking to the screen.

Refused objects​

A transformer refuses an object it cannot use: a document that fails the contract's checks, a value it cannot write in the daemon's syntax, a name another object already has, or new output that breaks the validator's check of its part. A refused object keeps its last good configuration, what it rendered the last time it was accepted, and the rest goes ahead: a run with refusals is still OK. An object that was never accepted has nothing installed.

Each row gives the transformer, the kind, the object (linked to its host, account, service or shared IP address group where there is one), the document's revision, and the reason, which almost always points at something in the panel. The refusals of a host's virtual host, certificates, mail domain and DKIM selector are also shown in a warning box on the page the row links to: for one of the server's own hosts, its page under Hosts; for an account's host (a customer's website, mail host or sign-in host), which has no page of its own in the admin panel, the account's page, where each refusal names its host.

What retries by itself​

  • A failed run is tried again on every tick of the timer, every minute, even when nothing changed, until one passes. That run installs what was held back and reloads.
  • An object blamed for a failed check (the Apache transformer checks each shared IP address group on its own and refuses the objects whose new output breaks one) is tried again on every tick, until it passes or its document changes.
  • An object refused for its content stays refused until the panel writes a new document for it.
  • A run that installed files but could not finish reloading finishes on the next run.

So fixing the cause is enough. To run a transformer at once, systemctl start <unit>.service, or its run --force as root.

elpanctl intent status​

The same reading on the command line: the intent (kind, documents, head, when it changed), every transformer (build, last run, state, the revision applied per kind, and the failure under it), and the refused objects. The states print as ok, FAILED, waiting, behind, no report, unreadable and not installed.

elpanctl intent status

It exits 1 when a transformer is failed, waiting, behind, without a report or unreadable, or a kind's head cannot be read; 0 otherwise. Refusals alone do not make it fail. That makes it a check for a monitoring system, or for a script to run after a change.

Rebuild the intent​

Rebuild the intent, a button on the screen, and

elpanctl intent rebuild
elpanctl intent rebuild --kind=<kind>

write every object's document again from the panel's database, every kind or one. Only documents that differ are written, and those of objects that no longer exist are removed, so on a server in good order it changes nothing. Use it:

  • after restoring the panel's database;
  • after a document under /var/lib/elpan/intent/ was edited or removed by hand;
  • when a daemon does not match what the panel shows and the screen does not say why.

The button asks for confirmation and hands the work to the background workers, since a rebuild of every kind on a large server outlasts a request. Its result is in their journal:

journalctl -u 'elpan-panel-worker@*' -u 'elpan-panel-async@*' -g 'INTENT:REBUILD'

The command prints a line per kind (vhosts: 2 written, 25 unchanged, 1 removed.), and with -v every object written or removed. An object it cannot write is reported, the others are still written, and it exits 1.

A rebuild does not fix a failing transformer

It rewrites what the panel says, not what the daemon does with it. A transformer that fails keeps failing until its cause is fixed; the failure text names it.

Monitoring​

The panel exports the transformers' state with its other metrics (Telemetry). The labels are consumer, the package's name, and kind, the intent kind; only the packages the server is expected to have get series.

MetricValue
elpan_confgen_last_run_timestamp_seconds{consumer}When the last run that did work finished.
elpan_confgen_last_success_timestamp_seconds{consumer}When the last successful run finished.
elpan_confgen_last_run_failed{consumer}1 when the last run failed (waiting for the panel is not a failure).
elpan_confgen_waiting{consumer}1 while it waits for the panel.
elpan_confgen_report_missing{consumer}1 when there is no readable report.
elpan_confgen_refused_objects{consumer,kind}The objects of the kind it refused.
elpan_confgen_behind{consumer,kind}1 when it is behind on the kind.

Alert on last_run_failed and behind, not on the age of the last run, which is old on any quiet server. elpan-observability has four alerts on them: ConfgenRunFailed (a failed run for 10 minutes), ConfgenBehind (behind for 15 minutes, and not already failing), ConfgenReportMissing (no readable report for 15 minutes) and ConfgenRefusals (refused objects for an hour, for information). A failed run also fails its unit, which raises ConfigAssemblerFailed.