📜 ⬆️ ⬇️

New home for repository or history of moving to GitLab

Good day.
I work as a Ruby developer in a rapidly growing IT company. And once we made a strategic decision to change the service to work with Git. All who are interested, please under the cat.



Part 1. Start


Up to this point, we used gitolite . I will give a little bit of history and tell those who do not know what kind of animal it is.
')
Here is the official website: gitolite

Short description from git-scm.com :
Gitolite is an additional layer on top of Git that provides ample control over access rights.


Not bad article on Habré: Acquaintance with gitolite

In short, this is a small console utility to help ordinary developers maximally painlessly set up the minimum protection for their repositories and those of their teams.

Let's start in order. Here is a basic example of a config file taken from office. site:

# sample conf/gitolite.conf file @staff = dilbert alice # groups @projects = foo bar repo @projects baz # repos RW+ = @staff # rules - master = ashok RW = ashok R = wally option deny-rules = 1 # options config hooks.emailprefix = '[%GL_REPO] ' # git-config 


In these lines, sets of users ( @staff ) and repositories ( @projects ) are declared :
 @staff = dilbert alice # groups @projects = foo bar 


This block sets the level of access to the repositories in the projects set, as well as the baz repository.
It also describes the rights, and in particular, that full rights are set for the staff user group.
The next line contains a ban on access to the master branch for the user ashok . Apparently, somewhere he firmly nakosyachil :)
 repo @projects baz # repos RW+ = @staff # rules - master = ashok RW = ashok R = wally 


Well, and so on ... All this is well described in the documentation, and everyone can see the details there.

Part 2. New Hope


We continue!

This is all good, elegant and subject only to real experts. Once we really wanted to watch the README files directly in the browser, without parsing through the eyes of markdown . And they remembered that they saw somewhere a standalone solution called GitLab .

Now smoothly move on to this wonderful tool!

Official site: GtiLab

Ironic repository with GitLab on GitHub: repo

I will not give tons of screenshots and descriptions, as this is a well-developed and huge product, and all the information in its original form is beautifully described in the descriptions and documentation on the site.

In short, this is a kind of analogue of GitHub (let them shower me with tomatoes). It uses a rights delineation model similar to GitHub. The main difference from gitolite became the so-called namespaces. If in gitolite we explicitly indicated which set of users has access to the repository, then in GitLab the project must be located in a certain space and, accordingly, this affects the URL. Example:

gitolite
 git@git.yourcompany.com:some_repo 


GitLab (let's say the project got namespace ruby )
 git@git.yourcompany.com:ruby/some_repo 


As a matter of fact, this became the most obsessive problem in our move, since it required changing the remote in the local developer repositories.

As for GitLab subscriptions, there are several options. The first of these is CE - Community Edition - open source product and omnibus installation. Actually, this option we use, deploying on its hardware. Especially considering that the project is written in Ruby, then you can freely modify the required files (well, at least those who know Ruby).

There is also an Enterprise Edition - as the name suggests, it becomes clear that this is a version for large and powerful communities of development gurus. But it costs money, and is not really needed for our purposes, because the CE version performs all the required tasks with a bang!

Part 3. Benefits


But it's not about subscriptions. I would really like to describe what I consider to be a perfectly implemented and useful (especially for me) functionality:

1. Availability Issues for projects. Yes, yes, there is a GitHub, but now it's on our internal server.
2. Works with Merge Requests. We do not always use it, but the graphical presentation is much more convenient than viewing the code in the console.
3. Snippets - analog Gist. Again, but his.
4. GitLab CI is a great tool for Continuous Integration. Out of the box, directly integrated with your versioning system, and default Docker support.
5. Deploy keys in projects - keys to read the repository during deployment (for example, in conjunction with Capistrano). In gitolite, a separate user with read permissions was created for these purposes.
6. Service Templates - a set of prepared settings for integration with a bunch of services (JIRA, Asana, HipChat, etc.)
7. Using GitLab as a SaaS is free. A great alternative to Bitbucket. Spoiler, but something I have already laid out on GitLab (see below).

Part 4. Reality


But honestly, not everything went smoothly. There was one curiosity.

Situation: a repository with a size of ~ 50MB suddenly gnawed and thickened to ~ 18.5GB! 18.5GB, KARL! .

I will say right away that we have not found the root of evil. I can only say that the problem was that the pack-files were not properly cleaned, and each new pack-file contained changes in the repository and the previous pack-file. And all this happened after the rain on Thursday, a joke, when pushing by one of the developers through the interface of the popular IDE.

But in the end, with the help of magic, namely one command, we were able to solve the problem (if anything, perform in the folder with the repository on the server).
 git gc --auto 


I can not say, as I wrote above, what exactly was the problem, but there is an assumption that we ourselves have messed up when importing the project.

Part 5. Contribution


I also developed a rake task set for moving from gitolite to GitLab.
In fact, this is a reworked standard task for import into GitLab. You can put it in the lib / tasks folder in GitLab and run it from there.

You can find it here .

Conclusion Questionnaire


What version control tool do you use? Answer in the comments. I will try the most interesting ones for myself and maybe I will make a comparison. All new tools are developing very rapidly, you do not have time for all.

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


All Articles