publish to ipfs
So I had some fun deploying this site to IPFS. It now got its own IPNS id. So this is how to do it:
hash = `ipfs add -rQ output`
ipfs name publish --key=mazin /ipfs/$hash
where mazin
is a key I generated for this purpose. This will publish the site to
/ipns/k2k4r8m6xgrtragqajq4cbxipfnkunw9u3wvfsjqj6xapqyl4knxthjz
The key makes sure to publish to the same IPNS hash every time.
The only thing I had to fix was making sure all paths in the site are relative. An absolute path won’t work since the root will be in a different place on IPFS.
Update in April 2023: to generate the key I did
ipfs key gen --type=rsa --size=2048 mazin
then it will be available at this IPFS node and have a unique hash associated. However to use the same key somewhere else the key needs to be exported and imported at that node. There ipfs key
variants for doing this. If this would need to be part of a bigger thing I would probably put the key in some kind of secrets manager.
written by fredrik at 2021-12-05 · updated at 2023-04-11
More content on ipfs