Gitea
GitHub, while great, is not due to their data practices. I am not too fond of my code in my private repo potentially showing up in someone's Copilot suggestion. While that may be far from happening, there is something that still doesn't sit right with me about how many companies are using their TOS to benefit themselves over their users.
That brings in: Gitea. A painless, self-hosted Git service. It's perfect for what it is; it offers most of the features that I need and allows me to control all of my data. Gitea actions are mostly the same as GitHub actions, which makes moving your DevOps over a breeze!
Assumptions
You have knowledge of ports and networking. You know how to use Docker and Docker Compose. You can set up and point your domain to an application. You know how to use environment variables and how to change them. You use another application that handles SSL certificates for your domain. You have the knowledge to adjust the information in this page for your specific use case, as you know everything may not work out-of-the-box on your host.
Setup
To get the full experience, you will want to set up Gitea and a Gitea Runner. This is about what I use for my docker-compose.yml. To get this initialized we will deploy the stack without the runner until we can start configuring that in Gitea.
networks:
net:
external: false
services:
server:
image: docker.io/gitea/gitea:latest
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- net
volumes:
- /DATA/AppData/gitea:/data
- /DATA/AppData/gitea/conf:/data/gitea/conf
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /home/git/.ssh/:/data/git/.ssh
ports:
- "3002:3000"
- "222:22"After you setup the Gitea stack, you will want to navigate to the site and do your initial setup. We can navigate to the actions tab in the Site Administration page in Gitea. We will want to register a new runner so we can built and execute Gitea Actions. Once registered, keep track of the Token and the Name as you will need that to setup the runner.
We can add a runner to Gitea by adding the following service to our compose file:
runner-0:
image: gitea/act_runner:latest
restart: always
container_name: "${RUNNER_NAME}0"
networks:
- net
environment:
CONFIG_FILE: config.yaml
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
GITEA_RUNNER_NAME: "${RUNNER_NAME}0"
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
RUNNER_TOOL_CACHE: /data/runnercache
volumes:
- /DATA/AppData/runners:/data
- /var/run/docker.sock:/var/run/docker.sock
- /etc/docker/daemon.json:/home/rootless/.config/docker/daemon.json:ro
Adding a runner to Gitea greatly extends what you can accomplish with Gitea. Using Gitea Actions and their container store, you can create a fantastic DevOps pipeline for your personal use.