💾 Archived View for gemini.sh0.xyz › old_setup.gmi captured on 2023-04-26 at 13:23:51. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-03-20)

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

My original setup

To make it easy to edit and add to the capsule I've got it synced with all my devices using syncthing. Nothing special, just sharing the directory on my webserver and laptop/mobile, etc.

The service is running on my FreeBSD box out in the cloud. I have similar setups for other types of services, so I sync to one location and then detect when files change to copy them to the service location.

#!/bin/sh

SRC_DIR=/var/syncthing/gemini
DST_DIR=/usr/local/gemini
ACTIONS="create,delete,move,modify"

while :
do
        if inotifywait -rq -e ${ACTIONS} "${SRC_DIR}" 2>&1 1>/dev/null; 
        then
                sleep 5 # To allow for other changes
                rsync -avh "${SRC_DIR}/" "${DST_DIR}/" --delete
                chown -R molly:whell "${DST_DIR}"
                chmod -R 777 "${DST_DIR}"
        fi
done

I'm running molly-brown as my gemini server. Configuration is pretty straight forward, just use the default config and fill in your details. I use certbot to generate the SSL cert. I'm also running kineto as my gemini proxy to http. Its set to run on port 8081, and then nginx is used to proxy all requests, see the following config:

server {

  server_name gemini.sh0.xyz;

  location / {
    proxy_pass http://localhost:8081/;
    proxy_buffering off;
    proxy_set_header X-Real-IP $remote_addr;
  }

  access_log /var/log/nginx/gemini.sh0.xyz.access.log;
  error_log /var/log/nginx/gemini.sh0.xyz.error.log error;

  listen [::]:443 ssl ipv6only=on; # managed by Certbot
  listen 443 ssl; # managed by Certbot
  ssl_certificate /usr/local/etc/letsencrypt/live/sh0.xyz/fullchain.pem; # managed by Certbot
  ssl_certificate_key /usr/local/etc/letsencrypt/live/sh0.xyz/privkey.pem; # managed by Certbot
  include /usr/local/etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
  if ($host = gemini.sh0.xyz) {
      return 301 https://$host$request_uri;
  } # managed by Certbot

  listen 80;
  listen [::]:80;

  server_name gemini.sh0.xyz;
    return 404; # managed by Certbot
}

Kineto is easy to use, just create a startup script and run it pointing at your site:

#!/bin/sh

/usr/local/bin/kineto -b localhost:8081 gemini://gemini.sh0.xyz

I wrote a simple atom.xml cgi script that just expects the first header to be the title and a `Published:` and `Updated:` line towards the top of the file to define its date and time of publishing.

# Title of my post

Published: 2022-10-01 08:42
Updated: 2022-10-01 11:30

Lorem ipsem...

Molly Brown (Project Site)

Kineto (Project Site)

My atom.xml script (Python3)

Atom Feed

I've written a cgi script but I'm a little worried about how much it depends on the server side to be working correctly. Change time stamps on files and magically they get republished. Will be looking into being able to store off the current file and checking if anything is new, maybe then moving to a dynamic method. But for the time being I just maintain an atom.xml file by hand.

back