Rickipedia

Publishing my Website to the peer-to-peer Web

I’ve been experimenting with the DAT protocol for a little while now and wanted to get my website up on the peer-to-peer Web. There’s a few different ways to do this, but I wanted a method that worked well with my already existing method of deployment.

1. Building

My website is currently written in Rust using stdweb and building it is a single command:

cargo web build --target=wasm32-unknown-unknown

This creates a folder (./target/deploy/) that’s ready to “deploy”

2. Deploy

I deploy changes to my website using rsync which looks something like:

rsync -avz -e "ssh -p 9999" ./target/deploy/ user@hostname:/path/to/website/

(modified slightly)

3. Creating a DAT version

I created the DAT version of my website using the dat command line tool. Once that was set up I also created a copy using hashbase.io so I wouldn’t have to worry about seeding it myself.

4. Synching Changes to DAT

Synching changes to the DAT version is just a matter of copying the freshly built site (while keeping track of changes1) and running dat sync using the dat command line tool:

rsync -r --size-only target/deploy/* ignore/dat/
dat sync --dir=path/to/dat

That’s basically it. For simplicity I add all the commands to a deploy.sh shell script so I can simply run bash deploy.sh to deploy changes to both the http(s) and DAT versions of my website in one go.

Now you can visit ricky.codes with a browser that supports the DAT protocol (like Beaker).

1Changed from cp -r ... to rsync --size-only … so we don’t needlessly replace files and create new revisions… (I actually blew through my hashbase.io allotment doing this). Perhaps managing all this in a different git repo would make more sense?

Further Reading

How I publish taravancil.com on the peer-to-peer Web

Written on Sep 5, 2018.