Hosting this site on IPFS

How this site was setup to use IPFS for content distribution and publishing

What is IPFS

IPFS “Inter Planetary File System” is a distributed content storage and retrieval system, that aims to replace HTTP.

You can think of it like BitTorrent but for web content.

See more info here

Why is it important

My personal opinion is that this technology has potential to re-imagine how we distribute and access content. the idea of a distributed network that is fault tolerant and does not rely on a central provider has a lot of upsides around content uptime and retrieval time.

How this was Setup

First I had to install ipfs locally. I did this very simply by running

brew install ipfs

I then generated some content using hugo a static site generator.

after I had some content to put up I had to publish it.

This was pretty straightforward I started the ipfs daemon and ran the following command from my local content storage.

ipfs add -r public/

which yields a Content ID that looks like ‘QmXmhvCLYpTdAernJT2redyd6EVpj3pcVYGfyrRDrfxoMk’

I could then access my content through ipfs I chose the brave browser to test this out as it now has native IPFS support for more information on this see the following link Brave Integrates IPFS

This was nice and all but not really human readable

so I decided I would set up IPNS the InterPlanetary Naming System which is the ipfs version of dns more or less

I generated a new key for my namespace and then published my content under it. In the following example you would replace with your domain.

ipfs key gen --type=rsa --size=4092
ipfs name publish --key= QmdGMhGo8qAv9uxhn2gWfMkM57ubfpM386wNz3GqPatT2H

Great now I could access my content by navigating to ipns://

But what about people on the current standard HTTP?

IPFS has a solution for this as well they call it DNSLink

I had to add a couple of host records to my name server which trivia A text record that has my public key id which was returned from ipfs name publish command above	300	IN	TXT	"dnslink=/ipns/k2k4r8l245po0ouzrmffel4enree4oxor5pgdnbuaqlhd3klic2gsuxl"

and a CNAME record to an ipfs gateway (you can host these yourself but I chose to use the one provided by cloudflare)	300	IN	CNAME

then I went over to cloudflare and followed the setup instructions cloudflare ipfs

Cloudflare Setup Screen