Getting started with gitlab

Installation for Debian 8

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce

sudo gitlab-ctl reconfigure

https://about.gitlab.com/downloads/#debian8

Restarting gitlab

To restart web service

gitlab-ctl restart
ok: run: gitlab-workhorse: (pid 29291) 0s
ok: run: logrotate: (pid 29299) 1s
ok: run: nginx: (pid 29305) 0s
ok: run: postgresql: (pid 29313) 0s
ok: run: redis: (pid 29327) 1s
ok: run: sidekiq: (pid 29331) 0s
ok: run: unicorn: (pid 29336) 1s

Reconfigure gitlab settings

La configuración de gitlab se guarda en un archivo .yml, que se genera a través de :

emacs /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure

To locate configuration files in our system

find / -name gitlab.rb
find / -name gitlab.yml

Logging

Gitlab logs are separated in three files: application, sidekiq and production

tail -f /var/log/gitlab/gitlab-rails/production.log
tail -f /var/log/gitlab/gitlab-rails/application.log
tail -f /var/log/gitlab/gitlab-rails/sidekiq.log

Code highlighting

For highlighting source code, Gitlab uses Rouge module.

To know whether a language will be coloured or not, they have this awesome website where you can actually test colouring different code snippets.

Available grammars are in Github.

Replace Github-linguist with source github version

First of all, we need to locate our github-linguist files which will be replaced. We will also need ruby-build and gcc.

find / -name languages.yml
apt-get install ruby-build gcc
ruby-build 2.1.0 /opt/gitlab/embedded/service/gem/ruby/2.1.0
cd /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/
wget https://github.com/github/linguist/archive/v4.7.5.tar.gz
tar -xvzf v4.7.5.tar.gz
mv linguist-4.7.5/ github-linguist-4.7.5
rm -f v4.7.5.tar.gz
# Install all ruby dependencies
bundle install

Generate samples.json:

After download from github,

bundle exec rake check_samples

Otherwise, we will face this error in logs

2016-03-30_07:49:38.08294 No such file or directory @ rb_sysopen - /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/github-linguist-4.7.5/lib/linguist/samples.json

Fetch all ace modes

bundle exec rake fetch_ace_modes

Problems with bundle install

gem install byebug -v '8.2.2'
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

Solved

apt-get install ruby-dev

When running bundle install, charlock_holmes would not be installed

gem install charlock_holmes -v '0.7.3'
(..)
checking for main() in -licui18n... no

Solved

apt-get install libicu-dev

We also had problems with rugged

gem install rugged -v '0.24.0'
(..)
checking for gmake... no
checking for cmake... no
checking for pkg-config... no
ERROR: CMake is required to build Rugged.

Solved

apt-get install cmake pkg-config
ln -s /usr/bin/make /usr/bin/gmake