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.
If you like my work, you can help me a lot by giving me a tip, either through Liberapay[1] or Paypal[2]. Thank you very much!
It is named « Diamant », in reference to one of the first French attempts to build a rocket. The first Diamant launch happened in 1965, exactly like Gemini. I think it's cool.
About the Diamant rocket program on Wikipedia (HTTPS)
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 work with a global ruby installation too.
rvm get latest rvm use ruby-2.7.2@diamant --create gem install diamant
Then you need to generate a self-signed TLS certificate and private key. In the following example, remember to replace the example hostname `myhostname.com' with the one you would like to use.
Diamant provides a tool to create these certificates and keys:
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, running the server is as simple as:
diamant
However, you may want to use some other options:
diamant serve ~/my_gemini_site -b 0.0.0.0
To see all possible options, just enter the following command:
diamant --help
You can take inspiration 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 repository:
Diamant gemini server git repository (HTTPS)
Be aware that another ruby implementation exists, named Gack. Diamant differs from it for two reasons:
--
📅
📝 Étienne Deparis with GNU/Emacs 29.4 (Org mode 9.7.11)