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 About the gemini protocol
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 some tip, either through Liberapay or Paypal. Thank you very much!
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
Diamant is a Ruby gem. You need a working Ruby environment to use it. We recommand you to use RVM 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: