💾 Archived View for capsule.wetterberg.nu › 2021 › 2021-01-07-gemlog-server.gmi captured on 2023-06-14 at 14:01:54. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

Gemlog server

Yesterday evening I wrote a git-based gemlog server for my personal capsule. The way it works is that it uses a bare git repository (a git repository without a working directory) and reads the content directly off the commit tree and blobs.

Gemlog server

At startup it installs a post recieve hook (bash script) that sends a SIGUSR1 to its PID. When it gets a USR1 signal it checks the tip of the main branch and re-reads the changed content. That way I don't have to use some pesky polling or set up recursive inotify ssubscriptions.

• • •

The server holds all content in-memory. My assumption here is that it will take a really long time for me to write enough text for this to became an issue. The content is tracked by its blob hash, and evicted when no file is referencing it.

I don't know if it would be interesting for anyone, but it would be neat to render a change-log at the end of each post, possibly with a link to the diffs.

• • •

My current workflow is to write my posts on the reMarkable and use its OCR feature to email the drafts to myself. This gives me a near-analog writing experience, but without the hassle of actually having to transcribe my scribbles from paper.

Then I touch up OCR mistakes and do some light editing in Emacs and commit it as YYYY-MM-DD-subject.gmi. The server will pick up any files starting with a date and add them to the index page. Publishing is then as simple as:

# Initial setup:
git remote add gemlog hugo@capsule.wetterberg.nu:gemlog/content
git push -u gemlog main

# Publishing changes:
git push