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 ipfs.io
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 nickmontgomery.com with your domain.
ipfs key gen --type=rsa --size=4092 nickmontgomery.com ipfs name publish --key= nickmontgomery.com QmdGMhGo8qAv9uxhn2gWfMkM57ubfpM386wNz3GqPatT2H
Great now I could access my content by navigating to ipns://nickmontgomery.com
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
nickmontgomery.com. 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)
www.nickmontgomery.com. 300 IN CNAME cloudflare-ipfs.com.
then I went over to cloudflare and followed the setup instructions cloudflare ipfs