KJayMiller

The Headless Keyring Saga

I've been a happy [Teahouse.cafe] user since I hear there was a project focused on hosting static sites. With GitHub all but having forgotten about GitHub pages, I've been on a mission to reduce rebuilding through GitHub actions.

Why though

Similar to [BPDs move to Django] I want to prioritize convenience. This is why I built the [render-engine-pg-cms]. This personal cms stores blog posts, tags, and more in PostgreSQL which means that data can be updated by many different tools. This also means that I can detach content from code changes.

The traditional way that I've been deploying my site is through TeaHouse's deploy GitHub Action. I want to completely divorce my website from GitHub. A big piece of that is moving deployment into the cms. This would allow the blog post to be controlled manually. The way to do that is [swiss-army-upload], TeaHouse's manual upload manager.

Unable to find viable credentials keyring

The steps to setup the uploader are simple.

uvx swiss-army-upload login tea://

I'm then prompted with a username and password. Once logged in:

render-engine build && uvx swiss-army-upload sync output tea://kjaymiller.com

Failure 0: Known Issue with MacOS

I first ran into this issue a couple weeks ago. The original issue came up with me trying to deploy this from my Mac. I'm not talking about this here because stopped using MacOS so this is no longer an issue.

The failing issue: Missing Keyring

On my homelab, I didn't have a keyring setup. So I would get an error when I tried to login.

swiss-army-upload login tea://
RuntimeError: Unable to find viable credentials keyring

The uploader stores credentials through Python's keyring package, and my machine didn't have a keyring setup. One quick solution that AI suggested was uvx --with keyrings.alt, which adds a plaintext file backend to the ephemeral uvx environment. Quick fix to publish, but NEVER STORE CREDENTIALS IN PLAIN TEXT.

The reason I didn't have a keyring is that because I was running the tty version of Arch. Because there was no GNOME or KDE, there was none of the tools like gnome-keyring. The basic solution was to install a tool like gnome-keyring onto my headless system.

Here were some of the issue I ran into. AI documented these for me:

  1. Creating the keyring headlessly: printf '%s' "$PW" | gnome-keyring-daemon --unlock creates and unlocks the login keyring from stdin only if it wins the race against dbus activation. (I don't know what this means)
  2. --replace broke it: running --replace --unlock while a dbus-activated daemon held the bus name left me with two daemons and zero keyring files. Killing the daemons first, then unlocking, worked.
  3. pkill gnome-keyring-daemon silently does nothing: process names are truncated to 15 characters in /proc/comm, so it needs pkill -f gnome-keyring.

Then there is the human error. I finally got things up and running and then I did the most obvious thing. I misspelled my email. Swiss Army Upload saves credentials before validating them, that that meant that I couldn't fix it because it kept shouting INVALID CREDENTIAL. Running secret-tool clear service counter.teahouse.cafe and re-login fixed it.

And now I have a publish command on my system. The next step is to re-wire the Publish command to run locally instead of trying to trigger the github workflow.

Webmentions

Loading mentions…
No webmentions yet. What's this?
Back to Notes to Self…