Reason: As of version 5.0,Gitlab will no longer depend on gitolite. Also redis is replaced by sidekiq. A rewrite is scheduled when 5.0 comes out on March 22nd. (Discuss in Talk:GitLab#)

Gitlab is a free git repository management application based on Ruby on Rails. It is distributed under the MIT License and its source code can be found on Github. It is a very active project with a monthly release cycle and ideal for businesses that want to keep their code private. Consider it as a self hosted Github but open source. You can try a demo here.

Note: In order to receive mail notifications, make sure to install a mail server. By default, Archlinux does not ship with one. The recommended mail server is postfix, but you can use others such as SSMTP, msmtp, sendmail, etc.

Ruby

GitLab supports ruby >= 1.9.3 and 2.0.0, but some dependencies gems work better with ruby 1.9.3. Install it from the official repositories and if you bump into any trouble use rvm with ruby 1.9.3-p392.

User accounts

Add git user:

# useradd -dmU /home/git git

Note:git user must have its initial group set to git (not users). If the initial group is not git, then all files created by the git user will be owned by git:users which will prevent GitLab from showing you a newly created repository (it will get stucked at the page where it tells you how to push to the new repository).

gitlab-shell

GitLab Shell is an ssh access and repository management software developed specially for GitLab.

Because systemd requires full path to binaries to launch (the path is not enough), create a symbolic link in /home/gitlab/bin/ that points to the **bundle** executable. We'll also add the folder to gitlab's PATH:

Web application specific settings

Email used for notification

/home/gitlab/gitlab/config/gitlab.yml

from: notify@example.com

This is how the mail address will be shown for mail notifications. Gitlab needs the sendmail command in order to send emails (for things like lost password recovery, new user addition etc). This command is provided by packages such as msmtp, postfix, sendmail etc, but you can only have one of them installed. First, check whether you already have the sendmail command:

# ls /usr/sbin/sendmail

If you get a ‘cannot access /usr/bin/sendmail’ then install one of the above packages.

Setup gitlab hooks

Check status

With the following commands we check if the steps we followed so far are configured properly. Before running the first command you must edit /home/gitlab/gitlab/lib/tasks/gitlab/info.rake. The script cannot determine OS version; simply replace os_name.squish! with os_name = "Arch Linux".

Server testing and resque process

Resque is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later. For the backstory, philosophy, and history of Resque's beginnings, please see this blog post.

Edit /etc/nginx/sites-enabled/gitlab and change YOUR_SERVER_IP and YOUR_SERVER_FQDN to the IP address and fully-qualified domain name of the host serving Gitlab. As you can see nginx needs to access /home/gitlab/gitlab/tmp/sockets/gitlab.socket socket file. You have to be able to run sudo -u http ls /home/gitlab/gitlab/tmp/sockets/gitlab.socket successfully. Otherwise setup access to the directory:

# chgrp http /home/gitlab
# chmod u=rwx,g=rx,o= /home/gitlab

Restart gitlab.service, resque.service and nginx.

Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels. First we rename the example file and then we start unicorn:

Configure Unicorn

Now edit config/unicorn.rb and add a listening port by uncommenting the following line:

listen "127.0.0.1:8080"

Tip: You can set a custom port if you want. Just remember to also include it in Apache's virtual host. See below.

Create a virtual host for Gitlab

Create a configuration file for Gitlab’s virtual host and insert the lines below adjusted accordingly. For the ssl section see LAMP#SSL. If you do not need it, remove it. Notice that the SSL virtual host needs a specific IP instead of generic. Also if you set a custom port for Unicorn, do not forget to set it at the BalanceMember line.