Skylab Setup

Here's how I set up my Skylab instance for the first time:

Get GmCapsule ready with a new cert:

$ openssl req -x509 -new -sha256 -days 9999 -nodes -key key.pem     -out host.cert -subj "/CN=satch.xyz" -addext     "subjectAltName=DNS:satch.xyz,DNS:bensonplace.blue,DNS:blube.club,DNS:stavaser.o0o0o0o0o0o0o.ooo,DNS:$(printf '%s' 'ooo.o0o0o0o0o0o0o.o0o0o0o0o0o0o.ooo' | openssl enc -base64), DNS:benson.place, DNS:mail.satch.xyz"

$ mv host.cert cert.pem

Then I restarted GmCapsule and checked to make sure that everything was working. I went to gemini://mail.satch.xyz and got "50 Permanent failure" but a valid certificate, so that's great.

Clone git repository and run setup scripts

$ git clone https://git.sr.ht/~satchlj/skylab

That was 3.04 MiB in total.

$ cd skylab
$ chmod +x skylab-tool.sh
$ ./skylab-tool.sh
Usage: ./skylab-tool.sh [--init]
Options:
  --init    Perform initialization setup (create directories, etc.)
  --adduser Add a new user
$ ./skylab-tool.sh --init
Enter directory path for Skylab. (default: current directory): ~/gmcapsule/skylab

Here I break and go make that directory before continuing:

cd ~/gmcapsule/ && mkdir skylab

Back to the script:

$ ./skylab-tool.sh --init
Enter directory path for Skylab. (default: current directory): ~/gmcapsule/skylab
Enter hostname: mail.satch.xyz
Initialization complete.

I can now check that everything worked:

$ ls ~/gmcapsule/skylab/
mail.satch.xyz  users  users.yaml

Great. I will now build the executable files using the script.

$ ./skylab-tool.sh --build
What directory should the CGI executables be built to? Enter path:~/gmcapsule/skylab/mail.satch.xyz
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading gitlab.com/clseibold/misfin-server v0.0.0-20240111212826-2812aea0d21e

$ ls ~/gmcapsule/skylab/mail.satch.xyz/
archive  compose  delete  drafts  home  inbox  mail  reply  send  sent  tag  tags  trash  unread

Next, I will create a user (myself):

$ ./skylab-tool.sh --adduser
Enter username: satya
Enter directory path for Skylab. This directory should already exist and should contain 'users' and 'users.yaml': ~/gmcapsule/skylab
Enter path to misfin keypair PEM file (this script will copy it): ^C

I've forgotten where my keypair is kept, so I stop the script and go check. I'm putting it in my home directory for now to make this easy.

$ ./skylab-tool.sh --adduser
Enter username: satya
Enter directory path for Skylab. This directory should already exist and should contain 'users' and 'users.yaml': ~/gmcapsule/skylab
Enter path to misfin keypair PEM file (this script will copy it): ~/cert.pem
Enter GeminiFetchAddress: gemini://satch.xyz:1958/fetch
Enter AutoFetch (true/false): false
Enter Timezone: America/New_York
User satya setup complete.

AutoFetch to false just means I don't download and parse my gembox file every time I reload the page while using Skylab.

GmCapsule Configuration

Now everything is ready except my gemini server, GmCapsule. I start by dumping the whole example file into the .gmcapsulerc which I already have.

cat gmcapsulerc.example.ini >> ~/.gmcapsulerc

Then I go in there and edit out the redudant bits like [server], [static], [cgi], [titan] and things like that. Basically I have my old configuration and then the [DEFAULT] block onwards from the example file. I'm making sure to add "mail.satch.xyz" to my hosts list. I change the default values to the appropriate ones, and I can leave everything else:

[DEFAULT]
skylab_host = mail.satch.xyz
skylab_cwd = ./gmcapsule/skylab/mail.satch.xyz

Now I restart GmCapsule!

gemini@satch:~$ gmcapsuled
GmCapsule v0.6.1
Configuration: /home/gemini/.gmcapsulerc
Init: Rewriter
Init: Git Repository Viewer
Init: CGI programs
  gemini://mail.satch.xyz/ -> ['./home']
  gemini://mail.satch.xyz/index.gmi -> ['./home']
  gemini://mail.satch.xyz/tag/* -> ['./tag']
  gemini://mail.satch.xyz/reply/* -> ['./reply']
  gemini://mail.satch.xyz/compose/* -> ['./compose']
  gemini://mail.satch.xyz/archive -> ['./archive']
  gemini://mail.satch.xyz/delete -> ['./delete']
  gemini://mail.satch.xyz/drafts -> ['./drafts']
  gemini://mail.satch.xyz/inbox -> ['./inbox']
  gemini://mail.satch.xyz/mail -> ['./mail']
  gemini://mail.satch.xyz/send -> ['./send']
  gemini://mail.satch.xyz/sent -> ['./sent']
  gemini://mail.satch.xyz/tags -> ['./tags']
  gemini://mail.satch.xyz/trash -> ['./trash']
  gemini://mail.satch.xyz/unread -> ['./unread']
Init: Static files
  Content directory: /home/gemini/gmcapsule/static/{hostname}
Opening port 1965...
Server started on port 1965
5 parser(s) and 2 handler(s) started

It's working!

I go to gemini://mail.satch.xyz and I see a login link, which I click. It prompts me to activate a client certificate, and so I do (the same PEM file which I provided during the setup, signed by my server admin cert). My inbox loads but it's empty since I have AutoFetch set to `false`, so I click on 🔃 Check for New Mail and my mail is there at the top of the screen!