Gitea Setup
When looking to Self-Host a Git server there are two real options. GitLab and Gitea we will be setting up Gitea as this uses around 300MB of RAM compared to GitLab which uses in excess of 4GB! So unless you need all the features that come with GitLab, Gitea is the way to go!
What is Gitea?
"Gitea is a painless self-hosted Git service. It is similar to GitHub, Bitbucket, and GitLab. Gitea is a fork of Gogs." - Gitea
Prerequisites:
- Server Setup
- Docker
Ubuntu Guide: https://docs.docker.com/engine/install/ubuntu/
Debian Guide: https://docs.docker.com/engine/install/debian/ - Docker-Compose -
sudo apt install docker-compose
Install
- Head to your home or docker directory:
cd
- Create a directory for Gitea:
sudo mkdir gitea && cd gitea
- Create the
docker-compose.yaml
file:
Use the following template
sudo nano docker-compose.yaml
version: '2'
services:
web:
image: gitea/gitea:latest
container_name: gitea
volumes:
- ./data:/data
depends_on:
- db
restart: always
networks:
default:
ipv4_address: 10.10.10.18
db:
image: mariadb:10
container_name: gitea-db
restart: always
environment:
- MYSQL_ROOT_PASSWORD=CHANGEME
- MYSQL_DATABASE=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=CHANGEME2
volumes:
- ./db:/var/lib/mysql
networks:
default:
ipv4_address: 10.10.10.17
networks:
default:
external:
name: dockernet
Change:
- IP's
- CHANGEME
- CHANGEME2
Use gitea/gitea:linux-arm64
if you are using an ARM 64 device such as the Raspberry Pi 4.
Create a Docker network if you haven't already:
sudo docker network create --driver=bridge --subnet=10.10.10.0/24 --gateway=10.10.10.1 dockernet
- Spin it up:
sudo docker-compose up -d
- Configure your reverse proxy
Example Caddyfile config:
gitea.example.com {
reverse_proxy 10.10.10.18:3000
}
Configuration via the WebUI
- Select MySQL
- Enter the IP of the database. e.g: 10.10.10.17
- Enter your MySQL username. e.g: gitea
- Enter your password that you changed earlier ;)
The only other essential task is to create your admin account at the bottom.
Now it's time to Git!