💾 Archived View for alltext.umaneti.net › diamant.gmi captured on 2024-07-08 at 22:48:12. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-11-04)
-=-=-=-=-=-=-
Diamant is a server for the Gemini network protocol, built in Ruby. Diamant has very few features, and can only serve static files.
About the gemini protocol (HTTPS)
Internally, it uses the OpenSSL library to handle the TLS sessions, and the Ruby `Thread' implementation to handle concurrent requests.
It is named « Diamant », as one of the first french attempt to build a rocket. The first Diamant launch happen in 1965, exactly like Gemini. I think it’s cool.
About the Diamant rocket program on Wikipedia (HTTPS)
I’m already aware another Ruby implementation exists, named Gack. However, Diamant differs from it for two reasons:
Diamant is a Ruby gem[1]. You need a working Ruby environment to use it. We recommand you to use RVM[2] and a specific gemset. However it will works with a global ruby installation too.
rvm get latest rvm use ruby-2.7.2@diamant --create gem install diamant
Then you need to a generate self-signed TLS certificate and private key. In the following example, remember to replace the example hostname `myhostname.com' by the one you would like to use.
Diamant provides a tool to create these certificate and key:
diamant generate_tls_cert myhostname.com
You can also use the OpenSSL command if you prefer:
openssl req -x509 -newkey rsa:4096 -keyout key.rsa -out cert.pem -days 3650 -nodes -subj "/CN=myhostname.com"
Finally, you should create a folder to store your static files to serve:
mkdir public_gmi echo 'Hello World!' > public_gmi/index.gmi
With all the default options, runing the server is as simple as:
diamant
However, you may want to use some other options:
diamant --public-path ~/my_gemini_site -b 0.0.0.0
To see all possible options, just enter the following command:
diamant --help
You can inspire yourself from the following service example file:
[Unit] Description=Control Diamant Gemini Server After=network.target [Service] Type=simple User=gemini Group=gemini Environment="PATH=/home/gemini/.rvm/gems/ruby-2.7.2@diamant/bin:/home/gemini/.rvm/gems/ruby-2.7.2@global/bin:/home/gemini/.rvm/rubies/ruby-2.7.2/bin:/home/gemini/.rvm/bin:/usr/local/bin:/usr/bin:/bin" Environment="GEM_HOME=/home/gemini/.rvm/gems/ruby-2.7.2@diamant" Environment="GEM_PATH=/home/gemini/.rvm/gems/ruby-2.7.2@diamant:/home/gemini/.rvm/gems/ruby-2.7.2@global" WorkingDirectory=/home/gemini ExecStart=/home/gemini/.rvm/gems/ruby-2.7.2@diamant/bin/diamant -b 0.0.0.0 KillMode=control-group [Install] WantedBy=multi-user.target
Development occurs on my own git repositoy:
diamant gemini server git repository (HTTPS)
--
đź“…
📝 Étienne Deparis with GNU/Emacs 29.4 (Org mode 9.7.6)