homebase, for syncing updates from the dat:// version of my website to the https:// version

1. Building my website

This website is a pretty standard static website operation. I use Hugo to generate the markup that composes its pages. I don’t have much to say about Hugo other than it works for me. Jekyll seems like a decent static site generator as well.

If you’re curious to learn more about how Hugo works, the source for this site is at github.com/taravancil/taravancil.com. Something worth mentioning is that I don’t use Hugo’s baseURL option and I set canonifyurls = false in my config.toml. This makes it possible to use relative URLs, so whether someone visits the site via dat:// or https://, internal links always follow that protocol choice. For example, an internal link to my blog looks like this:

<a href="/blog">Blog</a>

When I’m ready to publish an update, I run Hugo and it generates a new version of my website in the /public directory.

$ hugo

2. Publishing my website with Dat

I use the Dat CLI to publish and sync updates to my website. You can install dat with npm:

$ npm i -g dat

After generating my website with Hugo, I cd into the /public directory and run the dat command:

3. HTTP mirroring

Currently dat:// is only supported in Beaker, so I need my website to work over https:// too.

Further, dat:// URLs are long and difficult to remember, so it would be nice to be able to access the dat:// version of my site at a shortname like dat://taravancil.com. Luckily, Beaker supports this! Beaker piggybacks off of DNS authentication in combination with the /.well-known convention to enable dat:// shortnames. When you visit dat://taravancil.com in Beaker, it sends a request to https://taravancil.com/.well-known/dat and expects to find a file that looks like this:

homebase

Paul and I built a tool called homebase that provides HTTP mirroring, sets up TLS with Let’s Encrypt, and configures dat:// shortnames.

To get started with homebase, you’ll need a server with Node.js and npm installed. Something like a Digital Ocean droplet or an EC2 instance will work. You should follow the complete homebase instructions if you decide to use it, but here’s a short list of tasks that are easy to forget:

Configure your DNS records to have A record that points to your server’s IP address

Make sure ports 80 (HTTP), 443 (HTTPS), and 3282 (Dat) are open on your server

Let me know if you try out this workflow! I’m @taravancil on Twitter and I hang out in #beakerbrowser on freenode. I’d love to hear how it goes for you, or offer a helping hand if you run into trouble.