GitLab

The Gitlab overlay, originally the CVUT overlay, is currently on par with the latest GitLab version (14.0.1 as of June 2021). The repo and issues can be found here.

With version 13.8.3 the former www-apps/gitlabhq package was renamed to www-apps/gitlab. Since the gitlab core and gitlab-gitaly must neccessarily have the same version the former dev-vcs/gitlab-gitaly package was abandoned and gitlab-gitaly is now included in the www-apps/gitlab package.

By means of "Post Deployment Migrations" as described here starting with version 13.8.4 upgrading takes place without downtime (Nearly: The still required restart needs some time). This made the slots obsolete and so the upgrade procedure less complicated.

The migration from a www-apps/gitlabhq installation to a www-apps/gitlab one is supported by all www-apps/gitlab-13.8.x ebuilds. For more information read the 2021-02-10-gitlabhq-to-gitlab news message of the overlay.

Installation
The overlay may be added using either or.

To add using :

To add using :

GitLab requires the use of a database backend. Since version 12 PostgreSQL is the only supported database.

USE flags
The gitaly-config USE flag is explained in the 2021-02-22-etc-gitlab news of the overlay (since version 13.11.4 its default changed to 'on', as recommended by upstream). The gitaly_git USE flag uses the bundled Git from gitlab-gitaly instead of dev-vcs/git. The former puma and unicorn USE flags were removed because with GitLab 14.0 Unicorn was removed by upstream and Puma is now the only supported web server. The systemd USE flag is preselected since the maintainer of the overlay ran out of OpenRC hosts for init script testing. :-) But with the help of some users of the overlay the OpenRC init scripts will be provided further on.

Preparations
Add the following keywords to be accepted by Portage (we use amd64 as architecture here; x86 is also available):

If you disable the gitaly-git USE flag you also have to keyword the required version of dev-vcs/git (>= 2.31.0 as of gitlab version 13.12.1) and unmask its pcre-jit USE flag:

From GitLab 13.6 on Ruby 2.7 or later is required. Until Ruby 2.7 will be stabilized one must add further keywords to be accepted. As of January 2021 these were the following versions:

The overlay overrides the gentoo acct-user/git package introducing a new USE flag gitlab which creates the git user as required by www-apps/gitlab with HOME in /var/lib/gitlab/ and as member in the redis group. Add the USE Flag:

Emerge
Next emerge the package and follow the instructions given on the output (here the output of a 13.8.4 installation for an example).

Work through the list. Note that the database you specify in /etc/gitlab/database.yml will be deleted by the "Initializing database" step below! Finally run the configuration script (again with an example output).

The Administrator password and email are used for the initial administrator account of the GitLab web application. In the above omitted "messages from the database creation and initialization" you'll find the login and password for this account. You should use a working email address as on startup GitLab will send an "Access to the GitLab Instance group was granted" mail to this address.

Now copy the nginx example configs you need (at least gitlab-ssl plus gitlab-pages-ssl if you use pages) from /opt/gitlab/gitlab/lib/support/nginx/ to /etc/nginx/sites/ and adopt them your setup.

Finally start Nginx and GitLab, log in with the administrator account and adopt the default settings to your need.

Files
GitLab expects the parent directory of the config files to be its base directory, so the config has to stay in /opt/gitlab/gitlab/config/. Symlinking /opt/gitlab/gitlab/config -> /etc/gitlab doesn't work as GitLab uses the real path of the config files to get the parent directory. In order to use the standard Gentoo way of managing config files, the config files are copied to /etc/gitlab/ where you edit them and then synced back to /opt/gitlab/gitlab/config/ by running:

This rsync command is run automatically on start/restart of Gitlab. Only before the emerge --config of the first installation you have run this manually as GitLab does not run then but the emerge --config needs the up-to-date config. The rsync command updates only those config files in /opt/gitlab/gitlab/config/ that exist in /etc/gitlab/, so it suffices to have only the changed ones in /etc/gitlab/.

When the gitlab-config USE flag is set /etc/gitlab/ isn't used and you'll have to edit the files in /opt/gitlab/gitlab/config/ directly.

OpenRC
Starting gitlab:

Current status:

Starting automatically at system boot:

systemd
Starting gitlab:

Current status:

Starting automatically at system boot:

Diagnostics
Run this command to get a full diagnostic.

Usage
NGINX is the oficially supported webserver for GitLab. If you cannot or do not want to use NGINX as your web server, see GitLab recipes. You have to set up a sites config for GitLab. See /opt/gitlab/gitlab/lib/support/nginx/gitlab-ssl for an example site configuration.

The web interface is available at the URL you configured in /etc/gitlab/gitlab.yml: With the above the URL would be  https://gitlab ..

Upgrade
The www-apps/gitlab ebuild will check if one is on a supported "Upgrade path" (see the upstream update README) to ensure that the  requirements for "Upgrading without downtime" are met. The upgrade steps are:

If there are config updates (there were none in the above example output), do an etc-update before the restart:

Then do the database migrations with post deployment migrations by executing:

If the git -P diff ... command shows any differences in the nginx config examples you should merge the updates into your nginx config and restart nginx.

External Resources

 * ArchWiki GitLab - can be helpful while configuration section is incomplete in Gentoo wiki.
 * Official documentation
 * Configuration files Documentation