💾 Archived View for gmi.bacardi55.io › blog › 2021 › 02 › 06 › deploying-my-own-gemini-capsule captured on 2024-07-08 at 23:33:20. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

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

Deploying my own Gemini capsule with gminisrv

Posted on 2021-02-06

I've been following Gemini for a bit of time and as I liked the concept and I love to play with new things, I decided to launch my own gemini capsule (aka, my own "site" on the gemini "web").

You can access it here: gemini://gmi.bacardi55.io

Disclaimer: The result is not perfect yet. For now I've only put my blog posts but internal links to other content or images do not fully work yet but I'll fix this later.

I do plan to create specific content on gmi at some point, for things that are not really "blog post" material but still worth typing for my future self :D.

I'd like to highlight and thanks some posts that convince me of doing it:

And others that I've seen in my RSS feeds or on mastodon :).

1: https://samsai.eu/post/introduction-to-gemini/

2: https://sylvaindurand.org/discovering-the-gemini-protocol/

3: https://lottalinuxlinks.com/my-gemini-capsule-has-launched/

Gemini you say ?

For those that don't know, as said on the gemini website[4]:

4: https://gemini.circumlunar.space/

Gemini is a new, collaboratively designed internet protocol, which explores the space inbetween gopher and the web, striving to address (perceived) limitations of one while avoiding the (undeniable) pitfalls of the other.

I suggest you read more about it on the FAQ page[5] that contains all the necessary informations :).

5: https://gemini.circumlunar.space/docs/faq.html

Gemini server setup

I was looking for an extra lightweight server and trying to avoid Go or Rust for server part. In the end, I I selected gmnisrv[6], developed by Drew Devault[7] in C. Easy to install, self manage certificate and very light to run on an old raspberry pi.

6: https://git.sr.ht/~sircmpwn/gmnisrv

7: https://drewdevault.com/

Installation

You should already have openssl installed, but if not, install it with your packet manager.

Also, on the project page[8] it says that scdoc[9] is optional, but I couldn't install without it, so I ended up installing it too.

8: https://git.sr.ht/~sircmpwn/gmnisrv

9: https://git.sr.ht/~sircmpwn/scdoc

To install scdoc:

git clone https://git.sr.ht/~sircmpwn/scdoc
cd scdoc
make
sudo make install

Then, to install gmnisrv:

git clone https://git.sr.ht/~sircmpwn/gmnisrv
cd gmnisrv
mkdir build
cd build
../configure --prefix=/usr
make
sudo make install

Configuring the server

Copy the default config file at the right place:

cp /usr/share/gmnisrv/gmnisrv.ini /etc/gmnisrv.ini

And edit it as needed for the certificate path and the files path.

I use /srv/gemini/gmi.bacardi55.io as the path where my *.gmi files will be.

For now, let's create a default hellowolrd page:

echo "hellowolrd55!" > /srv/gemini/gmi.bacardi55.io/index.gmi

Creating a systemd service

To automate the (re)start of the server, I created a systemd service. To do so, I created /etc/systemd/system/gmnisrv.service with the following content:

[Unit]
Description=Gemini Server gminisrv
After=network.target

[Service]
Type=simple
# Another Type: forking
User=gemini
ExecStart=/usr/bin/gmnisrv
Restart=always

[Install]
WantedBy=multi-user.target

As you can see, I use a dedicated gemini user on my system to run it as a limited users.

Then, enable the service and then start it:

sudo systemctl enable gmnisrv
sudo systemctl start gmnisrv

Remember also that it uses port 1965, so if you selfhost at home, don't forget to open the port and redirect flow on this port on the right server.

To test locally first, edit your /etc/hosts to map the domain config in the server file and the IP of the server in a gemini client.

You can find a list of clients on this page[10]. On my side, I used gmni[11] but any client will do.

10: https://github.com/kr1sp1n/awesome-gemini

11: https://git.sr.ht/~sircmpwn/gmni

To test it works from the outside, either install a cli/tui client on an external server or test it via an online portal like this one[12].

12: https://portal.mozz.us/gemini/gemini.circumlunar.space/

And voilà, you should see your hellowolrd page :)

In the next post, I talk about how I use my blog generator Hugo[13] to generate both this blog and the gemini pages.

13: https://portal.mozz.us/gemini/gemini.circumlunar.space/

/gemlog/

Send me a gemini mention

send me an email!