How to mirror worg to a hyperdrive

During the Q&A session of the EmacsConf 2024 hyperdrive.el talk, Ihor Radchenko suggested using hyperdrive to distribute worg, the community-driven Org documentation written in Org format.

Thanks, Ihor!

Mirror worg to a hyperdrive

You can run these commands on a local or remote machine. I chose to mirror worg to a hyperdrive on a remote Debian 12 VPS so that the content stays available when I turn off my computer.

Install git, dtach and drives cli:

sudo apt install git dtach npm
npm install -g drives

Clone worg, then create a new corestore and hyperdrive:

git clone https://git.sr.ht/~bzg/worg/
cd worg
drives init
drives touch # Copy hyperdrive public key from output

Mirror the worg repository into the newly created hyperdrive:

# drives mirror --dry-run . bpb1bq6sdfajw4bok7k9tdmrq153pbwzcyfkrqrfxw3hhihyddhy # Dry run first
dtach -n /tmp/drives-worg-session drives mirror --live . bpb1bq6sdfajw4bok7k9tdmrq153pbwzcyfkrqrfxw3hhihyddhy # From output of `drives touch`

Note that drives ignores the .git folder out of the box. Running the command inside a dtach session is a quick and dirty way to make the process persist after we've disconnected from the VPS. A better approach would be to write a service file to register the drives process with the init system (Debian 12 uses systemd).

To automatically pull the latest changes from the remote worg repository, add a cronjob with crontab -e:

30 0 * * * git -C ~/worg pull

Voilá! worg is now continuously mirrored to a hyperdrive, which can be explored, linked to, transcluded, and more using hyperdrive.el:

hyper://bpb1bq6sdfajw4bok7k9tdmrq153pbwzcyfkrqrfxw3hhihyddhy/

If you're viewing this file in Emacs with hyperdrive.el installed, follow this link to view the "Introduction to Org-Mode and Worg" in the hyperdrive mirror:

hyper://bpb1bq6sdfajw4bok7k9tdmrq153pbwzcyfkrqrfxw3hhihyddhy/index.org#%3A%3A%2AIntroduction%20to%20Org-Mode%20and%20Worg

I hope this helps you. Feel free to contact me with suggestions, corrections, or questions!

Last updated 2024-12-20 Fri 00:37 PST. History | Sitemap