Self-hosting¶
ezmd ships as a Docker Compose stack: Caddy at the edge, the API (which also serves the web UI), an RQ worker for local conversions, a fetch worker for URL jobs, Redis, and a retention purge service. The public instance and self-hosted instances use the same defaults; you may loosen limits through environment variables, never the sandbox.
Docker Compose (core stack)¶
git clone https://github.com/larpey/ezmd && cd ezmd
deploy/bootstrap.sh --domain ezmd.example.com --email you@example.com --version 0.1.1
--version is an image tag on GHCR (no leading v): use the newest release listed on the
GitHub releases page, for example 0.1.1, or a
X.Y.Z-rcN tag to try a release candidate.
bootstrap.sh is safe to run again; it only fills in what is missing:
- creates
deploy/.envfromdeploy/env.example(mode 600) and sets the domain, public URL, ACME email and image tag you pass; - generates
EZMD_KEY_PEPPER,EZMD_JWT_SECRET,EZMD_IP_HASH_SALT,EZMD_REDIS_PASSWORDandEZMD_METRICS_TOKENonce (a re-run never rotates them: a new pepper invalidates every API key); - pulls the images (
--buildbuilds this checkout instead); - applies database migrations, so the database is under Alembic from the first start;
- creates
keys.jsonin the state volume (EZMD_KEYS_FILE=/var/lib/ezmd/keys.json) with an unlimitedownerkey viaezmd-admin, and writes that key todeploy/ezmd-owner.key(mode 600; move it to a password manager); - starts the stack, waits for every healthcheck, and runs
deploy/smoke.sh.
Options: --domain localhost (HTTPS with Caddy's internal CA), --plain-http (no TLS, port 8080), --no-smoke, --key-out PATH. EZMD_ENV_FILE=/path/to/env selects another env file (every script honors it, and compose passes it to every container). Host hardening (firewall, fail2ban, sshd, unattended upgrades) is not done by the script yet; follow your distribution's guidance or the public-instance runbook (Phase 4).
By hand: cp deploy/env.example deploy/.env, fill in the secrets, docker compose -f deploy/docker-compose.yml up -d --build --wait, then bash deploy/smoke.sh --no-build.
EZMD_DOMAINempty: plain HTTP on port 8080 (host portEZMD_PLAIN_PORT), on loopback only unlessEZMD_PLAIN_BIND=0.0.0.0. Open http://localhost:8080.EZMD_DOMAIN=localhost: HTTPS with Caddy's internal CA.EZMD_DOMAIN=ezmd.example.com: a Let's Encrypt certificate; setEZMD_ACME_EMAIL.
| Service | Role | Networks |
|---|---|---|
caddy |
TLS, upload cap, security headers, fetch-node path restriction | internal, egress |
api |
REST API and web UI | internal |
worker-default |
Conversions of uploaded files | internal (no internet route) |
worker-fetch |
URL fetches through the SSRF guard, then conversion | internal, egress |
redis |
Queues, job events, rate limits (no persistence) | internal |
purge |
Retention purge and fetch-node claim reaper | internal |
Only caddy publishes host ports. In TLS mode that is 80 and 443; the plain-HTTP port is bound to
EZMD_PLAIN_BIND (default 127.0.0.1). Caddy also listens on port 9180 inside the compose networks
for the Turnstile relay (below); it is never published.
Every app container runs as uid 10001 with a read-only root filesystem, a /tmp tmpfs, all
capabilities dropped, no-new-privileges, and CPU, memory, and pid limits. Workers also load
deploy/seccomp-worker.json. See Security and deploy/README.md for details.
Client IP (direct and behind Cloudflare)¶
Rate limits, API-key IP restrictions, Turnstile and the fetch-node CIDR check use the client IP. The stack derives it in one place, and no client-supplied header can set it:
- Caddy computes
{client_ip}: the TCP peer, orCF-Connecting-IPwhen the peer is one of the Cloudflare ranges in itstrusted_proxies. It overwritesX-Real-IPwith that value on every request to the API. - uvicorn runs with
--no-proxy-headers, so the API sees the real TCP peer (Caddy). Never add--proxy-headers --forwarded-allow-ips "*": uvicorn then takes the leftmostX-Forwarded-Forentry, which the client chooses. - The API reads
EZMD_TRUST_PROXY_HEADER(compose defaultX-Real-IP) only when the peer is inEZMD_TRUSTED_PROXIES(compose default: the private ranges; the API has no published port).
The same settings work with or without Cloudflare in front; nothing changes when you switch. When
you run the API without compose, leave EZMD_TRUST_PROXY_HEADER empty unless a proxy that
overwrites the header sits in front, and set EZMD_TRUSTED_PROXIES to that proxy's address.
Turnstile¶
Turnstile is off until EZMD_TURNSTILE_SECRET is set. EZMD_PUBLIC_MODE=true and
EZMD_TURNSTILE_REQUIRED_FOR_FETCH=true refuse to start without it, and Turnstile refuses to start
without an EZMD_JWT_SECRET of at least 32 bytes, which every API worker uses to verify the challenge
cookie (bootstrap.sh generates one).
- In the Cloudflare dashboard create a Turnstile widget for your hostname ("Managed", invisible
preferred). Put the site key in
EZMD_TURNSTILE_SITEKEYand the secret inEZMD_TURNSTILE_SECRET, then recreate the API so it reads them:docker compose -f deploy/docker-compose.yml --env-file deploy/.env up -d --force-recreate api(restartkeeps the old environment). - Nothing else is needed for the network. The
apicontainer has no internet route, so it posts siteverify to Caddy's internal relay (EZMD_TURNSTILE_VERIFY_URL, compose defaulthttp://caddy:9180/turnstile/v0/siteverify). The relay answers onlyPOST /turnstile/v0/siteverify, only from private addresses, and forwards only tohttps://challenges.cloudflare.com. If your host filters outbound traffic, Caddy must reachchallenges.cloudflare.com:443. - Check it by submitting a URL in the web UI. When the API cannot get a verdict (relay or Cloudflare
unreachable, or a wrong secret), the visitor gets
503 turnstile_unavailablewithRetry-Afterand the API logs the cause at ERROR (docker compose ... logs api | grep siteverify). A visitor who fails the challenge gets403 turnstile_failed.
Cloudflare's test keys exercise the whole path: site key 1x00000000000000000000AA with secret
1x0000000000000000000000000000000AA always passes; secret 2x0000000000000000000000000000000AA
always fails.
What the API accepts¶
- Types come from the content (Magika, libmagic), never the extension. Executables
(
detail.reason: executable) and types no installed converter handles (no_converter) are refused with415 unsupported_media_typebefore a job is created. A URL whose body turns out to be one of these fails its job with the same code. - Uploads over the caller's cap are
413 input_too_large:EZMD_ANON_MAX_UPLOAD_MBfor anonymous callers, the key'smax_upload_mbfor keyed ones, andEZMD_CADDY_MAX_BODYat the edge for everyone. Rejected requests (413, 429, and the global-capacity 503) do not use up the caller's rate limit. - Deduplication: a request with the same input, options and profile as a finished, unexpired job
returns that job (
200,"deduplicated": true) instead of converting again. The scope is the API key for keyed callers and the client IP for anonymous ones, in every mode: a job id grants access to the job, so a caller never receives another caller's id. Jobs are deleted afterEZMD_RETENTION_HOURS. - Attachments:
GET /v1/jobs/{id}/attachments/{path}serves only files the job stored, such as table CSVs. Images extracted from documents are not stored yet, so their references in the Markdown and sidecar return 404.
Health and readiness¶
/healthz is 200 while the API process serves requests. /readyz is 200 when the database and
Redis answer and an RQ worker heartbeated within the last 60 s; workers beat every 30 s, idle or
busy. A 503 names the failing check in checks. The reaper in the purge service requeues jobs
that a Redis restart dropped and fails jobs whose worker died (about a minute after its last
heartbeat), which frees the caller's concurrency slot.
API keys and their restrictions¶
bootstrap.sh creates one unlimited owner key in keys.json. Create more with
ezmd-admin keys create (see Admin CLI), run inside the api container from
the repository root:
docker compose -f deploy/docker-compose.yml --env-file deploy/.env exec api \
ezmd-admin keys create --store file --name ci
Per-key limits are set with the keys create options. Restrictions (ips, user_agents,
allowed_sources, disabled_sources, residential_allowed) are fields of the keys.json entry
(format); there is no CLI for them yet. Edit the file in the state volume and the
API reloads it within a few seconds. A key used from a disallowed IP or User-Agent gets
403 forbidden; a URL job whose submitted URL, any redirect, or any converter-requested fetch leaves
the allowed hosts fails with forbidden.
Windows and Git Bash¶
The scripts run under Git Bash with Docker Desktop. Run them as bash deploy/<script>.sh from the
repository root.
deploy/lib.shsetsMSYS_NO_PATHCONV=1so Git Bash does not rewrite arguments fordocker.exe; paths are converted explicitly.chmod 600andchmod 700(ondeploy/.env,deploy/ezmd-owner.keyanddeploy/backups/) do nothing on NTFS. Those files hold every secret: keep the checkout inside your user profile or restrict the folder withicacls, and keep backups on an encrypted disk.- With
MSYS_NO_PATHCONV=1, native Windowscurl.execannot write to/dev/null(it fails with error 23). The scripts never ask it to (curl_winlib.sh); scripts of your own that sourcelib.shshould not either.
Planned: the media worker and model init container (Phase 2), Postgres and MinIO profiles, and the public and Raspberry Pi overlays (Phases 3 and 4).
The worker image includes the data extra (pyarrow, for Parquet). Build arguments add more:
EZMD_WORKER_EXTRAS="data docs" adds Docling (several GB: the lock resolves CUDA torch wheels on
Linux), and EZMD_WORKER_APT_PACKAGES="libreoffice-core-nogui libreoffice-writer-nogui
libreoffice-calc-nogui libreoffice-impress-nogui" adds LibreOffice for legacy .doc/.xls/.ppt.
nonfree and 7z are refused in the image.
LibreOffice security note. A document can link remote images and other content, and LibreOffice
fetches linked content while it converts: with LibreOffice layered on, an ODT with a linked image made
soffice --convert-to send requests to the linked URL. The converter now turns linked-content updates
off, and worker-default sits only on the internal network (it can reach api and redis, not the
internet); keep it that way. The workers also set EZMD_REQUIRE_SANDBOX=1, so LibreOffice runs only
inside bubblewrap (installed in the worker image). With the stack's seccomp-worker.json, bubblewrap
cannot create its namespaces, so LibreOffice conversions are refused with a message that says so; the
other converters are unaffected (a LibreOffice job fails with sandbox_unavailable). To convert legacy
Office files anyway, pick one of these:
- Sandboxed LibreOffice (recommended if you need it). Set
EZMD_WORKER_SECCOMP=seccomp-worker-userns.jsonin the env file and recreate the workers (docker compose -f deploy/docker-compose.yml --env-file deploy/.env up -d --force-recreate worker-default worker-fetch). That profile isseccomp-worker.jsonplus exactly what bubblewrap needs:unshare,clonewith namespace flags,mount,umount2,pivot_rootandsetns(andclone3answering ENOSYS so the C library falls back toclone). The workers still run as uid 10001 with every capability dropped andno-new-privileges; bubblewrap then gives each external tool its own empty network (loopback only), a fresh/tmp, and read-only system directories. The trade-off: code in the worker, including a converter compromised by a hostile file, can create user namespaces, and the kernel code behind them has a long history of privilege-escalation bugs. Keep the host kernel patched. On hosts that restrict unprivileged user namespaces in AppArmor (Ubuntu 23.10 and later), bubblewrap may still fail; the worker then keeps refusing LibreOffice, it never falls back to running it unsandboxed. A full LibreOffice conversion inside bubblewrap has not been tested yet (only bubblewrap itself and pandoc under it, as uid 10001 with every capability dropped). - Unsandboxed LibreOffice, trusted input only. Set
EZMD_REQUIRE_SANDBOX=0in the env file. soffice then runs with only the container's isolation (no internet, but the same/tmpand network as the worker, which can reachapiandredis).
deploy/docker-compose.gpu.yml adds a worker-media service for the Phase 2 image.
Backups¶
deploy/backup.sh # online; the stack keeps running
deploy/backup.sh --no-blobs # database, keys and certificates only
Each run writes ezmd-<UTC timestamp>.tar.gz (mode 600) to EZMD_BACKUP_DIR (default deploy/backups/, mode 700) and keeps the newest EZMD_BACKUP_KEEP (default 14). It holds a consistent SQLite snapshot (SQLite's online backup API, then PRAGMA integrity_check), keys.json, the blob store, Caddy's certificates and the env file, with SHA-256 checksums for every file. The env file holds every secret: keep backups private and copy them off the host (for example with rclone copy). Schedule it daily, e.g. 17 3 * * * /opt/ezmd/deploy/backup.sh >/dev/null.
Only SQLite and the filesystem blob store are covered; with Postgres or S3 use those services' own backups.
Restore¶
deploy/restore.sh --verify-only deploy/backups/ezmd-20261008T031700Z.tar.gz
deploy/restore.sh deploy/backups/ezmd-20261008T031700Z.tar.gz
deploy/restore.sh --with-env backup.tar.gz # new host: also restore the env file
The script checks the archive's checksums, and every file against the backup's manifest, before it changes anything. Then it stops every service except Redis, replaces the database, keys.json, blobs and Caddy data, starts the stack and runs the smoke test. Without --with-env the current env file stays; the script warns when its key pepper differs from the backup's (API keys would stop validating). It works on an empty volume set (after docker compose down -v, or on a fresh host).
Upgrades¶
deploy/upgrade.sh 0.2.0
Backup first, then EZMD_VERSION=0.2.0 in the env file, docker compose pull, migrations with the new image, up --wait, and /readyz through Caddy. If any step fails it puts the previous version back; when migrations already ran it first restores the pre-upgrade backup (migrations are forward-only), then starts the old version and exits 1. Patch releases are safe to auto-update (Watchtower); minor releases may add env vars or models and should go through upgrade.sh; major releases may change the API and are announced one minor release ahead.
Every process brings the database to the Alembic head at startup. A database created by an older release's create_all start (no alembic_version table) is adopted when its tables match this release's models, and refused with a clear error otherwise; restore a backup made by backup.sh in that case.
Releases and image verification¶
The owner pushes release tags. vX.Y.Z-rcN builds the images and a GitHub pre-release and publishes to PyPI as a pre-release (pip and uv install it only with --pre or an exact version); vX.Y.Z publishes to PyPI, npm (@ezmd/sdk) and the MCP registry. Every PyPI publish waits for the owner's approval in the release environment. Images are pushed by digest, scanned with Trivy (HIGH/CRITICAL findings with a fix fail the release), given an SPDX SBOM (syft; also attached to the GitHub release) and signed with cosign keyless before any tag points at them. Verify with cosign 3 or later; the signatures use the Sigstore bundle format, which cosign 2 reports as "no signatures found":
ID='^https://github\.com/larpey/ezmd/\.github/workflows/images\.yml@refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$'
cosign verify ghcr.io/larpey/ezmd-api:0.1.1 \
--certificate-identity-regexp "$ID" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
cosign verify-attestation --type spdxjson ghcr.io/larpey/ezmd-api:0.1.1 \
--certificate-identity-regexp "$ID" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
The expression is anchored and its dots are escaped, so only images.yml in larpey/ezmd at a
release tag matches (an unescaped . also accepts look-alike names). Use the tag you run; the same
commands work for ezmd-worker and ezmd-fetch-node.
One-time owner setup before the first publish (until then the publish jobs skip with a notice):
- GitHub, Settings, Environments: create
releasewith required reviewers (the owner) and deployment tags limited tov*;publish-gaterefuses to publish whenreleasehas no required reviewers. - PyPI: add a trusted publisher for each of
ezmd,ezmd-convertersandezmd-mcp: ownerlarpey, repositoryezmd, workflowrelease.yml, environmentrelease. PyPI lets one pending publisher configuration be pending for a single project at a time, so for brand-new names addezmdfirst, release, then add the next one and re-run its failed publish job. - npm: create the
@ezmdscope and configure trusted publishing for@ezmd/sdk: repositorylarpey/ezmd, workflowrelease.yml, environmentrelease. npm requires the package to exist before trusted publishing can be set, so the very first publish may need a one-off manualnpm publishby the owner. - MCP registry: nothing to configure;
mcp-publisher login github-oidcproves ownership ofio.github.larpey/*. - Settings, Variables: set
EZMD_PUBLISH_ENABLEDtotrue.
Running without Docker¶
uv sync --all-packages --dev
uv run ezmd serve # API and web UI on http://127.0.0.1:8080
ezmd serve uses the inline queue when Redis is not configured and refuses to bind a non-loopback
address without --i-know-this-is-public. For a split setup run the API with
uv run uvicorn ezmd_api.main:app --port 8000 and a worker with
uv run python -m ezmd_api.worker --queues default.
Retention¶
Jobs, inputs, and results are deleted EZMD_RETENTION_HOURS (default 24) after creation by the
purge service. DELETE /v1/jobs/{id} deletes a job immediately.
Compose-only variables¶
These are read by deploy/docker-compose.yml and Caddy, not by the API:
| Variable | Default | Purpose |
|---|---|---|
EZMD_DOMAIN |
empty | Site address for Caddy (empty: plain HTTP on :8080). |
EZMD_ACME_EMAIL |
empty | Contact address for Let's Encrypt. |
EZMD_REDIS_PASSWORD |
empty | Redis requirepass; compose builds EZMD_REDIS_URL from it. Use hex. |
EZMD_VERSION |
latest |
Image tag when not building locally. |
EZMD_PLAIN_PORT, EZMD_HTTP_PORT, EZMD_HTTPS_PORT |
8080, 80, 443 |
Host ports. |
EZMD_PLAIN_BIND |
127.0.0.1 |
Host address the plain-HTTP port listens on. 0.0.0.0 serves other machines (a LAN, or a TLS proxy on another host). |
EZMD_CADDY_MAX_BODY |
512MB |
Edge request body cap. |
EZMD_TMPFS_SIZE |
2g |
Size of each container's /tmp. |
EZMD_API_WORKERS |
2 |
Uvicorn worker processes. |
EZMD_REDIS_MAXMEM |
256mb |
Redis memory cap. |
EZMD_BACKUP_DIR |
deploy/backups |
Where backup.sh writes tarballs. |
EZMD_BACKUP_KEEP |
14 |
How many backups backup.sh keeps. |
EZMD_ENV_FILE |
deploy/.env |
Shell variable only: the env file the scripts and containers use. |
EZMD_WORKER_SECCOMP |
seccomp-worker.json |
Seccomp profile (a file in deploy/) for both workers. seccomp-worker-userns.json allows the user namespaces bubblewrap needs; see the LibreOffice note. |
EZMD_REQUIRE_SANDBOX |
1 |
Passed to the workers and read by the LibreOffice converter: refuse to run soffice when bubblewrap cannot sandbox it. 0 runs it unsandboxed (trusted input only). |
API environment variables¶
Every variable the API and its workers read, generated from ezmd_api.settings.Settings.
Field foo_bar is read from EZMD_FOO_BAR. Comma lists are plain comma-separated strings.
Instance¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_PUBLIC_MODE |
bool | false |
Public-instance mode. Requires EZMD_JWT_SECRET and EZMD_KEY_PEPPER of at least 32 bytes, requires a Turnstile challenge for URL jobs (so EZMD_TURNSTILE_SECRET must be set). |
EZMD_PUBLIC_URL |
str | http://localhost:8000 |
Externally visible base URL. Used for links in error documents and to decide whether cookies are marked Secure. |
EZMD_DATA_DIR |
path | ~/.ezmd |
Base directory for the default SQLite database and filesystem blob store. |
EZMD_WEB_DIST |
path | unset | Directory with the built web UI (apps/web/dist) to serve at /. Unset: apps/web/dist next to the source tree when present, else no UI. The compose stack defaults it to the image's /app/apps/web/dist. |
EZMD_SCHEDULER_ENABLED |
bool | true |
Run the retention purge inside the API process. Compose sets false and runs the separate purge service instead. |
Storage¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_DATABASE_URL |
str | unset | Database URL. Unset: SQLite at <data_dir>/ezmd.db. |
EZMD_BLOB_BACKEND |
fs / s3 | fs |
Where inputs, IR, and rendered results are stored: local filesystem or S3-compatible storage. |
EZMD_BLOB_FS_ROOT |
path | unset | Root of the filesystem blob store. Unset: <data_dir>/blobs. |
EZMD_S3_ENDPOINT |
str | unset | S3 endpoint URL (for MinIO or another S3-compatible service). Unset: the AWS default. |
EZMD_S3_BUCKET |
str | ezmd |
S3 bucket name. |
EZMD_S3_ACCESS_KEY |
secret | unset | S3 access key id (secret). |
EZMD_S3_SECRET_KEY |
secret | unset | S3 secret access key (secret). |
EZMD_S3_REGION |
str | us-east-1 |
S3 region. |
EZMD_RETENTION_HOURS |
int | 24 |
Hours a job and its blobs are kept. 0 deletes the job on first result download (it is kept for at most one hour otherwise). |
EZMD_PURGE_INTERVAL_S |
int | 600 |
Seconds between retention purge runs. |
Queue¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_REDIS_URL |
str | redis://localhost:6379/0 |
Redis URL for the RQ queues, job events, and rate limits. Compose builds it from EZMD_REDIS_PASSWORD. |
EZMD_QUEUE |
rq / inline | rq |
rq sends jobs to RQ workers; inline converts in the API process (development and tests). |
EZMD_JOB_TIMEOUT_S |
int | 1800 |
Upper bound on any job's wall-clock time. Per-queue timeouts (default 600 s, media 3600 s, fetch 120 s) are capped by it. |
EZMD_JOB_MEM_MB |
int | 4096 |
Address-space limit (RLIMIT_AS) for a conversion child process on the default queue. |
EZMD_MEDIA_JOB_MEM_MB |
int | 8192 |
Address-space limit for a conversion child process on the media queue (Phase 2). |
EZMD_WORKER_DEFAULT_CONCURRENCY |
int | 2 |
Default-queue worker slots. Used to size the global active-job cap. |
EZMD_WORKER_MEDIA_CONCURRENCY |
int | 1 |
Media-queue worker slots. Used to size the global active-job cap. |
EZMD_MAX_ACTIVE_JOBS |
int | unset | Global cap on queued and running jobs; beyond it the API answers queue_unavailable. Unset: 2 x (default + media worker slots). |
EZMD_MAX_ACTIVE_ANON_JOBS |
int | unset | Active anonymous jobs allowed at once, so anonymous traffic cannot fill the whole active-job cap. Unset: the cap minus a third of it (at least one slot stays free for API keys). |
EZMD_RESIDENTIAL_WAIT_SECONDS |
int | 180 |
How long a residential-only fetch job waits while no fetch node is online before it asks the user to upload the file instead (needs_user_action). |
EZMD_MAX_RESULT_BYTES |
int | 268435456 |
Largest IR JSON a conversion child process may hand back, in bytes; larger results fail with result_too_large. |
Limits (anonymous callers; API keys carry their own)¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_ANON_MAX_UPLOAD_MB |
int | 200 |
Maximum upload size for anonymous callers, in MB. |
EZMD_ANON_MAX_HTML_MB |
int | 10 |
Maximum size of a fetched page for anonymous callers, in MB. |
EZMD_ANON_MAX_DURATION_S |
int | 10800 |
Maximum media duration for anonymous callers, in seconds. |
EZMD_ANON_MAX_PAGES |
int | 2000 |
Maximum pages converted per document. |
EZMD_ANON_RATELIMIT_MAX |
int | 20 |
Job creations allowed per client per window. |
EZMD_ANON_RATELIMIT_WINDOW_S |
int | 60 |
Length of the job-creation rate-limit window, in seconds. |
EZMD_ANON_DAILY_MAX |
int | 200 |
Job creations allowed per client per day. |
EZMD_ANON_CONCURRENCY |
int | 1 |
Active (queued or running) jobs allowed per anonymous client. |
EZMD_ANON_RESULT_RATELIMIT_MAX |
int | 40 |
Result and attachment fetches allowed per client per minute. |
EZMD_ANON_SSE_MAX |
int | 10 |
Concurrent SSE connections allowed per client. |
EZMD_FETCH_NODE_CLAIMS_PER_MINUTE |
int | 60 |
Job claims allowed per fetch node per minute. |
Auth¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_REQUIRE_API_KEY |
bool | false |
Reject requests without a valid X-API-Key header. |
EZMD_KEY_PEPPER |
secret | empty | Secret pepper for hashing API keys (secret). At least 32 bytes in public mode. |
EZMD_JWT_SECRET |
secret | empty | Secret for signing the short-lived challenge cookie (secret). At least 32 bytes in public mode. |
EZMD_IP_HASH_SALT |
secret | empty | Salt for client IP hashes (secret). Unset: falls back to the key pepper, then a fixed local salt. |
EZMD_KEYS_FILE |
path | unset | keys.json of API keys with per-key limits (hashed; docs/api.md). Unset: database keys only. |
Challenge¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_TURNSTILE_SITEKEY |
str | empty | Cloudflare Turnstile site key shown by the web UI. |
EZMD_TURNSTILE_SECRET |
secret | empty | Cloudflare Turnstile secret (secret). Setting it turns the challenge on for URL jobs. |
EZMD_TURNSTILE_REQUIRED_FOR_FETCH |
bool | false |
Require a Turnstile challenge for URL jobs even outside public mode. |
EZMD_TURNSTILE_JWT_TTL_S |
int | 120 |
Lifetime of the challenge cookie issued after a successful Turnstile check, in seconds. |
EZMD_TURNSTILE_VERIFY_URL |
str | https://challenges.cloudflare.com/turnstile/v0/siteverify |
Where the API posts Turnstile siteverify requests. Compose points it at Caddy's internal relay (http://caddy:9180/turnstile/v0/siteverify) because the API container has no egress (D-0044). |
Fetch¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_ALLOW_PRIVATE_NETWORKS |
bool | false |
Let URL jobs reach private, loopback, and link-local addresses. Leave false unless the instance is on a trusted network. |
EZMD_PLATFORMS_FILE |
path | unset | Path to a platforms.toml that marks hosts sanctioned, residential_only, or disabled. |
EZMD_FETCH_NODE_SECRET |
secret | unset | Shared secret fetch nodes send as a bearer token (secret, at least 16 characters). Unset: the fetch-node endpoints are not mounted. |
EZMD_FETCH_NODE_CIDR |
comma list | 100.64.0.0/10 |
Comma-separated CIDRs fetch nodes may connect from (the Tailscale range by default). |
HTTP¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_CORS_ORIGINS |
comma list | empty | Comma-separated origins allowed by CORS. Empty: same-origin only. |
EZMD_TRUST_PROXY_HEADER |
str | empty | Header carrying the client IP, honored only when the TCP peer is in EZMD_TRUSTED_PROXIES. Compose sets X-Real-IP (Caddy overwrites it, Cloudflare-aware). Empty: the TCP peer address. See Client IP above. |
EZMD_TRUSTED_PROXIES |
comma list | empty | Comma-separated CIDRs of the reverse proxies allowed to set that header. Compose sets the private ranges (only containers on internal reach the API). |
EZMD_IPV6_IDENTITY_PREFIX |
int | 64 |
IPv6 clients are counted per network of this many bits for rate limits, quotas, dedup and the challenge (a /64 is usually one subscriber). 128 counts single addresses. |
Observability¶
| Variable | Type | Default | Description |
|---|---|---|---|
EZMD_LOG_LEVEL |
debug / info / warning / error | info |
Log level. |
EZMD_LOG_FORMAT |
json / text | json |
json (one object per line) or text. |
EZMD_METRICS_TOKEN |
secret | unset | Bearer token (16+ chars, secret) for GET /metrics. Unset: /metrics is not mounted. |