Prompt: publish a static site at your domain over IPFS
Have an agent put a folder of static files (a built site, docs, a landing
page) online at https://<hostname> on the ird IPFS gateway — with a
stable IPNS name, so updates are a re-publish, never a DNS change — and
keep the pin lifecycle tidy so you pay for one copy.
Needs: ird access (MCP server or the ird CLI, logged in); the hostname must be on a zone hosted on ird DNS; local access to the site folder
Costs: hourly per MB pinned plus per MB served (credits_prices → recurring.ipfs-pin-hourly); the IPNS name and DNS records are free
Group: hosting
Paste everything below the line into a fresh conversation. Fill in the
FILL IN block first.
Task
Serve the folder below at https://HOST via IPFS + IPNS. First-time
setup creates the name and DNS; every later run is: pin the new build,
re-point the name, verify, unpin the old build.
FILL IN
HOST: docs.example.ro # hostname on a zone hosted on ird DNS
FOLDER: ./dist # local folder; index.html at its root
KEEP_PREVIOUS: no # yes = keep the previous build pinned for instant rollback
Non-negotiable rules
- Cost check before pinning. Measure FOLDER (
du -sh), compute the
monthly cost from credits_prices (per_mb_hour × MB × 730), and show
it. If FOLDER is over 500 MB, stop and ask.
- One live pin per site. Name the pin
site:HOST. After a successful
publish, unpin the previous root (unless KEEP_PREVIOUS) — otherwise
every deploy adds a permanent charge.
- Never unpin before verifying. The new CID must serve correctly
through the gateway first; a broken build stays on the old pin.
- No AAAA on HOST. The gateway is IPv4-only and a stale AAAA blocks
its certificate. Check
dns_get_zone and remove one if present.
Steps
A. Check the folder. FOLDER/index.html must exist. Links and asset
URLs should be relative or root-relative — both work — but be aware the
gateway answers a missing path with a fallback page (HTTP 200), so
broken links don't 404; check for them with a local static server
(python3 -m http.server) before publishing. Symlinks are rejected.
B. Host setup (first time only). ipns_list — if a name for HOST
exists, skip. Otherwise ipns_create(hostname=HOST, serve=true) (CLI:
ird ipfs ipns create HOST --serve). This creates the k51… name,
attaches HOST to the gateway, writes the A record now and the _dnslink
TXT once the name activates, and issues the certificate (about a minute).
Requires HOST's zone in dns_list_zones; if it isn't, stop and point me
to the register-domain or bring-domain-dns prompt.
C. Find the previous root. ipfs_pins(search="site:HOST") — note the
CID of the currently pinned root (may be none). ipns_list shows what
the name points at now; the two should agree.
D. Pin the new build. ipfs_add(path=<absolute FOLDER>, name="site:HOST")
(CLI: ird ipfs add FOLDER --name site:HOST). It blocks until pinned
and returns the root CID and a gateway URL. If the CID equals the previous
one nothing changed — say so and stop.
E. Verify by CID first. Fetch the returned gateway URL (/ipfs/<CID>/):
the index must render and a couple of asset paths must return the real
files, not the fallback page. This bypasses DNS and IPNS caches.
F. Publish the name. ipns_publish(name=HOST, cid=<CID>) (CLI:
ird ipfs ipns publish HOST <CID>). Propagates within minutes; the domain
keeps serving the old root until its DNSLink cache expires (the zone's
TTL, typically ≤ 1 h). First-time setups also wait for the certificate.
G. Clean up. Unless KEEP_PREVIOUS: ipfs_unpin(<previous CID>)
(CLI: ird ipfs pin rm …). Then ipfs_pins(search="site:HOST") must show
exactly one pinned entry (two if KEEP_PREVIOUS).
H. Rollback (if I ask). ipns_publish(name=HOST, cid=<previous CID>)
— only possible while that CID is still pinned; that's what
KEEP_PREVIOUS buys.
Deliverable
HOST, the new root CID, the gateway URL, the IPNS k51… address, the
pin list for site:HOST, monthly cost estimate, and the time by which
https://HOST will serve the new build.