Gabe Rocks!
🖥️ Tech 🤔 Rambling 🐷 Health

Getting the most decentralization out of a simple static site

Years ago I started to rebuild my productivity from the ground up by writing. I do not at all consider myself a fantastic writer, but I have certainly fallen in love with the art. I believe that a static site is the best tool for personal expression, growth, and learning in our modern age. It’s your own space to really just share as much or as little as you want, and I really think that’s great. When I first started sharing my weight loss journey, it was great to have a small place to share thoughts and updates at my own pace. Just like weight loss has very much been a learning journey, so has my time running this and other sites.

Setting up your own static site is a simple gateway drug to self-hosting and many other fun and exciting things. My sites were in many ways inspired by this Luke Smith Hugo tutorial that outlines just how flexible static site generators can be to build something truly to your own needs. Of all the things I’ve accomplished online in the last few years, one that I’m quite proud of is to be linked by Dig Deeper which has been a go-to resource for me in much of my early learning. In this time of generative AI flooding cyberspace we should encourage more people to truly embrace the free and open web, rather than just concede it to corporate slop.

I’ve even written up my thoughts on getting the most performance while using a simple site. Despite my love for multimedia, I really think that transport neutrality is crucial for personal expression in our time. While it’s technically possible to export a site as an epub book for most purposes I’d argue it’s good enough to simply zip up the static files and then load them with python -m http.server from the unzipped directory. This alone makes a simple static site an incredibly robust censorship resistant multimedia format. A silly thing I tried was seeing if I could partially federate my static site to the social web, but I could only get it to work on Mitra, rather than Mastodon. I didn’t realize nostr pages were a thing, but it turns out you can publish your posts to nostr with a took like nsyte

But you can always go further. I’ve mirrored my sites to Tor and I2P but I hit a snag right away. Many things, but especially RSS feeds require absolute links. You can’t just point various origins to the same simple directory. This means that at minimum, you’ll want to generate your site multiple times. With hugo you can use the -b flag to change the baseURL value to your tor/i2p address. This solves links, but when you’re trying to add lots of audio and video, that means you’re tripling a lot of redundant storage of the same files.

This was a problem I wanted to overcome this year because I accidentally deleted my PeerTube database and wanted to serve all my audio & video creations directly from my web sites. This created a new problem where I basically tripled the VPS storage per site. For now that’s not a lot, but in the long run it really could be. This next year I’m hoping to get a lot of skating & rollerblading footage so let’s just say I’m preparing to share lots more.

One of the cool things I did in setting up my hugo sites was to make them integrated into a continuous delivery pipeline. I honestly don’t know much about CI but auto-publishing on a git push command seemed to make a lot of sense. I accomplish this via a Forgejo webhook on my own self-hosted repository based on Gitea. The webhook runs a very simple script that updates the site. Originally, I thought I wanted to solve my video redundancy problems, I would need to ambitiously upgrade my sites to a brand-new CMS, that supports transport neutrality. I eventually settled on a decent half-measure: just updating the script to use symlinks on the files.

So my final webhook script looks something like this, using rsync to upload the files to the vps

Clearweb

git pull 
#Gets the latest updates
rm -r public 
#Erasing the previous build
hugo -b "https://gabe.rocks" 
#Clearweb domain, included for clarity but can also be configured from your site's config
rsync -avhzzP --delete public/ vps:/var/www/gabe.rocks 
#upload the site to /var/www/
ssh vps ln -s /var/www/gabe.rocks/index.xml /var/www/gabe.rocks/rss 
#allows me to have the rss feed at /rss rather than index.xml

Tor & I2P with /media de-deduplicated


hugo -b "http://gabriel262me3lgv3w7xohtesg3laoojmtye644pwirhdm73qmedmsqd.onion" 
#Now with the Tor domain
rsync -avhzzP --delete public/ --exclude media vps:/var/tor/gabe.rocks/ 
#Uploads the tor version to /var/tor/
ssh vps ln -s /var/tor/gabe.rocks/index.xml /var/tor/gabe.rocks/rss 
#Same RSS thingy
ssh vps rm -rf /var/tor/gabe.rocks/media
# Removing the existing directory (if it exists)
ssh vps ln -sf /var/www/gabe.rocks/media /var/tor/gabe.rocks/media
# Linking the media directory to the clearweb version

hugo -b "http://gabe.i2p" 
#Now with the I2P domain
rsync -avhzzP --delete public/ --exclude media vps:/var/i2p/gabe.rocks/ 
#Uploads the i2p version to /var/i2p/
ssh vps ln -s /var/i2p/gabe.rocks/index.xml /var/i2p/gabe.rocks/rss 
#Same RSS thingy
ssh vps rm -rf /var/i2p/gabe.rocks/media
# Removing the existing direci2py (if it exists)
ssh vps ln -sf /var/www/gabe.rocks/media /var/i2p/gabe.rocks/media
# Linking the media directory to the clearweb version

Of course, in this case you need to save all your larger assets to a single or few directories to work. I personally think when it comes to maximizing potential reach, this setup maximizes potential reach while minimizing headaches. It’s probably not novel or brilliant, but I think it was worth explicitly sharing. I’ve recognized that learning what I have has only grown my hunger to build more, and I am eager to actually build tools with these approaches in mind. Personally, I’m thinking I’ve done as much as I can with these sites for my tastes, so I’m learning to build something that may really change things. Sadly, I’ve fallen behind on many of my tech projects and so my goal is to catch up this Winter, and hit running in the new year.

If I can lose almost 350lbs in such a short time, maybe trying to learn to be an actually good programmer won’t be so bad after all.


Reply to this post

Site Information Hugo Web Tor I2P
Prev B @ Next