My experience hosting Gitea

reachable via: git.itsrye.dev (not publicly accessible)

Since quite a long time (about 2021) I have hosted my own personal Git server.

It moved domains quite a few times since then, first using simply dyndns via desec.

I also had to deal with a migration of the git server from my loyal little Raspberry Pi to an external Server where it resides now.

Why Gitea?

The server is since the beginning running Gitea. In the beginning the main reason was the resource constraints I had (namely a Raspberry Pi 4), and other self hosting options, like Gitlab, are far more resource hungry (while providing some neat features Gitea lacks I must admit). Since the debate that came up some time ago, resulting in Codebergs fork of Gitea to Forgejo, I was considering migrating from the upstream Gitea to Forgejo. However the need hasn’t yet arisen.

Problems running Gitea

In all the time I must say I have noted some problems that persisted over all the versions I came to use. A problem I still deal with is unexpected Gitea crashes (might be caused by my somehow not really standard environment). Here it comes in handy that I run it in Docker. It does help in two ways, firstly it offers automatic restarts of the server if it crashes, and secondly it offers the option of using health checks to detect abnormal behavior and restart the server (I use both). Another issue I had to deal with a long time, until I fixed it recently, was signing git commits made on the web interface with the server pgp key. At first I dealt with it with building my own Docker image of Gitea - which obviously was less than ideal - now recently I discovered that I had to adjust where the keys are stored for it to be useable to the gnupg client (my bad).

S3 and Gitea

Since some time I also use my S3-compatible server (currently still minio) which is run on my loyal Raspberry Pi as object storage for my git server. If you don’t know what that means, in short on Gitea there are source files (typically in plain text like Java source code) and binary objects (like packages, git-lfs[^1] files) and Gitea offers to either store the binary objects locally or in a remote S3 compatible (like Minio) storage (the git repo is saved on the hard disk, i guess you could move it in S3 using the Docker rclone plugin, but that’s a hassle and probably won’t help stability or speed).

Cloudflare

The fact that my Git server is hosted behind Cloudflare is restricting me in some aspects, specifically uploads of big files (for example pushing a built Docker image), are somehow unreliable. Cloudflare also restricts the maximum file upload size for free users to 100MB. And yes I know I could circumvent it by either not hiding my Git server behind Cloudflare and/or opening the ssh port (git can pull either via ssh, if enabled, or https from the server). However I deliberately decided to do neither of those, because of security considerations.

The Docker Compose I use

I have published the Docker Compose I used at github as dozro/compose-gitea and also at codeberg as dozrye/compose-gitea for those who prefer Codeberg.