Awhile back, I made the decision to self-host my code on gitea
using a digital ocean droplet. Gitea is a self-hosted, lightweight
git service that if you utilize, you can have a lot of the premium features of Github for a fraction of the price. I use Digital Ocean,
with their famous $5/month pricing for relatively minimal servers. With the small resource requirements of Gitea, written in Go, the $5/month server
is a perfectly adequate solution to get started.
Why Self-Hosted?
I decided to self-host for a few reasons. First, it saves on money. My Github premium plan is more than 2x what I pay for running the Digital Ocean server. Anything that I can save is crucuial, as I am in the early stages of a startup. Also, I get unlimited private repos AND organizations for a much less using Gitea than I do Github. I can host my own projects, my startup’s code, and any other ventures from this service. Second, I feel that we are becoming too reliant on centralized systems to provide us with meeting our needs. Github is a centralized service that holds much of the world’s source code. They do a great job at it, but I wanted to have some agency over my own source code, since I am creating value from it and am capable of running my own infrastructure. Finally, I have experience running, deploying, and operating infrastructure that I wanted to leverage, and it was fun to standup this server and monitor it as I push my code.
The Steps to Get Started
Navigate to the Marketplace tab in DigitalOcean and find gitea
, launch it from the marketplace. Now what you’ll find is that Gitea from the marketplace
is several versions behind what gitea
is currently at, so to rectify this you’ll have to run the following code from your droplet:
wget -O gitea https://dl.gitea.io/gitea/<version>/gitea-<version>-<os>-<arch>
chmod +x gitea
mv gitea /usr/bin/gitea
gitea -v # To verify version
sudo systemctl restart gitea
This series of commands will download the version you are looking for of gitea, copy it into place, verify that you got the correct version, and restart the systemd daemon already present on the box reloading the gitea binary. Pretty simple.
My Plans for Improving The Process
I will likely set up SSH access to this box, and write some Ansible playbooks that I can store ON MY GITEA INSTANCE that I use to run these commands. There is no rush, as I own the server, but especially as I add users to it (for my side hustle) I will need to up my automation as well.