GitLab

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.

This is a long installation guide, an alternative would be to use the unofficial www-apps/gitlab-ce ebuild from Fritteli’s Overlay.

The Layman's guide
The Gitlab overlay, 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. The repo and issues can be found here. Fritteli's Gentoo overlay provides an alternative, though the installation instructions are not documented here.

The overlay may be added using either or.

To add using :

To add using :

One must then add the following keywords to be accepted by portage

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

Setup a git user with a home directory, then export it into an environmental variable. The git user will also need to be part of the 'redis' group. This is important later on as the configuration script needs access to /var/run/redis/redis.sock.

Next emerge the package. You will also need the newest version of bundler, redis and rake for redis to work correctly.

For some reason, the gitlabhq package doesn't user bundler to install sidekiq and unicorn-rails. You can install them through using gem. Sidekiq is needed for redis to work correctly, unicorn-rails is needed for gitlabhq.

Next, create all required configuration files from example configs (if they don't exist):

If intending to use PostgreSQL:

It may be desirable to create a sidekiq config:

Default owners are incorrect.

Then change some values in Gitlab-shell config. By default, user git is supposed to have a home directory, but expects it to have a home in. It has to be fixed:

Change all occurrences of to.

Now you need to configure redis to have a UNIX socket.

Restart redis.

Assuming you're using Postgresql and have it configured, the gitlabhq configuration script expects a ROLE with the username of git, a password of 'gitlab', LOGIN, CREATEDB and SUPERUSER privileges.

Finally you can run the configuration script.

Now you can start the gitlabhq service:

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

Prerequisites and dependencies

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

Optional: To receive mailing notifications from GitLab, install a mail server. The recommended server is Postfix.

Next, tell Gentoo to start redis automagically:

Prepare the necessary users
Gitlab uses the git user, so add it:

MySQL/MariaDB
Merge mysql if it has not been done so 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 the PostgreSQL installation is on another server.

For PostgreSQL there are different methods of authentication. For a installation on the local machine some administrators prefer using the local account when connecting through a socket. By default this is enabled.

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

The git user will need access to the PostgreSQL socket, so it's required to add the user 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 a workaround is required:

Note that there might be 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 the 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 a favorite text editor to change the relevant portions:

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

The file needs to be edited, to adapt DocumentRoot and  directives to use. Thus, add the following virtual host to manage gitlab :

Now apache has to be restarted, don't forget to

Finish installing
To remove login for the git user (Optional), use this:

Then build the assets for the Web Frontend using:

Use a favorite web browser to navigate to the new host that was set up

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

Diagnostics
Run this command to get a full diagnostic.

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

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

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

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

clone using the url the web interface displays. (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.