logfile.ch

logfile.ch is now available on IPFS

You can now read this blog on IPFS, the new decentralised data store, using its IPNS hash:

ipns/QmVvWyHBz86fr7oHXrcbYCnLgwd2SGDQad5WvZ3e176Ex9

The link points to the public IPFS gateway, but if you run your own node you should also be retrieve logfile.ch using the above hash (or you can use tools such as ipfs-firefox-addon or ipfs-chrome-extension to get your browser to automatically rewrite links to the public gateway to access your local node instead).


How does it work? The blog is using Jekyll, which creates static HTML files that are then uploaded to the webhost. Unfortunately Jekyll builds a nested folder structure and relies heavily on relative URLs to the top of the tree for links (linking to e.g. /index.html). This breaks when retrieving the page from IPFS, as it lives under its IPNS hash at the gateway. The clean solution would probably be to modify the Jekyll configuration such that it uses a flatter hierarchy that is more amenable to fully relative URLs or to write a plugin that identifies where a page in the tree is and then uses a fully relative ../ directory traversal to get to the top level. For now, I have adopted the “quick and dirty” solution: I run a second Jekyll build with a separate configuration file that specifies the baseurl as /ipns/QmVvWyHBz86fr7oHXrcbYCnLgwd2SGDQad5WvZ3e176Ex9. This version gets stored on IPFS. This works for the normal gateway configurations, but it will fail if people run their gateways within subdirectories or different top-level folder names.

Once the site has been generated by Jekyll, getting it up and running on IPFS is as simple as installing IPFS and running this short shell script:

#!/bin/bash

NEW_HASH=`ipfs --api=/ip4/127.0.0.1/tcp/5001 add -q -r /home/me/logfile_ch/ | tail -1`
echo `date` --- $NEW_HASH >> /home/me/ipfs_logfile_ch.txt
ipfs --api=/ip4/127.0.0.1/tcp/5001 name publish $NEW_HASH

It logs the IPFS hashes for each new upload to a file, which also automatically generates a full history of how logfile.ch looked like in the past.

If you want to make sure that your sit stays up, you need to keep an IPFS node running which pins your site. Or you can use a service such as PinBits which will pin any hash for a fee. For logfile.ch, I am currently running my own IPFS node on a cheap VPS.

Does all of the above just sound like far too much work but you still want to get your page on IPFS? Then you can always put your page on Neocities. They automatically provide IPFS hashes for all sites they host (admittedly I gather that the feature is currently switched off, but they promise that it will return much better than before soon).