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.

Prerequisites/Dependencies

 * version 2.7.x
 * version 1.9.x
 * Redis
 * version 1.9.x
 * Redis
 * Redis

Prepare the Necessary Users
Gitolite should use the git user, already created when git was installed:

Create a user for GitLab:

Generate a key for GitLab:

Copy GitLab's public key to Gitolite's home directory:

Create a folder for Gitolite's scripts and add the new directory to $PATH environment variable for user git:

Add Ruby to gitlab's $PATH environment variable:

Clone from GitLab's Fork
For the purposes of this guide, the Gitolite v3.2.0 fork provided by GitLab will be used:

Make sure you download the newest version and adjust the above command accordingly

Install
Use the installer to create a symlink to the Gitolite executable and then run the installer:

Test the Install
Clone the admin repository so SSH adds localhost to SSH's known_hosts file.

Once cloned successfully, the temporary file can be safely removed:

Configure the Package
Use your favorite editor to change localhost to your FQDN:

Make sure GitLab can write to the log/ and tmp/ directories:

Make a directory for satellites

Unicorn
GitLab makes use of the Unicorn RoR HTTP server to connect to your main webserver:

Then copy and edit the configuration file :

''If you choose to use TCP, adjust accordingly later. It is useful for testing with Links''

MySQL/MariaDB
Create the database and user:

Test connecting to the databases with the new user:

Copy the example database configuration file:


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

PostgreSQL
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 gitlab.

The gitlab 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 shure everything went fine:

Copy the example database configuration file:


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

Configure Git to Accept Gitolite
GitLab needs to be able to commit and push changes to Gitolite. In order to do that Git requires a username and email:

Configure GitLab Hooks
The GitLab hook system allows you to hook into other external systems you have setup, such as issue trackers, another production server, an irc bot, etc.

Install Needed Gems

 * mysql


 * postgresql

Download and Start the Initscript
Gentoo user andmarios has been kind enough to create an init script:

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 /home/gitlab/gitlab/config/gitlab.yml is 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


 * 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.