WHY do we need a GIT tool?
Git is a version control system that is used for tracking changes in computer files and coordinating work on those files among multiple people.
It is useful because it allows developers to keep track of the history of their code, easily collaborate with other developers, and revert to older versions of the code if needed. Additionally, it can help teams work more efficiently by allowing them to review, discuss, and merge changes quickly and easily.
The Gitea Project
You can find Gitea project details and source code at:
Gitea - Your own Private, Fast, Reliable Devops Platform that we will run with Docker.
SelfHosting Gitea
Enter Gitea, the tool that we are going to use, together with Docker to have Git version control.
SelfHosting Gitea
One recurrent topic that has to be addressed in the first place is how to setup docker in our machine.
Pre-Requisites!! Just Get Docker 馃悑馃憞
Important step and quite recommended for any SelfHosting Project - Get Docker Installed
It will be one command, this one, if you are in Linux:
apt-get update && sudo apt-get upgrade && curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh && docker version
And install also Docker-compose with:
apt install docker-compose -y
Gitea Docker Stack
The configuration file that we will use today to SelfHost Gitea with Docker is:
version: "3"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:1.14.2
container_name: gitea
environment:
- USER_UID=998
- USER_GID=100
- GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=db:3306
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=gitea
restart: always
networks:
- gitea
volumes:
- /srv/confs/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3033:3000"
- "2234:22"
depends_on:
- db
db:
image: mysql
restart: always
environment:
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
networks:
- gitea
volumes:
- /srv/databases/gitea/mysql:/var/lib/mysql
Deploy with CLI
Providing that the previous steps are clear, we can jump to our terminal and use:
sudo nano docker-compose.yml
This will open a text editor, where we can paste the following configuration file:
To save, use CTRL+O, then CTRL+X to exit.
Then just deploy the service with:
sudo docker-compose up -d
You are ready to discover the devices in your LAN, the service will be running in 0.0.0.0:8080 or localhost:8080 if you use the configuration file as it is provided.
If you have deployed it in one device at home, you can use it from any other connected at the same router, just use the internal IP of the device in which you made the deployment.
You can check that in Linux with:
hostname -I
Gitea with Client GUI
How to configure GIT user and mail
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
FAQ
How to Deploy Nginx Proxy Manager
If you are interested in deploying a separated NGINX instance with Docker, I already created a guide for that here.