node-red-contrib-dreamhostdns-updater 2.0.0
Node for updating sub domains in Dreamhost DNS
DreamHost DNS Updater for Node Red
A Node-RED node that keeps the A and AAAA records of a sub-domain in DreamHost DNS pointed at your current public IP addresses, using the DreamHost v1 API.
Setup
Create a DreamHost API key with the dns:read and dns:write permissions in the DreamHost panel. In Node-RED, add a DreamHost account config node once and enter the key there; every DreamHost node selects that account. Then set the domain and sub-domain on the updater node. Leave the sub-domain empty (or @) to update the zone apex. Keys for the old DreamHost API do not work with the v1 API.
The Update records setting picks the records the node manages: A and AAAA (default), A only (IPv4) or AAAA only (IPv6). The family you leave out is not looked up, not changed, and its payload.publicIPv4/publicIPv6 is ignored; publicIPv6 (or publicIPv4) is then undefined in the reply. A missing or unknown value means A and AAAA.
Why HTTPS
The public IP is looked up over HTTPS only (icanhazip.com and ipify.org, first answer wins), never DNS. Some networks redirect outgoing DNS (port 53) to their own resolver, so a DNS-based lookup returns the resolver's address and the node would publish the wrong IP.
Usage
Every message sent to the updater node starts an update run (msg.topic is ignored): the node resolves your public IPv4 and IPv6 addresses (over HTTPS, with public-ip), lists the records of the sub-domain, and submits a create or update for each A/AAAA record that differs. DreamHost applies changes asynchronously: the node replies as soon as DreamHost accepts them, with the task IDs in payload.tasks. Records protected by DreamHost are never changed and are reported as dns_record_protected.
The node has two outputs, and each message leaves on exactly one:
- done: no task is waiting (nothing to change, an error before any change was accepted, or accepted tasks that are already
success). - pending: at least one task is still
scheduled(payload.pendingistrue).
Optional msg.payload fields:
- payload.publicIPv4 — If set to a valid IPv4 string, it is used instead of auto-detection for the A record.
- payload.publicIPv6 — If set to a valid IPv6 string, it is used instead of auto-detection for the AAAA record.
- payload.ipLookupTimeout — Milliseconds for public IP lookup (default
10000). Ignored for addresses supplied manually above. - payload.apiTimeout — Milliseconds for each DreamHost request (default
30000).
Requires Node.js 24.15 or newer (see package.json engines). For local development with nvm, run nvm use in this repo; .nvmrc selects Node 24 (make sure the installed 24.x is 24.15 or newer).
Output in msg.payload (other msg properties pass through):
| Field | Meaning |
|---|---|
error |
true if any request failed or any task ended badly. false on the first reply means DreamHost accepted the change, not that it is applied yet. |
errorMsg |
Human-readable error, empty string if none. Never contains the API key. |
updateErrorMsg |
The errorMsg of this update run, empty string if none. |
errorCode |
DreamHost error code of the first error that has one, among the errors of the node that sent the message, else undefined. The status node does not copy the update run's code; only its own errors set it (that run's text is in updateErrorMsg). |
retryAfter |
Seconds to wait when DreamHost answered 429 to the node that sent the message, else undefined. |
pending |
true while any task is scheduled. |
gaveUp |
Set by the DNS task status node: true when it stopped checking at its limit (the updater does not set it). |
updatedIPv4 / updatedIPv6 |
A change to that record was submitted in this update run. |
tasks |
One entry per submitted change: {taskId, type, name, ip, status}. [] if nothing changed. |
checks |
Status checks done so far (0 from the updater). |
publicIPv4 / publicIPv6 |
The IPs used, so the message can be re-sent. |
A task ending in anything but scheduled or success (for example failure) sets error and names the record and status. If one record is accepted and the other rejected, tasks keeps the accepted one.
DNS task status node
Wire the updater's pending output to a DNS task status node (select the same DreamHost account) to follow the tasks until DreamHost has applied them. Each message checks every task still scheduled once and leaves on exactly one output:
- done: no task is
scheduledany more, the node gave up, or the message cannot be checked (no account, no key, or no tasks to check; these never go to pending). - pending: a task is still
scheduledand the limit is not reached. Wire it through a delay node back to the status node's input; the delay sets the wait between checks. The node keeps no timers or state.
The Give up after (checks) setting (whole number, default 10) caps the loop. When the check that reaches the limit still finds a task scheduled, the message goes to done with gaveUp: true, error: true, pending: true and an errorMsg like gave up after 3 checks: A record home task t1 is still scheduled. A failed check (for example HTTP 429, see retryAfter) keeps the task scheduled and is retried on the next pass, or reported with the give-up text at the limit.
The incoming updateErrorMsg is carried into errorMsg, so if one record was rejected and the other later succeeds, the final done message still has error: true naming the failure. All other incoming fields are kept; checks is incremented. gaveUp is false unless the node gave up.
Example Flow
In Node-RED open the menu, then Import, Examples, node-red-contrib-dreamhostdns-updater. After importing, open the DreamHost account config node and enter the v1 API key (dns:read, dns:write; the file holds no key), then set the domain (and sub-domain) on the DNS updater node, before deploying. Otherwise the first run, 5 seconds after deploy, raises an alert.
[every 10 min]
|
[DNS updater] --done--> [result]
| \---> [error?] --> [send alert here]
pending
v
[wait 2 min] <---------------+
| |
[DNS task status] --pending--+
|
done --> [result] and [error?]
Defaults: an update runs every 10 minutes and 5 seconds after deploy, the delay waits 2 minutes between status checks, and the status node gives up after 10 checks (about 20 minutes). The alert branch only sees messages from the done outputs, so you get one alert per finished run that ended with error: true, including a give-up. Usually the first check already ends the run. Replace the "send alert here" debug node with email, Pushover, Telegram or similar. Public IPs are resolved inside the node, so no separate IP discovery node is needed. If DreamHost tasks often take longer than the update interval, lower the give-up limit or raise the inject interval, so that a slow task is not resubmitted by the next update run.
Upgrading from 1.x
The node keeps its place in your flows. Select an existing DreamHost account or create one with a new v1 API key (the key that was stored on the node is no longer used). The old single wire now sits on the done output; wire pending as well (or import the example flow). msg.topic = "status" no longer checks tasks; use the DNS task status node.
Development
Install dependencies and run the checks (Node.js 24.15 or newer):
npm ci
npm run lint
npm test
The tests start a real Node-RED runtime and fake the DreamHost API, so they need no network access or API key.
No Node.js on your machine? Run the same commands in Docker from the repo root (the anonymous node_modules volume keeps your local node_modules untouched):
docker run --rm -v "$PWD":/app -v /app/node_modules -w /app node:24 sh -c "npm ci && npm run lint && npm test"
Continuous integration
Every pull request, and every push to master, runs these checks (.github/workflows/ci.yml):
- Test (Node 24):
npm ci,npm run lint,npm test. - OSV-Scanner: scans
package-lock.jsonfor known vulnerabilities.
master requires both to pass before a pull request can be merged.
All GitHub Actions are pinned to full commit SHAs (Dependabot keeps them current). A weekly workflow, Fresh dependencies (Node 24) (.github/workflows/fresh-deps.yml), installs without the lockfile and runs lint and tests, to catch upstream breakage early. It is not a required check.
Releases
Releases are automated. A scheduled GitHub Actions workflow (.github/workflows/release.yml) runs daily at 06:23 UTC. It re-runs lint and tests on master, then uses semantic-release to publish to npm if there are releasable commits. A day with nothing releasable publishes nothing.
- The next version comes from the commit messages since the last release tag (Conventional Commits):
fix:gives a patch,feat:a minor, and!or aBREAKING CHANGE:footer a major. Other types (chore,docs,test,ci) do not release. - Publishing uses npm trusted publishing (OIDC), so there is no npm token, and each package version carries npm provenance. Each release also gets a git tag (
vX.Y.Z) and a GitHub release. - The
versionfield inpackage.jsonin the repository is not the published version. The release sets it only inside the published package. Check the git tags or npm for the current version.