Print Daemon 1.3.0

Configured from Edge Manager

A print daemon can be managed from Edge Manager, the admin tool that configures every warehouse app of a site from one place. In that mode Edge Manager sends the daemon its printers and settings, carries out test prints and dead-letter actions, and licenses the daemon; the daemon has no local administration. Without it (the default), you configure the daemon in its admin UI or in config.json as described on the other pages, with its own license key.

Licensed by Edge Manager#

A daemon has one of two licensing terms:

Edge Manager is licensed per site: its license says how many print-daemon sites it may manage (across all its tenants), and Edge Manager refuses to add more. The daemon receives Edge Manager's license with its site token, and Edge Manager sends it renewals on the command queue. The daemon checks it on its own (it is signed; nothing is sent anywhere to check it):

A daemon set up for Edge Manager that isn't licensed by it (an expired trial, or a site token without Edge Manager's license) runs as if configured locally, with its own license:

The daemon follows its license while it runs: when Edge Manager's license reaches it, or a trial ends, it switches within a minute, without a restart. After a switch to Edge Manager, the next configuration Edge Manager sends replaces what was set at the machine; to keep that setup, adopt it in Edge Manager first (Move a daemon set up at the machine).

Connect a daemon#

A daemon is connected to Edge Manager with one string, the site token. Edge Manager shows it (with a copy button) when you add the site, change its queue settings, rotate its secret, or ask for a new one (Settings & connection page; it can be issued again any time, so copying it later is fine too). On the daemon's machine, run once:

bash
node dist/cli.js connect <site token>     # as root/Administrator for an installed service; "-" reads the token from stdin

then restart the daemon (or its service). That's all: no environment variables, nothing to add to config.json.

What connect does:

  1. It checks the token and sends a test report to Edge Manager, using the queue and credentials in the token. If that fails (a wrong credential, a queue the daemon may not write to, no network), it says why, exits with code 1 and saves nothing. --skip-check saves without sending, for a machine that is offline at install time.
  2. It saves the token as <home>/cloud (readable only by the service's account), takes Edge Manager's license from it, and says whether the daemon is licensed by Edge Manager (if not, it stays configured locally, and says why).
  3. After the restart the daemon is managed from Edge Manager. In Edge Manager the site shows as connected.

Containers and secret stores: instead of connect, give the service the variable PRINT_DAEMON_CLOUD_TOKEN with the token. It takes precedence over a saved token.

What the token holds: Edge Manager's license, the site's key id and signing secret, its command queue (where Edge Manager sends the configuration; print jobs on it print too), Edge Manager's fleet queue (where the daemon reports), and the daemon's key for both. So the token is a secret: anyone with it can receive the site's configuration and report as the site. Keep it like a password; get a new one in Edge Manager (rotate the site's secret) if it leaks.

The daemon's key#

Each daemon needs one credential of its own that may do exactly two things. On AWS, Edge Manager can create it for you when you add the site (with the site's queue: "Created by Edge Manager"); otherwise you create it and enter it once for the site in Edge Manager (Settings & connection page). It may:

Edge Manager puts it into the token for both queues. Edge Manager itself sends to the command queue with its own access, never with the daemon's key. Give each daemon its own key, so a leaked one affects only that site.

AWS (SQS): an IAM user per daemon with an access key and this policy (your account, region and queue names):

json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["sqs:ReceiveMessage", "sqs:DeleteMessage", "sqs:ChangeMessageVisibility"],
      "Resource": "arn:aws:sqs:us-east-1:123456789012:whs1-commands"
    },
    {
      "Effect": "Allow",
      "Action": "sqs:SendMessage",
      "Resource": "arn:aws:sqs:us-east-1:123456789012:Edge Manager-fleet"
    }
  ]
}

If the command queue receives print jobs that the WMS stores in S3 (extended payloads), add s3:GetObject (and s3:DeleteObject when the daemon deletes them after printing) on that bucket.

Azure (Service Bus): a service principal with the role Azure Service Bus Data Receiver on the command queue and Azure Service Bus Data Sender on the fleet queue; or, when both queues are in one namespace, a connection string of a shared access policy with Listen and Send.

Google (Pub/Sub): a service account (its key file) with Pub/Sub Subscriber on the command queue's subscription and Pub/Sub Publisher on the fleet topic.

When the site's command queue is in another cloud than the fleet queue, one key can't do both: the site then also gets a separate fleet credential for the daemon (Edge Manager asks for it only in that case).

How the daemon reaches Edge Manager: it doesn't, directly. The key travels in the site token: connect sends its test report to the fleet queue with it, and run receives from the command queue and reports to the fleet queue with it. There is no network connection between the daemon and Edge Manager (Edge Manager stays private); both only talk to the cloud queues, and the signature with the site's secret proves who sent each message. A site whose daemon key is set to the default credential chain has no key in its token: the daemon then uses the credentials of its machine (environment, ~/.aws, an instance role), which need the same permissions.

Two things that cause an AccessDenied even with the right policy:

A daemon with an invalid token (in PRINT_DAEMON_CLOUD_TOKEN or <home>/cloud) doesn't start: run says what is wrong with it (never the token) and exits with code 1. A config.json that still has a management section (the way of earlier test builds) is refused at start: remove it and connect with the token.

To configure the daemon locally again: node dist/cli.js disconnect, then restart. The configuration Edge Manager last sent stays in config.json and can be edited at the machine again.

What Edge Manager sets#

Print jobs come on the command queue. A daemon configured from Edge Manager has no other queues: the WMS sends its print jobs to the site's command queue, the same queue Edge Manager sends the configuration on (owner decision 2026-11-05).

Set by Edge Manager Local to the daemon
logLevel, the printers, discovery, printing (except the two paths), deadLetter, dedupe admin (where the admin UI listens), printing.libreOfficePath, printing.sumatraPdfPath, and the site token (command and fleet queue)

A configuration from Edge Manager is refused as a whole when it names a local setting, has a setting the daemon doesn't know, has job queues (queues), or contains a ${ENV_VAR} reference. The daemon then keeps what it runs, and Edge Manager shows the problems.

How a configuration is applied#

Move a daemon set up at the machine#

A daemon you set up at the machine (printers and queues added in its admin UI or CLI) keeps running that setup after you switch it to Edge Manager, until Edge Manager sends its first configuration, which replaces all of it. So that you don't have to enter it again, the daemon sends Edge Manager its setup:

  1. Connect it to Edge Manager (Connect a daemon) and restart it.
  2. Until Edge Manager has sent it a configuration, the daemon sends its setup with its first report after each start, and again when it changes. Nothing is sent once a configuration from Edge Manager was applied.
  3. In Edge Manager, the site page offers Adopt local setup… while the site has no configuration version yet. It opens the setup in the configuration editor, unsaved, with the values you have to enter.
  4. Enter the values: secrets never leave the daemon. A setting that used a ${ENV_VAR} reference is sent with the variable's name only. Save: this is the site's version 1. Then send it to the daemon as any version.

The setup includes the printers (with their connections, resolution and print defaults) and the discovery, printing, dead-letter and dedupe settings, never the local ones (admin, the two program paths) or the site token's queues. Job queues are not taken over: configured from Edge Manager, a daemon takes print jobs only on its command queue, so the WMS sends its print jobs there. The first configuration from Edge Manager stops the job queues the daemon had.

Too large, or offline: a setup over the size of a fleet message (256 KiB; hundreds of printers) is not sent, and Edge Manager says so. Export it on the daemon's machine and paste it into Edge Manager's configuration editor instead:

bash
node dist/cli.js config export -o local-setup.json   # the same document; the values to enter are listed on stderr

What the daemon reports#

On the fleet queue, signed with the site's secret, the daemon sends Edge Manager the result of each configuration message (applied, rejected with the problems, or ignored) and a summary: its version, license status, the configuration version, its printers, its queues (running or paused), the number of dead-lettered jobs, and the printers discovery found that aren't in its configuration. Document printers come with their paper trays, which Edge Manager shows on the printers tab and copies into a printer added from discovery (Printers › Paper trays). The summary goes out at start, every 5 minutes, after a configuration was applied, and after a discovery run that found a new printer. Until a configuration from Edge Manager was applied, it also sends its local setup (Move a daemon set up at the machine). While the fleet queue can't be reached, the daemon keeps up to 200 reports and retries.

Actions from Edge Manager#

Besides configuring a daemon, Edge Manager can ask it to act, from the site's page:

Each request is signed with the site's secret, travels on the command queue like a configuration, and the daemon answers on the fleet queue (done, failed with the reason, refused, or expired). A request is valid for 10 minutes: if the daemon is off, it isn't carried out later. Each request runs once, even if the queue delivers it twice. A request with a wrong signature is not carried out and goes to the daemon's dead-letter list (without what it carried).

On the daemon#

Managed from Edge Manager, the daemon has no local administration: everything is done in Edge Manager.

To manage the daemon locally again: disconnect and restart (Connect a daemon). It then needs its own license key. The CLI follows once the daemon has started.

Security#