So a couple of weeks ago I stumbled upon something called Gemini.
What is Gemini?
Gemini is an internet protocol that is very similar to the HTTP protocol that we use today. The main difference is that Gemini is a text-based protocol which means that it is a lot faster and safer than HTTP.
What is an internet protocol?
An internet protocol is a set of rules that are used to communicate between computers. For example, HTTP is an internet protocol that is used to communicate between computers on the internet.
[Computer 1] <----> [Internet Protocol] <----> [Computer 2]
It seemed very intriguing to me and I wanted to try it out.
I tried to visit a couple of Gemini Capsules on my browser but I couldn’t connect to any of them. That is because most browsers today are using HTTP to connect to the internet and don’t support Gemini.
So that meant that I had to use a Gemini client to connect to the internet.
I found an amazing repository on Github that had a list of Gemini clients, servers, and other resources.
https://github.com/kr1sp1n/awesome-gemini
After looking through them I decided to use a client called lagrange.
Lagrange is a Gemini client that is written in C and it is very fast and easy to use and looks very nice as well.
After installing Lagrange I tried to connect to a Gemini Capsule and it worked!!
Gemini seems very intriguing so I decided to make a Gemini Capsule of my own!
So what do we need to make a Gemini Capsule?
We need a Gemini server.
I stumbled upon a Docker Image that had the Agate Gemini server installed on it made by walkero which was amazing and because it uses Docker it would be easy to deploy.
https://hub.docker.com/r/walkero/agate-gemini
So I followed the instructions on the Docker Hub page and I was able to make a Gemini Capsule of my own!
First I had to make 2 files a .env file and a docker-compose.yml file.
.env
PROJECT_NAME=mygemini
HOSTNAME=mygemini.demo.com
docker-compose.yml
version: "3"
services:
agate:
image: walkero/agate-gemini
container_name: "${PROJECT_NAME}_agate"
environment:
HOSTNAME: ${HOSTNAME}
volumes:
- ./content:/home/gemini/content
labels:
- "traefik.enable=true"
- traefik.tcp.routers.${PROJECT_NAME}_gemini.entrypoints=gemini
- traefik.tcp.routers.${PROJECT_NAME}_gemini.rule=HostSNI(`*`)
- traefik.tcp.routers.${PROJECT_NAME}_gemini.service=${PROJECT_NAME}_gemini
- traefik.tcp.services.${PROJECT_NAME}_gemini.loadbalancer.server.port=1965
The Docker Image also uses Traefik!
What is Traefik?
Traefik is a reverse proxy that is used to route traffic to different services. It is very useful when you have multiple services running on the same server.
- Note: If you are using this Docker Image for local testing you should remove the Traefik labels and add the ports 1965:1965 as traefik is not needed for local testing.
We also need to create a folder named “content” and inside it is where we are gonna store our gemini files. We are gonna create a file named “index.gmi” which is the file that will be displayed when you connect to the Gemini Capsule.
content/index.gmi
# Hello Gemini World!
After putting the information in the .env and docker-compose.yml files and having the content folder ready you can start the container.
To create the container you just need to run:
docker-compose up -d
You can find the repository at https://git.walkero.gr/walkero/agate-gemini
Once you have the container running you should be able to connect to your Gemini Capsule!
If for example, you using localhost you should be able to connect to it by typing on your client:
gemini://localhost
Gemini’s text format is very similar to Markdown so it is very easy to create a Gemini Capsule that looks nice.
Also because it is a text-based protocol and no images are used it is very fast and safe to use but also it allows for some amazing ASCII art!
I also found an amazing python library by makew0rld called md2gemini that converts Markdown files to Gemini files which are very useful.
You can download it from PyPi by typing:
pip install md2gemini
It is very easy to use and you can convert a Markdown file to a Gemini file by doing:
from md2gemini import md2gemini
# Load a markdown file's contents into memory and get a conversion
with open("example.md", "r", encoding="utf8") as f:
# Convert the markdown String to gemini
gemini = md2gemini(f.read())
# Write the converted text to a file .gmi is the extension for gemini files
with open("example.gmi", "w", encoding="utf8") as g:
g.write(gemini)
I have created my own Gemini Capsule and used the md2gemini library to copy all my blog posts to the capsule so they are also accessible there!
You can find my Gemini Capsule at: gemini://gem.arisamiga.rocks
This was certainly an interesting experience as I have never used a different internet protocol before and I am very happy that I was able to make a Gemini Capsule of my own!
Hope you enjoyed this project and Thanks so much for reading :D