📜 ⬆️ ⬇️

Gogs: lightweight git service



Among the most discussed latest news in the developer community were the new GitHub fares (see, for example, here ).

Of course, the new tariffs have their advantages, but with the current dollar rate they can hardly be called profitable for Russian users.
')
Some resort to an alternative solution and deploy GitLab (or another git-service) on their own or rented server.

But this solution also has its pitfalls: GitLab is very picky about system resources. For individuals, it is much easier to pay $ 7 a month for GitHub than to rent a proper configuration server.

From the above, however, it does not follow that GitHub currently has no alternative. We would like to tell about one very interesting and promising solution in this article. Meet the: Gogs . This tool will be interesting for both individual developers and small companies.


general information



Gogs is a product of Chinese developers. At first glance, it is almost no different from GitHub or BitBucket - this is noticeable even by design.
But with all the external similarities, he has one advantageous difference from the existing analogues: lightness.

Gogs is written in Go (actually, this name is an abbreviation for Go Git Service). This fact results in serious advantages: low requirements for system resources, minimum dependencies, ease of installation and configuration.

Among the most important characteristics of Gogs should also be called:

Promotion of Gogs in the international market began in late 2014 - early 2015. In the spring of 2015, the first articles about him appeared on Western sites, which also contributed to the popularization of the product. But it was still too early to talk about full-fledged competition with GitHub and GitLab: Gogs didn’t even have support for pull-requests, let alone other important functions.

At the end of 2015, after more than half a year, a new version of the product was published. It was implemented many innovations, the most important of which are, of course, support for pull-requests and the ability to create wiki pages for projects.
The design of Gogs has also been significantly improved, and the interface has been translated into 18 languages, including Russian.

Gogs, GitHub and GitLab



Let's compare Gogs with other tools of the same kind. The results of the comparison for clarity, we present in the form of a table:

CharacteristicGogsGithubGitlab
Bug tracker+++
Support account organizations+++
Wiki+++
Code Review-++
Snippet code-++
Web Hooks+++
Git-hooks+only in enterprise versiononly in enterprise version
LDAP support+++
LDAP group synchronization-only in enterprise versiononly in enterprise version


Install Gogs



Consider the installation procedure and initial configuration on the example of OC Ubuntu 16.04. As a DBMS, take the familiar MySQL.

Install MySQL:
$ sudo apt-get update $ sudo apt-get install -y mysql-server 

After that create the gogs.sql file:
 $ nano gogs.sql 

Add the following lines to it:
 DROP DATABASE IF EXISTS gogs; CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8 COLLATE utf8_general_ci; 

Save the changes and execute:
 $ mysql -u root -p [  root]< gogs.sql 

To install gogs from source, you also need the git and mercurial version control systems:
 $ sudo apt-get install git mercurial 

Next you need to install the Go compiler. Open the /.bashrc file and add the following lines to it:
 export GOPATH=/home/git/go export GOROOT=/usr/local/src/go export PATH=${PATH}:$GOROOT/bin 

Save the changes and execute:
 $ source ~/.bashrc 

After that install the Go compiler:
 $ wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz $ tar zxf go1.4.2.linux-amd64.tar.gz $ sudo mv go $GOROOT 

All necessary dependencies are installed. You can install Gogs:
 $ go get -d github.com/gogits/gogs $ cd $GOPATH/src/github.com/gogits/gogs $ go build 

After the installation is complete, you need to configure running Gogs as a service. To do this, you just need to add the gogs.service file ( see the template here ) to / etc / system / systemd and then run the following commands :.
 $ sudo systemctl enable gogs $ sudo systemtctl start gogs 


If everything is done correctly, after the installation is completed, the Gogs settings page will be available at http: // [Server IP]: 3000 . All further configuration is done through a graphical interface; everything is pretty simple and intuitive. If you plan to link a domain to the server with Gogs, you will also need to install Nginx and configure it as a reverse proxy (for more, see the official documentation ).

In the installation procedure Gogs nothing complicated. But if you are a user of our Vscale service (by the way, an excellent reason to become one), then everything can be made even simpler: just recently we added a corresponding image to the control panel. One click - and the virtual machine with already installed and configured Gogs is created and ready to use:

image

Once the server is created, open the http: // [server IP address] page in the browser. You do not need to configure anything extra: everything is already written in the template and is ready to work.
Log in to Gogs using the login and password you received during installation.

Gogs at work



Working with Gogs is easy. If you have experience with GitHub, then you can easily figure it out. For novice users in the control panel are detailed cheat sheets.
We give an elementary example. Let's create a test repository through a GUI.
After that we clone it to the local machine:
 $ git clone http://[IP- ]/root/test.git 

Make some small changes to the README.md file:
 $ echo 'Test' >> README.md 

Let's make the changes:
 $ git add --all && git commit -m "init commit" && git push origin master 

You will be prompted to enter the username and password of the Gogs user. After this commit will be added to the repository. In the control panel, it all looks like this:



Conclusion



We tried to work with the Gogs - and were quite pleased. The product of Chinese developers has prospects, and not bad. Over the past year (and the first time we met Gogs in early 2015), a lot of work has been done to improve it, and we hope that it will continue in the future.

Gogs is already quite a decent alternative to GitHub and GitLab. In terms of consumption of system resources, it is much more economical than any of the similar solutions. According to the developers in his blog, it can be installed even on RaspberryPi. We do not know what about RaspberryPi, but on the virtual server of the simplest configuration in Vscale Gogs it works quite stably on a small number of repositories. We invite everyone to try and evaluate. If you already have experience with Gogs - we will be happy if you share it in the comments.

Especially for those who want to get ready-made customized git-service, but at the same time prefer more traditional and already proven solutions, we added an image with GitLab. Immediately, we note that it is not available for the most budgetary and popular tariffs: GitLab consumes too much system resources, and the servers of the “junior” configurations simply won't pull it.

Taking this opportunity, we would like to discuss another important topic. Today, some VPS providers offer pre-installed software images. In Vscale , for example, we already have: Ajenti, VestaCP, WordPress, Docker, GitLab and Gogs. We are planning to expand this list considerably.
In this regard - a question for all VPS users: what images with preinstalled software do you need? What else, besides standard CMS and hosting control panels, would you like to see from your provider? If there is something on the list, please share in the comments.

Source: https://habr.com/ru/post/305422/


All Articles