Server-side gemini scripting with Bliz




Introduction

It's all well and good serving up static content in your geminispace but what if you want dynamically generated content: statistics generated from your logs, tailored content to users who log in with a certificate, create simple games etc. Why not try out Bliz? It is easy to install and get started with and doesn't have many dependencies. It is licensed under a well regarded free software license, the GNU Affero General Public License - version 3. This article is an overview of Bliz and should not be relied on for technical expertise.




Caveat

[Flounder.online users cannot (yet?) run Bliz but it can be easily tested on your own home machine. Keep reading to find out how]


Here's a demo hosted on the Bliz author's gemini

//cadence.moe/gemini/demo.bliz




Difficulty level

Fairly Easy

While some people are put off by technical tasks, installing and running Bliz is actually quite easy. It is more a matter of practice rather than any one step being difficult. Regular command line users should have no problems. The code was tested on a Linux machine.




Getting the code

The code is hosted on "The Hacker's Forge" a.k.a. Sourcehut

//sr.ht/~cadence/bliz

[Sourcehut has a strong reputation for advocating for free software and eschewing the surveillance and advertising model of some of the other software repositories.]


Requirements: you will need git, socat and the fish shell installed on your system


sudo apt install git socat fish

should suffice on a Debian, Ubuntu or Mint machine

sudo yum install git socat fish

on Fedora

sudo pacman -S git socat fish

on Arch


What's what

git is needed to clone the Bliz software onto your machine. socat acts as the gemini server. fish does the scripting magic.



Now navigate to a spare folder and clone the repository:

git clone https://git.sr.ht/~cadence/bliz




Running the code

cd into the cloned repo and open the README.md file and have a read: Don't worry if you don't follow everthing, the key steps to getting started are at the top:



1. Clone the repo - already done

2. Run ./certs.fish and follow the prompts

Snag

When I ran the certs.fish script I entered a blank domain and subsequent steps didn't work. Make sure to enter even a fake domain e.g. mysite.bliz


3. Run ./main.fish

4. Point your Gemini browser at gemini://localhost/




Navigate to the .bliz file in your gemini browser and you should see something like this:


------------------------------------------------------------

Bliz is running and has transformed this .bliz script into a presentable gemtext

in real time.


Here are some examples of what you can do with the power of Bliz.


The time is Tue 15 Dec 2020 10:07:54.


There are 83 words in this document, not counting script data.


Here is a directory listing:


total 24

-rw-r--r-- 1 fedi fedi 619 Dec 14 00:27 scripting.bliz

.

.

.

------------------------------------------------------------


Note

Since this is not a live bliz file the above content is static but click on the following link for a live demo on the Bliz author's site:

//cadence.moe/gemini/demo.bliz




Writing your own Bliz files

Now open up the scripting.bliz file and the README.md in your text editor and learn how to write your own Bliz files!! Bliz allows you to write your own functions and you can call other programs too in your code so you could probably serve any sort of content you can think of with Bliz. Obviously to serve your Bliz files they will have to be hosted on a server running Bliz.




Summary

Bliz is an easy to install and easy to use software for gemini server-side scripting. It is licensed under a free software license and is free to use. Imaginative writers could create their own gemini games using only this software. It is light on resources and was observed to be using just over 10MB RAM divided 60/40 fish/socat. Even without the scripting functionality it can be used as a simple gemini server for viewing your geminis before publishing.





Postscript

Also if you had never used the fish shell before you can now try it out by typing fish at your bash? prompt. It has autocomplete and is quite colourful. It also has a vim mode.




gemlog/