Skip to content
PressJetDocs Docs v0.1.0-beta.9 GitHub
Edit this page
Source docs v0.1.0-beta.9 Install v0.1.0-beta.7
On this page

Server configuration

Use this reference to configure the HTTP server from the current source tree. For the installed server's operations and limits, check GET /v1/info and pressjet serve --help. A value outside its allowed range stops startup and reports the variable name.

Start a local server Set up API keys Size the worker pool

Listener and authentication

Variable Default Meaning
PRESSJET_HOST 0.0.0.0 Address to listen on.
PRESSJET_PORT 8080 Port; 0 picks a free one and prints it.
PRESSJET_API_KEY One secret key (32+ characters).
PRESSJET_API_KEYS_FILE Path of the key file.
PRESSJET_AUTH disabled to run without keys.
PRESSJET_ALLOW_UNAUTHENTICATED_SIGNING false true (or 1) lets a server with PRESSJET_AUTH=disabled start with a signing certificate, so every caller may sign. Without it, that combination stops the start.
PRESSJET_RATE_LIMIT_PER_MINUTE 0 (none) Rate limit for PRESSJET_API_KEY or a server without keys.
PRESSJET_RATE_LIMIT_BURST a sixth of the above Burst for that limit.

Workers and queues

Variable Default Meaning
PRESSJET_WORKERS CPU count Worker processes, one job each at a time.
PRESSJET_SHORT_JOB_WAIT_MS 0 With at least two workers, a positive value reserves one worker for small jobs whose queue wait reaches this age in milliseconds. Zero enables the regular FIFO pool for all workers.
PRESSJET_MAX_QUEUE 32 Requests that may wait for a worker before new ones get 503 server_busy.
PRESSJET_MAX_CONCURRENT_PER_KEY with several keys, PRESSJET_MAX_RUNNING_PER_KEY + a quarter of PRESSJET_MAX_QUEUE (at least 1); with one key or PRESSJET_AUTH=disabled, half of workers + queue Requests one key may have in progress at once (1–8192), from arrival until its client has the answer, so one caller cannot take every slot. Beyond it the key gets 429 rate_limited. A value set here applies however many keys there are; a key's maxConcurrent overrides it.
PRESSJET_MAX_RUNNING_PER_KEY with several keys, one fewer than PRESSJET_WORKERS (at least 1); with one key or PRESSJET_AUTH=disabled, every worker Jobs one key may have on workers at once (1–64) while another key has a job waiting for a worker. When nobody else is waiting, a key may also take any idle worker, so a single busy key still uses the whole machine. Once another key's job is waiting, the busy key's next jobs wait until it is back under this number, and the other key's job takes the next worker that comes free, within one job's time. Jobs already running are never stopped. With a single worker there is nothing to share. A value set here applies however many keys there are. Durable jobs count toward their project's jobs but never wait for them.
PRESSJET_WORKER_HEAP_MB 512 Memory cap of each worker process. Sized for the default PRESSJET_MAX_NODES; raise it in proportion when raising that.

Connections and deadlines

Variable Default Meaning
PRESSJET_MAX_CONNECTIONS 1024 Open connections at once. A connection beyond it is closed as soon as it is accepted. Sixteen more are kept for the machine's own address (127.0.0.1, ::1, or 127.0.1.1 where the system maps its hostname there), so a health check run inside the container, such as the image's HEALTHCHECK or pressjet healthcheck, still gets an answer when every other slot is taken. A probe from outside, such as a Kubernetes httpGet probe from the node, has no reserve.
PRESSJET_MAX_CONNECTIONS_PER_ADDRESS 64 Open connections at once from one client address; an IPv6 /64 counts as one address. A connection beyond it is closed as soon as it is accepted, so one host cannot take every slot. The machine's own addresses (127.0.0.1, ::1, 127.0.1.1) are not counted, so a reverse proxy in the same network namespace (the same pod, or the same host without container networking) is not limited. A proxy in another container or on another host connects from its own address: list it in PRESSJET_PROXY_ADDRESSES. Raise the cap when many clients reach the server through one address that is not a proxy you run (a NAT gateway), or set 0 to turn it off.
PRESSJET_PROXY_ADDRESSES Addresses and ranges, separated by commas (10.0.0.0/8, 192.0.2.10), whose connections are not counted against PRESSJET_MAX_CONNECTIONS_PER_ADDRESS: the reverse proxies, ingress controllers or load balancers that carry many clients' connections. They still count against PRESSJET_MAX_CONNECTIONS. On Kubernetes, list the pod and node ranges the ingress and Service traffic arrive from.
PRESSJET_FIRST_BYTE_SECONDS 2 Time a new connection may stay silent before the first byte of its request (1 to 120). After that byte, PRESSJET_HEADER_TIMEOUT_MS applies.
PRESSJET_HEADER_TIMEOUT_MS 10000 Time for request headers to arrive once the request has begun; also closes idle keep-alive connections.
PRESSJET_WRITE_TIMEOUT_MS 30000 Close a connection if a pending response write makes no progress for this long.
PRESSJET_MIN_WRITE_BYTES_PER_SECOND 16384 Slowest a client may take an answer, as an average since the answer started. Every 10 seconds after the first 10, the bytes sent so far must reach this rate times the time elapsed less 10 seconds, or the connection is closed. The burst that first fills the socket buffers (up to a few MiB) counts, so a client reading far below the rate is cut after minutes, not seconds. 0 turns the check off.
PRESSJET_RESPONSE_WRITE_SECONDS 120 With the minimum rate turned off, the longest an answer may take to reach its client. With it on, a client that keeps up the minimum rate may take longer, so a large document still reaches a slow link.
PRESSJET_BODY_TIMEOUT_MS 10000 Time for an admitted request's body to arrive.
PRESSJET_TIMEOUT_MS 30000 Deadline for rendering, including the wait in the queue.

Render limits and caching

Variable Default Meaning
PRESSJET_MAX_REQUEST_BYTES 20 MiB Largest request body.
PRESSJET_MAX_RESPONSE_BYTES 64 MiB Largest PDF or preview a job may produce.
PRESSJET_MAX_INFLIGHT_RESPONSE_BYTES 4 × PRESSJET_MAX_RESPONSE_BYTES Bytes of rendered answers held for their clients at once, across all requests (from PRESSJET_MAX_RESPONSE_BYTES to just under 4 GiB). A finished answer that does not fit waits for room until its job's deadline, then gets 503 server_busy; an answer that fits never waits behind a larger one. The count is approximate: an answer is charged in full even when the cache shares its bytes, and it is released once the last part is handed to the socket, which may still be sending it.
PRESSJET_MAX_INFLIGHT_RESPONSE_BYTES_PER_KEY with several keys, a quarter of the above and at least PRESSJET_MAX_RESPONSE_BYTES; with one key or PRESSJET_AUTH=disabled, all of it The part of that budget one key may hold. A key whose next answer would exceed it gets 429 rate_limited with Retry-After, so one key's slow clients cannot keep other keys' answers waiting. With a single key (PRESSJET_API_KEY, a key file listing one key, or no keys) there is no one to share with, so by default that key may use the whole budget. A value set here applies however many keys there are.
PRESSJET_MAX_PAGES 200 Pages per document (up to 2,000).
PRESSJET_MAX_NODES 20000 Nodes per document. HTML may have 6 elements and comments and 16 000 bytes of styles per node. Raising it needs a proportionally larger PRESSJET_WORKER_HEAP_MB.
PRESSJET_MAX_PIXELS 24,000,000 Image pixels per request, counted from image dimensions.
PRESSJET_CACHE_BYTES 64 MiB Result cache size; 0 disables it. Signed answers are never cached.
PRESSJET_CACHE_TTL_MS 60000 How long a cached result is kept.
PRESSJET_FONTS_DIR A folder of .ttf and .otf files (64 at most) installed for every document at startup, in the server, its workers and the CLI. /v1/info lists their families. Fonts whose license forbids embedding stop the start.

Logs and metrics

Variable Default Meaning
PRESSJET_ACCESS_LOG true One JSON line per request on standard output.
PRESSJET_LOG_FAILURES false Also write each refusal's reason to standard error.
PRESSJET_SERVER_TIMING false true (or 1) adds a Server-Timing header to fresh renders. Its queue duration shows how busy the server is to every key holder, so it is off unless you are measuring.
PRESSJET_METRICS_TOKEN Enables GET /metrics behind this bearer token (32+ characters).

Signing and verification

Variable Default Meaning
PRESSJET_SIGNING_P12_BASE64 PKCS#12 certificate and key for /v1/sign, base64.
PRESSJET_SIGNING_P12_PASSPHRASE Its passphrase.
PRESSJET_SIGNING_LOCATION Location shown by PDF readers.
PRESSJET_SIGNING_CONTACT Contact shown by PDF readers.
PRESSJET_VERIFICATION_KEY Seed of the Ed25519 key that signs verification codes, base64 (pressjet keys verification makes one). The server, its workers and the CLI sign with it; /v1/info lists the public half.
PRESSJET_SIGNING_KEYS The key ring for /v1/signing/*, as JSON text. Set this or the file variable, not both. See Envelope signing keys.
PRESSJET_SIGNING_KEYS_FILE Path of a file holding the key ring.