When I started on steemit a few days ago, I realized that I need a bit of time before publishing a new article. During this time I draft the article local and rewrite it several times, the usual creative way. As Markdown is perfect for version control software, I felt the need for aGit repository, managing the changes and having a fallback if something goes wrong.
To realise this I wanted my own, self hosted Git repository. As I prefer open source and do not have the 4 GB minimum RAM for GitLab, I moved to Gitea. The rough relationship between GitHub und Gitea is as following:
GitHub was rebuild by GitLab as open source version. GitLab consumed a few similar projects and is extremely feature rich but also memory consuming. To reduce the memory consumption it was rebuild in GO and reduced to its key features. As the Gogs developer did not react to pull requests for a few months, it was forked as Gitea and is regularly managed since then.
Scroll down to chapter Installation process. There you can find a tutorial how to install Gitea using Docker and connecting it to the host database.
I myself prefer having my data on my own infrastructure. Moreover there are no unlimited, free private repositories on GitHub and I like my drafts private before publishing. But the main reason would be because I can do it, I have my own server which is mostly idleding around and I love experimenting.
As said before, I love experimenting. If I install software for testing purposes on my online system, the dependencies become confusing over the time. This is where Docker comes into play.
If you never heard of Docker, I suggest reading the What is Docker? article first. Anyhow the following lines are sufficiant for a rough understanding:
Docker simply sharing the main functions of the current linux kernel (e.g. disk access, ram access) and additionally installs only compoents inside the containers which are needed by the processes. This way every process dependency (e.g. Python, Go) for GitLab, Gitea will be installed in the container without touching the host. Moreover these containers are completely isolated, so they can be moved, removed or copied without problems.
So, why shouldn't I use a Docker image which runs the software, contains all dependencies and combine it with the host installation of MariaDB?! In this article I will use my local database which is running for other projects. Gitea can simply removed using a docker rm.
The installation process includes installing the Docker community edition, download and configuration of Gitea Docker container and finally the installation of Gitea.
To install Docker I suggest reading the following page Get Docker CE for Debian. Installation manuals for different distributions or operating systems are selectable.
Install the packages docker and docker-compose. Docker-compose is a toolset which enables a simple management of different linked Docker containers in a YML file. In my point of view it is better manageable and more readable than saving the run string in a bash file.
The install process creates the following environment:
The following installation process worked for me:
mkdir /var/lib/Gitea
version: '2'
services:
Gitea:
image: Gitea/Gitea:latest
ports:
- "10080:3000"
- "10022:22"
volumes:
- /var/lib/Gitea:/data
- /var/run/mysqld/mysqld.sock:/tmp/mysqld.sock
RequestHeader set X-Forwarded-Proto "http"
RequestHeader set X-Forwarded-Port 80
ProxyPreserveHost Off
ProxyPassMatch ^/((?!(?:errors|\.well-known)/).*) http://localhost:10080/$1 retry=30 timeout=7200
ProxyPassReverse / http://localhost:10080/
To create fast ssh connection to your personal Git I would recommend creating a ssh_config file. This is a file to create SSH-Aliases and configure them with individual passwords, users, ports or keyfiles. Due to this file you do not get regularly requests asking for your password. In linux filesystems the file is usually created in /home/USERNAME/.ssh/config.
Host git
HostName git.example.com
Port 10022
User Git
IdentityFile ~/.ssh/id_rsa
git clone ssh://SSH_ALIAS/USERNAME/REPOSITORY.Git
For repository test of user bob:
git clone ssh://Git/bob/test.Git
If there is anything wrong or you have problems with the tutorial, please drop me a short comment. If you like it please follow and stay tuned for other tutorials or tv show reviews.