dmarc-analyzer
Open-source, self-hosted, agency-first DMARC analyzer
About this chart
dmarc-analyzer Helm chart
Self-hosted DMARC report analysis on Kubernetes. The same image and the same environment variables as the Compose deployment — see docs/ops/configuration.md, which is the single list of settings for both.
Install
helm install dmarc oci://ghcr.io/dmarc-analyzer-net/charts/dmarc-analyzer \
--version 0.15.0 \
--namespace dmarc --create-namespace \
--set auth.encryptionKey="$(openssl rand -base64 32)"
Or from a clone, which is the same chart without the version pin:
helm install dmarc ./deploy/helm/dmarc-analyzer -n dmarc --create-namespace \
--set auth.encryptionKey="$(openssl rand -base64 32)"
A published chart's version and appVersion are equal and come from the release
tag, so the chart version determines the default application version. Setting
image.tag or image.digest deliberately overrides that default.
Then reach the console and create the first admin account:
kubectl -n dmarc port-forward svc/dmarc-dmarc-analyzer 8080:80
That default is a trial: bundled PostgreSQL with no backups, and the encryption key in your shell history. See Production before relying on it.
The two choices
mode | combined (default) runs the console and ingestion in one pod. split runs them as two Deployments. |
postgres.enabled | true (default) bundles PostgreSQL. false uses externalDatabase. |
These are the same two axes the Compose files expose, so a deployment can move between Compose and Kubernetes without relearning its configuration.
Production
kubectl -n dmarc create secret generic dmarc-creds \
--from-literal=encryption-key="$(openssl rand -base64 32)" \
--from-literal=db-password='...'
helm install dmarc ./deploy/helm/dmarc-analyzer -n dmarc \
--set auth.existingSecret=dmarc-creds \
--set postgres.enabled=false \
--set externalDatabase.host=db.internal \
--set externalDatabase.username=dmarc \
--set image.tag=0.15.0
Where policy calls for immutable images, pin the digest instead of the tag:
--set-string image.digest=sha256:... renders repository@sha256:... for
every container in the release. Use the digest published for the release you
intend to run — the chart refuses a shortened or malformed one. The two cannot
be set together, and leaving both empty follows the chart's appVersion.
Six things worth doing deliberately:
auth.existingSecret. Otherwise the encryption key sits in your values file, your shell history, andhelm get values.- Back up that key. Lose or change it and every stored mailbox credential becomes undecryptable; each source has to be entered again. It is not recoverable from a database backup.
postgres.enabled=false. The bundled StatefulSet has no replication, no backups and no pooling. It is there to make a trial one command.- Turn on backup offload. The chart has no
backup:block — setBackup__Bucketand friends viaextraEnv, andBackup__SecretAccessKeyviaextraEnvFromSecret— but the feature is the same one Compose gets: a configuration export shipped to S3-compatible object storage, refused outright if the credential key above isn't set. Seedocs/ops/configuration.md. - On AWS, drop the database password.
Database__IamAuth: "true"inextraEnv, an IRSA role onserviceAccount.annotations, and a password-lessexternalDatabase.connectionString. An RDS or Aurora endpoint also needs the Amazon RDS CA bundle mounted throughextraVolumes/extraVolumeMountsand named inPGSSLROOTCERTviaextraEnv; an RDS Proxy endpoint needs no file. The worked example isdocs/ops/aws-rds-iam.md. - Pin
image.digestfor immutable deployments. A tag is still convenient for evaluation, and an emptyimage.tagfollows the chart'sappVersion, but tags can be moved. The chart refuses a non-empty tag and digest together so the selected image is unambiguous.
Migrations
migrations.strategy picks between a Job and applying them at startup. Left
empty it chooses startup with bundled PostgreSQL and job otherwise, and the
reason is ordering rather than preference: a pre-install hook runs before the
bundled StatefulSet exists, so on a first install a Job would sit waiting for a
database that is not there yet. With an external database there is nothing to
wait for and the Job is strictly better.
The Job runs APP_MODE=migrate, which applies pending migrations and exits.
Nothing is served and nothing is ingested, so it completes before any application
pod starts. Re-running it with no pending migrations logs "No pending
migrations; nothing to do." and succeeds, so an unchanged upgrade is a clean
no-op.
activeDeadlineSeconds defaults to 900. The largest shipped migration rewrites
about 5.3M rows in roughly 94 seconds, so the default has room, but a very large
database may want more.
Resources
Every container ships with a memory and CPU request and no limit:
| Values key | Memory | CPU |
|---|---|---|
app.resources | 384Mi | 100m |
worker.resources (split mode) | 384Mi | 100m |
postgres.resources (bundled) | 256Mi | 100m |
migrations.resources (the Job) | 128Mi | 50m |
waitForDatabase.resources (init container) | 64Mi | 50m |
The wait-for-database init container, which runs before the app, the worker and
the migrate Job whenever there is a database host to wait for, carries one too.
At the defaults it does not change how the pod is scheduled. Kubernetes sizes a
pod per resource, taking the larger of its biggest init container request and the
sum of its main containers' requests, and the main containers ask for more. That
stops being true if you remove the main containers' requests or set them below
64Mi/50m; the init request then decides that resource. It is there because a
namespace with a ResourceQuota on requests rejects any container without one.
The requests are there for scheduling and eviction. With no request, the scheduler counts the pod as using nothing and will put it on a node that is nearly full, and under memory pressure the kubelet evicts pods that use more than they requested first, which with no request means all of their usage. One such node evicted the app minutes after a roll and turned away every replacement until the pressure passed. 384Mi covers the combined pod's steady state on a single-mailbox instance (about 290Mi). Raise it for many mailboxes or a large backfill.
There is no memory limit because the failure it would cause is worse than the one it prevents. Ingestion memory grows with the size of a sync pass, and a limit turns a large backfill into an OOM kill partway through. Add limits in your own values if your cluster requires them.
To remove a request, null it rather than emptying the map. Helm merges your
values into the chart's, so resources: {} merges into the default and changes
nothing:
app:
resources:
requests: null # renders resources: {}
Values validation
values.schema.json is checked by Helm before install or upgrade, and Artifact
Hub renders it as a values reference. It catches the class of mistake templates
cannot see — a mistyped key, a string where a number belongs, a value outside the
allowed set — and it catches them before anything reaches the cluster:
Error: values don't meet the specifications of the schema(s) in the following chart(s):
dmarc-analyzer:
- at '/postgres': additional properties 'enable' not allowed
auth.encryptionKey is pattern-checked against what the application will actually
accept: base64 decoding to exactly 32 bytes. Getting that wrong used to surface as
a crash loop after install.
image.digest is likewise restricted to a complete lowercase SHA-256 digest
(sha256: plus 64 hexadecimal characters), so a shortened or malformed pin is
rejected before Kubernetes sees it.
The cross-field rules below stay in the templates, because they need to explain themselves rather than just fail.
What the chart refuses
Some configurations would install successfully and then misbehave in a way that is hard to attribute. The chart fails at template time instead, with the reason:
| Configuration | Why it is refused |
|---|---|
mode=combined with app.replicas > 1 | Every app pod runs its own ingestion loop, so N replicas are N schedulers claiming the same mailboxes — duplicate IMAP sessions and duplicate sync runs. Use mode=split to scale the console. |
worker.replicas != 1 | There is no claim mechanism in the queue. Two loops duplicate every sync pass and can send duplicate alert and digest email. The application refuses it too, with a Postgres advisory lock, so extra replicas crash-loop. |
migrations.strategy=startup with app.replicas > 1 | Replicas race to apply the same migration. |
postgres.enabled=false with no externalDatabase.host | Nowhere to connect. |
No auth.encryptionKey and no auth.existingSecret | Mailbox credentials would be stored in plaintext. |
Both image.tag and image.digest | A mutable tag and immutable digest name two competing image-selection strategies. Leave the tag empty when using a digest. |
Scaling
app.replicas scales the console freely in mode=split — APP_MODE=api takes no
lock and runs no loop.
The worker is pinned to one replica. That is a property of the application, not of
Kubernetes: it holds a Postgres advisory lock for the life of the process and a
second worker exits rather than starting. docs/planning/backlog.md lists what
lifting the limit would take.
Notes on the internals
- The Secret and ServiceAccount are
pre-installhooks. Hooks run before ordinary resources, so the migration Job would otherwise be rejected with "error looking up service account" and never create a pod. Both usebefore-hook-creationso they persist for the ordinary Deployments to use. Consequence:helm uninstallleaves them behind. - An init container waits for the database. Kubernetes has no equivalent of
Compose's
depends_on: condition: service_healthy, so without it the app starts first, fails with "Name or service not known", and restarts until the database is up. It converges either way, but the restarts look like a crash-loop and the backoff can turn a 20-second wait into minutes. Skipped whenexternalDatabase.connectionStringis used, since the host is not known separately. - The worker Deployment uses
Recreate. A rolling update would briefly run the old and new worker together — the exact overlap the replica pin exists to avoid. - The worker has no probes. It serves no HTTP. Its loop already catches every exception in a pass and retries with backoff, so a failing pass degrades ingestion rather than crash-looping the pod.
readOnlyRootFilesystemis on, with anemptyDirat/tmpbecause .NET needs somewhere to write.
Deploy dmarc-analyzer with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has dmarc-analyzer on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartdmarc-analyzer is pinned at v0.15.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply