[ANN] New Gemini Server: Space Age

Gary Johnson lambdatronic at disroot.org
Fri Jul 10 19:38:28 BST 2020


Hi Hannu,

  Thanks for the feedback. I also write Clojure+Clojurescript for a
living doing full stack web development and scientific modelling in the
environmental arena.

To control RAM consumption by the JVM, you can set -D-Xmx in Space Age's
toplevel deps.edn file. Outside of embedded environments (e.g.,
Raspberry Pis), I suspect the default of a few hundred MBs of RAM
shouldn't be too much of a burden for most laptops, desktops, or VMs,
but with that flag, you can set the JVM's max memory to whatever you
want. GraalVM could be an interesting build target though, so let me
know if have any success compiling Space Age on it.

I'll take a look at java.net.URI to see if it provides any benefit over
my current approach. I suspect I'll still need to perform string
trimming, selective lower-casing for some URI components, and default
values for missing elements as I am doing currently, but if it shaves a
few lines off the code base, that's certainly nothing to complain about.
;)

In other news, I just added a primitive CLJ script running facility to
Space Age. Now all you have to do is drop an executable <whatever>.clj
file into your ~/public_gemini folder (or the document root directory),
and you're off to the races! Any query params from the request URL are
available to the script in a global variable called (creatively)
"request-params". Anything you print to stdout in your script will be
returned as the body of a text/gemini response to the client.

I'm still thinking through just how much additional info I want to pass
to these scripts and how/whether I should let them send non-success
responses, but that's half the fun of it after all.

(hack 'the :planet)
  Gary


Hannu Hartikainen <hannu.hartikainen+gemini at gmail.com> writes:

> On Fri, Jul 10, 2020, 00:39 Gary Johnson <lambdatronic at disroot.org> wrote:
>
>> Space Age is a Gemini server written in Clojure (https://clojure.org/).
>>
>> It implements Gemini protocol specification v0.14.2 (July 2nd 2020), all
>> except for client certificates (which I'm still working on).
>>
>> The entire code base (including build files) clocks in at a cool 200
>> lines with absolutely no dependency libraries.
>>
>
> Great work!
>
> I write Clojure at $dayjob and consider it a great fit for full-stack web
> (and Gemini by extension). Besides a static Gemini site, I've written one
> CGI app in Rust (twinwiki) and one server/app in Python/Jetforce (
> ansi.hrtk.in). Both could have been in Clojure if there was a nice library.
>
> For my use RAM consumption is important, though, so I'd need to measure a
> bit with GraalVM or possibly a tiny JVM instance. Practically Rust will
> always be the better (best?) choice, but it's a bit heavy for prototyping.
>
> Briefly reading the code I was left wondering if java.net.URI wouldn't
> parse URIs out of the box. Probably it's just not ergonomic and/or has
> weird corner cases...
>
> Happy hacking!
>
> -Hannu


-- 
GPG Key ID: 7BC158ED
Use `gpg --search-keys lambdatronic' to find me
Protect yourself from surveillance: https://emailselfdefense.fsf.org
=======================================================================
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


More information about the Gemini mailing list