Become your own DevOp with Gitea and Drone

Have you ever needed to host your own “GitHub“ because of some privacy restrictions of code you have built? Or you do not want to show the entire world your code because of your super cool product and your competitors aren’t sleeping?

I was recently in kind of such a situation. So what do you do? Well I went asking Mr. Google. He then replied with something like “Docker, Gitlab, Drone“.

Luckily I run at home a Synology NAS where I installed the Docker Package. So I tried Gitlab CE but the running Gitlab container took almost all of my 2GB of RAM and some Synology services started to behave laggy.

That was not satisfying to me and I went again searching for something that was more lightweight. And tataaa… I found Gitea.

Gitea - GitHub’s little brother

If you head over to Gitea you very quickly will notice that it almost resembles Github. From a feature view perspective it comes along with all the nitty and gritty features a modern git based developer needs. Gitea also ships with a docker image. You can pull it from the docker hub. It is a very small image only about 77MB. Once you spin it up as a docker container it consumes about 80MB of your RAM. Compared to the Gitlab container a huge RAM saver.

Now with Gitea I have finally a very lightweight source code management system but it comes without any CI/CD features whereas Gitlab has already an integrated one. That’s where I had a look at Drone.io.

Drone - a docker based Continuous Delivery platform

Drone integrates very easily with Gitea and is lightweight as Gitea. It’s concept is completely based on docker which means each time you commit some code it triggers the CI pipeline if configured correctly and takes your project, puts it into a docker container, runs the configured commands like “dotnet restore, dotnet build, dotnet test” and and and… You should know what a CI/CD system is all about.

Docker-Compose for gitea and drone

Below I have a very simple docker-compose file just in case you want to poke around.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
version: '3'

services:
gitea:
image: gitea/gitea:1.11.1
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- RUN_MODE=prod
ports:
- 3000:3000
volumes:
- ~/work/docker/gitea/data:/data
restart: always

drone:
image: drone/drone:1.6.5
container_name: drone
environment:
- DRONE_GITEA_CLIENT_ID=<some-client-id>
- DRONE_GITEA_CLIENT_SECRET=<some-client-secret>
- DRONE_GITEA_SERVER=http://localhost:3000
- DRONE_GIT_ALWAYS_AUTH=false
- DRONE_RPC_SECRET=mysecret
- DRONE_SERVER_HOST=drone:3001
- DRONE_SERVER_PROTO=http
- DRONE_TLS_AUTOCERT=false
ports:
- 3001:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ~/work/docker/drone/data:/data
restart: always

So what…

I am very happy with my own little DevOps environment. Ok I agree the term “DevOps” in here is slightly exaggerated but hey, for me DevOps starts here!

What kind of own hosted DevOps environment do you have?

Cheers Thomas