💾 Archived View for gemini.complete.org › adventures-hosting-my-site-on-gemini captured on 2024-08-18 at 17:41:18. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-07-09)
-=-=-=-=-=-=-
Updated: 2024-07-06
Well, I finally decided: it is time to host this site in Gemini[1]. As noted in How this site is built[2], it is written in org-mode[3] using org-roam[4], is part of the Small Web[5], and thus is a perfect fit..... right?
I should begin with: I find Gemini to be really appealing. I can actually surf Geminispace as I did Gopherspace and the web decades ago. I don't really surf the web anymore; I search the web for something specific, but the organic discovery of interesting corners is just lacking these days. So I've been enjoying Gemini. As one of the people that started preserving Gopher about 20 years ago, it fits right in with my interests.
And thus began quite the adventure.
This site is now available at gemini://gemini.complete.org/
My Gopher site is available at gemini://gemini.quux.org/
One of the recurring themes that you will see here is that many tools are quite buggy and also abandoned. I'm not sure what this says about the community; it seems to still exist and even thrive, but the barriers to entry due to bugginess and abandonware are high.
Gemini's native document format is called gemtext[6]. It is similar to, but not identical to, Markdown. Notably the link format is different, and links never occur inline within a paragraph.
6: https://geminiprotocol.net/docs/gemtext.gmi
I initially thought, based on a blog story[7], that I could use ox-gemini[8] to export my org-mode files directly to Gemini. Unfortunately, this didn't work well at all. For one, the org-mode `id:` links weren't resolved (and thus every internal link was broken). Additionally, filenames contained the org-roam date/time component, which is part of the unique identifier but useless and annoying as part of a URL. It couldn't strip those as I did with ox-hugo and Hugo's slug. So I pretty soon decided I would go via Hugo for the Gemini site as well.
7: https://diesenbacher.net/blog/entries/setup-of-my-blog.html
8: https://git.sr.ht/~abrahms/ox-gemini
There are two options for that. The first I tried is gmnhg[9]. However, it had its own Markdown parser, and didn't respect Hugo's slug (creating unsightly filenames). Also ox-hugo uses Hugo shortcodes to properly look up the destination for a link, and gmnhg refused to use them, so all the links were really quite broken.
9: https://github.com/tdemin/gmnhg
Then I tried Hugo-2-Gopher-and-Gemini[10]. This also required quite a bit of tinkering and had some of the same brokenness and gmnhg. Eventually, since it actually invoked Hugo, I was able to submit a patch[11] to fix the shortcodes. However, this project's own Markdown-to-gemtext converter was seriously flawed; it would mess up bulleted lists if the Markdown entries for a list contained a newline (valid in Markdown, but not gemtext). It also didn't work right if I used a dash instead of asterisk for bullets in Markdown. It was basically a regexp converter that was never going to work.
10: https://github.com/mkamarin/Hugo-2-Gopher-and-Gemini
11: https://github.com/mkamarin/Hugo-2-Gopher-and-Gemini/pull/2
So I figured, OK, there are lots of tools to convert Markdown to gemtext on awesome Gemini[12]; why not use one of them?
12: https://github.com/kr1sp1n/awesome-gemini
They also turned out to be largely buggy:
13: https://github.com/makew0rld/md2gemini
14: https://www.makeworld.space/2023/08/bye_gemini.html
So I run things through `md2gemini -l paragraph --ascii-table`.
Back with the hugo-to-Gemini conversion, I don't use the Python cleanup script; I run Hugo and then use md2gemini and fix it up from there.
There are still some issues; the HTML href targets -- written into the document as ``, still bled through. And, the `/gemini-page.gmi` (aka index.gmi) for the generated URLs couldn't be removed. So...
find public-gg -name 'index.gmi' -print0 | xargs -0 perl -pi \ -e 's,^=> (/[^ ]*?/)gemini.page.gmi ([0-9]+: /[^ ]*?/)gemini.page.gmi,=> \1 \2,' \ -e '; s/]+\}//'
There are a lot of options for hosting Gemini. For instance:
15: https://github.com/gemrest/windmark
16: https://sr.ht/~int80h/gemserv/
17: https://sr.ht/~gbmor/laika/
18: https://tildegit.org/solderpunk/molly-brown
19: https://github.com/jahzielv/titan
20: https://git.sr.ht/~garritfra/taurus
21: https://github.com/spektom/hydepark
22: https://github.com/n0x1m/gmifs
23: https://code.rocket9labs.com/tslocum/twins
24: https://github.com/michael-lazar/jetforce
I required virtual hosting and proxying was a near-requirement, so I wound up with twins.
Now let's talk TLS. The twins documentation[25] covers self-signed certificates as well as Let's Encrypt. The Gemini spec recommends clients use Trust On First Use (TOFU). There are a lot of issues with that; if a site rotates its cert, the client will throw an error. So people use very long expiry times (years). Obviously the experience with Let's Encrypt won't be great.
So I made my cert. I got twins up and running. It's reasonably easy. The featureset is good, though while it can log requests using the Apache format, it inexplicably doesn't log client IP addresses. Weird.
I couldn't find any server that did full redirects; for instance, to redirect `gemini://complete.org/ANYTHING` to the corresponding path under `gemini://gemini.complete.org/` -- nothing could do that. twins could redirect any page under one site to the homepage on another, but couldn't do a basic pattern redirect.
I actually have two sites: this one, and a Gopher site on quux.org[26]. I saw there is a proxy that lets you browse Gopher from Gemini called agena[27], written by the originator of Gemini no less. "Great," I thought. "This will be easy."
27: https://git.sr.ht/~solderpunk/agena
Ha ha. No.
So it turns out that Agena is more buggy than the rest. I had to fix a bunch of things:
Eventually I got it working.
Perhaps I will add Gemini support to pygopherd; it shouldn't be hard.
This should have been easy. I mean, Gemini is much simpler than the general modern web. But it turned out to be rather more complicated than the small web at least, due a lot of broken and abandoned tooling. A lot of the tooling gives the vibe of not being really tested or finished. I am concerned about the security picture here too.
But, here it is, and I hope to enjoy it!
--------------------------------------------------------------------------------
Gemini is a modernization of Gopher[29]. It is an example of Small Technology[30]. It uses its own protocol and a document format based on Markdown. It is something of a successor to Gopher[31].
30: /old-and-small-technology/
This site is built for modern clients using Small Technology[33]. It is served from static files, which are themselves small. It should make no references to any resources from other servers, which helps protect the Privacy[34] of visitors.
33: /old-and-small-technology/
(c) 2022-2024 John Goerzen