omar-polo / gmid

a Gemini server
https://gmid.omarpolo.com
ISC License
102 stars 7 forks source link

gmid 1.8 compile in tinycore #21

Closed lplume closed 1 year ago

lplume commented 1 year ago

Hello @omar-polo,

im trying out tinycore linux on an eeepc900 and im planning to use a local gemini server to keep tracks of my stuff and hopefully i'll be in the space soonish! gmid is not (yet :stuck_out_tongue: ) packaged for tinycore so i tryed to compile it. Here's my experience it might be useful to others as well, some things might be useful to you as well.

First thing, dependencies, im sorry to bring this up again, the bad naming around libtls/libretls drove me crazy and it took me sometime to grasp my head around. If you are running tinycore you might want to look for openssl+libretls (aka libtls for openssl). libtls should be compiled as well.

If you want to get your life easier consider using the metapackage compiletc, you need to install as well the other dependencies (libevent-dev, openssl-dev, compiletc should take care of the rest).

The quickstart guide is where you want to look next and it's clear and straight to the point to set you up. If you need help with certificates gmid comes with a handy helper too (check the contrib folder).

I tried to start up gmid 1.8 (latest release) in foreground and verbose mode, but i have no luck in getting it working, i had no idea where to look for output or errors. The following is the dead simple config i've tried:

server "localhost" {
    cert "/tmp/test/localhost.pem"
    key  "/tmp/test/localhost.key"

    # path to the root directory of your capsule
    root "/tmp/test"
}

I then repeat the same step again but with the latest code and it worked, gmid in foreground was giving me helpful info, i had to change the "server" directive to server "localhost.local" to get it respond properly. I might think this would let 1.8 work as well i'll try later today.

PS: i understand that this suit best on the tinycore forum, first i would like to address the 1.8 issue, it's probably me and should be some configuration issue or the essential tinycore spirit and a few things must have be done to make it work properly.

PSPS: i'd love to read about your workflow to keep, write and maintain you gemini capsule!

omar-polo commented 1 year ago

Hello,

Thanks for letting me know about these issues, I'm always curious about issues in packaging (being a porter myself 😄).

The issue you're describing with 1.8 is very likely due to seccomp. Seccomp is a linux security module that lets programs allow only certain system calls and forbid the others. While this sound really interesting, the way linux works makes this completely unusable and unmaintenable, at least for solo developers and hobby projects. I assume that the tinycore libc is using some innocuous system call that I've not included in the BPF script in sandbox.c (in the 1.8 branch) and that makes gmid fails.

There are some steps to debug this documented in the faq page of the site / capsule, but I would advise against doing so. I've removed seccomp support in the master branch and the 2.0 version is almost done.

(the -master page is actually in its first 'alpha', I'm still in doubt to include / reintroduce one feature but otherwise it's done)

Now, on the dependencies side, -master should be easier to handle. libtls is currently bundled and will be so until the signer APIs will be finalized and libretls updated, so only openssl / libressl and libevent are needed as of now.

PSPS: i'd love to read about your workflow to keep, write and maintain you gemini capsule!

Oh well, it's nothing interesting, really! I've thrown together some clojure years ago to generate the HTML blog. When I started to be interested in Gemini, I've converted the posts from markdown to text/gemini and taught my home-grown site generator to assemble the gemini version too. The only positive side-effect was contributing a few gemini-related libraries for clojure.

The gmid capsule is another story, and it's generated from the code you'll see in the site subdirectory. It's a similar story (converting text/gemini to HTML with a perl script) but using BSD make (actually I don't know if bmake can build it, I've only used the OpenBSD make flavour and never cared too much for portability of the site generation.)

lplume commented 1 year ago

Hello,

thanks for the comprehensive answer! I may check out the seccomp thingy in the 1.8 version out of curiosity as well and for the sake of learning. Looking forward for the release 2 and the libtls dependency. I'll edit the issue title and close the issue, someone might find this useful in the future.

Thanks!