GitLab

Disclaimer
This guide is a rough port from the official guide and various internet references.

Some of the steps have been consolidated and obviously customized to the standard Gentoo environment.

If something is missing, please make a point of updating this article, with special attention to dependencies please.

If you don’t like long installation guides likes this, you can use unofficial www-apps/gitlabhq ebuild from CVUT Overlay. There’s also a short guide for dummies how to install it and configure your web server. But it receives updated not often. If you use systemd then you need gitlab.conf, gitlab-sidekiq.service and gitlab-unicorn.service.

The Layman's Guide
The Gitlab overlay in layman, originally the CVUT overlay, is currently on par with the latest gitlab version (7.12 as of June 2015). It supports gitlab migrations in a post-configure step, for those performing upgrades. You can find the repo and issues here. Fritteli's Gentoo overlay provides an alternative, though the installation instructions are not documented here.

The overlay is added to layman using the command

One must then accept the following keys in /etc/portage/package.accept_keywords.

where ARCH is your architecture and M.m.i are the Major, minor and intermittent/incremental version numbers.

Next emerge and configure the package using the following commands and adhering to the instructions in the emerge output.

Note : The unicorn.rb file is not mentioned in these instructions but it too resides in /etc/gitlabhq-M.m/ and must be created and modified from it's corresponding .example file.

Otherwise for a more Gentoo-ish approach to installation read on.

Prerequisites/Dependencies

 * version 2.7.x
 * version 2.0.x
 * version 2.7.x
 * version 2.0.x
 * version 2.0.x

Optional: if you wish to receive mailing notifications from GitLab, then you should probably install a mail server. The recommended server is Postfix.

Next, we tell gentoo to start redis automagically:

Prepare the Necessary Users
Gitlab uses the git user, so add it:

MySQL/MariaDB
Merge mysql if you have not already.

Setup root mysql password.

Turn on mysql.

Set mysql to start upon reboot.

Create the database and user:

Test connecting to the databases with the new user:

PostgreSQL
Merge postgresql-server, or postgresql-base if you have PostgreSQL on another server.

For PostgreSQL there are different methods of authentification. For a installation on the local machine I prefer using the local account when connecting trough a socket. By default this is enabled.

Create a database and a new user without a password and give him ownership of it. Remember, when connecting trough the socket the shell user is used for authentification, so its name must be git.

The git user will need access to the PostgreSQL socket, so it's required to add him to the postgres group

And a little test, just to be sure everything went fine:

Copy the example database configuration file:


 * Edit the new configuration file and add the database credentials just created:

Install Needed Gems
Note that charlock_holmes has a bug on gentoo, so we have to use this workaround:

Note that you might experience an error message about a dropped dependency called "modernizr". This is a frontend gem who has been renamed. This has to be added to the Gemfile:

just search the modernizr (v. 2.6.2) package and rename it to "modernizr-rails", "2.7.1". Also Note that a (maybe failing) command, being issued before, has created a Gemfile.lock. This lock file would need an edit as well (two mentions of modernizr).

Then build the package depending on your database setup, excluding the staging and dev environment (which have not been set up yet) and the not-used database:
 * mysql


 * postgresql

Download and Start the Initscript
At the time of writing, this init script is confirmed to work with Gitlab versions 6, just edit the user and home directory:

Nginx
Download the official template and activate it:

Use your favorite text editor to change the relevant portions:

Apache/Passenger
go over to the rails page, and fix up passenger...

You need to deviate on the configuration of file, to adapt DocumentRoot and  directives to use. Thus, add the following virtual host to manage gitlab :

dont forget to

&&

Finish Installing
Use your favorite web browser to navigate to the new host you set up

If everything loads properly, the installer has made an admin account for you.

Diagnostics
Run this command to get your full diagnostic.

Push, Pull, Clone
Users to push, pull, clone generate ssh-rsa key.

Using the GitLab web page interface, add your user key to your user, & create new repository.

Many commands will show up, they need to be run on your users computer.

The command 'git push -u origin master' will activate the repository created and allow cloning.

clone using the url the web interface gives you. (replace localhost with IP address, or fully qualified domain name)

Omniauth
In the file there's a section that controls login from remote sites such as Google, Twitter, and GitHub. change enabled: false to enabled: true. then scroll down and remove all ## marks from

{{FileBox|filename=/home/gitlab/gitlab/config/gitlab.yml|lang=yaml|1= }}
 * 1)    - { name: 'google_oauth2', app_id: 'YOUR APP ID',
 * 2)        app_secret: 'YOUR APP SECRET',

and ensure to leave the leading - on the first line.