Gitea is a self-hosted git service and interface. You can host your projects on your own server using Gitea. This article describes the installation of gitea on pardus.

Docker installation

We can choose docker environment for Gitea installation. In this way, gitea can run in an environment independent of our main system. You can also run gitea directly on your server if you want.

First, let's perform a docker installation.

apt update apt install docker.io

Now let's pull the Pardus docker image.

docker pull pardus/twenty one

Next, let's create a docker container.

docker run -it --name gitea -p 3000:80 -v /gitea:/gitea pardus/twenty-one # We forwarded port 3000 to 80 with the -p parameter # We transferred the /gitea directory into the container with the -v parameter.

Downloading Gitea

Playing git ve wget Let's install the packages.

apt update apt install git wget -y

If you want to use git with ssh openssh-server You have to install the package.

apt update apt install openssh-server -y

If you are using it in Docker, the ssh service will not work without the service manager. We need to start the service manually.

https://dl.gitea.com/gitea/ Download the current version suitable for you from the address and /gitea copy to directory.

Then let's make it executable.

Now let's create a new user for gitea. /gitea Let's give the ownership of our directory to this user.

Now we can run gitea.

Configuring Gitea

After installing Gitea, let's enter our browser and make the first installation.

The Docker container will close when you close the window. To prevent this, let's first close the container and run it again as follows.

Running Gitea as a service

If you are not using docker screen You can make it run in the background in the same way as the command.

# log in screen -S gitea su gitea -c ./gitea-1.20.0-linux-amd64 # We can log back in by doing ctrl-a + d. # list sessions screen -ls # login screen -r xxxx

Or instead we can write and run a systemd service like below. Service file below /lib/systemd/system Let's save it to the location and then start the service.

[Unit] Description=Gitea (Git with a cup of tea) After=syslog.target After=network.target [Service] RestartSec=2s Type=notify User=gitea Group=gitea WorkingDirectory=/gitea ExecStart=/gitea/gitea-1.20.1-linwork.target [Service] RestartSec=64s WantedBubler.
systemctl enable gitea.service systemctl start gitea.service

CI installation with Gitea actions

Playing custom/conf/app.ini Let's enable actions from our file. This feature is not turned on by default. Add the following setting to the end of the file.

[actions] ENABLED=true

Now is https://dl.gitea.com/act_runner Let's download the latest version and the one suitable for our architecture from.

act_runner we can use a different server with high processing power to run it. There is no obligation to work on the same machine as Gitea. You can also distribute the workforce between servers by adding multiple runners.

Note: if act_runner If we are going to run the application in docker https://docs.gitea.com/next/usage/actions/act-runner#register-the-runner-with-docker You can get detailed information at.

Let's get tokens from Gitea interface.

Now if you are asking act_runner using this token in our app register Let's do the operation.

# instance value must be the address of the server. # token value is the token value we are talking about. ./act_runner-0.2.3-linux-amd64 register --no-interactive --instance --token

Note: act_runner if you want the settings later .runner You can change the file.

Later act_runner Let's run our application as a service.

./act_runner-0.2.3-linux-amd64 daemon

Using Gitea Action

To use Actions, we must first enable it from the repo settings.

Then we can write an instruction as follows in our project.

Then you can view the working status from the actions menu.

references

https://docs.gitea.com/next/installation/install-from-binary

https://github.com/go-gitea/gitea/blob/main/contrib/systemd/gitea.service

https://docs.gitea.com/next/usage/actions/quickstart