init gemlog
posted: 2025-10-05
Hello Gemspace. If you are reading this, that means means a lot of things have come together. I'm writing to you from my new command line tool, gemlog-cli. This tool saves the posts to couchdb. From there my gemini capsule reads them and serves this page.
Basic arch:
┌────────────────┐ ┌─────────┐
┌────────────────► gemini-capsule ┼───────────►frontend │
│ └────────────────┘ └─────────┘
┌───────────┐
│ couchdb │
└────────▲──┘
│
│
│
│
└─────┬──────────────┐
│ gemlog-cli │
└──────────────┘
Code:
Still working on a way to view source code from my Forgejo git server nativly on my gemini capsule. For now the link is to clearweb.
Questions
Why cli app?
I've always had a soft spot for the terminal. As gemini is focused on text-based context staying on the terminal feels right.
Why couchdb
Yes I'm already hosting several databases on my homelab. In this case I wanted a document based nosql db. Something simple and quick to setup, similar to dynamodb but self-hostable. Couchdb fits that bill well.
The only issues I have is it is a bit cumbersom to create users and databases.
I created this script to make creating users easier. Runs like `./create_user.sh test-man`. If the users db is not already created it does that as well. If you use it remember to update the host and port.
#!/bin/bash set -e COUCH_DB_PW=$(jq -r .PW "$(dirname "$0")/env.json") USER=$1 PW=$(openssl rand -base64 20) if [ -z "$COUCH_DB_PW" ] || [ -z "$USER" ]; then echo "Usage: $0" exit 1 fi curl -X PUT "http://admin:${COUCH_DB_PW}@host:port/_users" curl -X PUT "http://admin:${COUCH_DB_PW}@host:port/_users/org.couchdb.user:${USER}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d "{\"name\": \"${USER}\", \"password\": \"${PW}\", \"roles\": [], \"type\": \"user\"}" echo "User ${USER} created successfully\n" echo "Password: ${PW} write it down as it can't be retrieved later\n"
To create a db run the following using the admin creds:
$ curl -X PUT http://admin:xxxxxxxxxxxxxxxxxxxxxxxxxxx@host:port/gemlog
$ curl -X PUT http://admin:xxxxxxxxxxxxxxxxxxxxxxxxxxx@host:port/gemlog/_security \
-H "Content-Type: application/json" \
-d '{"admins": { "names": [], "roles": [] }, "members": { "names": ["gemlog-cli"], "roles": [] } }'
Boom full couchdb tutorial!
Why GoLang?
In the last weeks I've been really taken by the programming language. Quite fun to build web apps with.