GitLab

From RHS Wiki
Jump to navigation Jump to search

Install Omnibus Package[edit]

www.gitlab.com

Disable bundled Nginx[edit]

@/etc/gitlab/gitlab.rb

Setup Nginx[edit]

see snippet @https://git.herrerosolis.com

Install From Source (Not recomended)[edit]

see: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md
ssl: https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/misc/ssl-certificate-implemented

Upgrade gitlab-shell[edit]

cd /home/git/gitlab-shell
sudo -u git -H git fetch
sudo -u git -H git checkout v1.9.6

Resync authorized_keys file[edit]

sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production

Database[edit]

Recomended PostgreSQL

# Install the database packages
sudo apt-get install -y postgresql postgresql-client libpq-dev

# Login to PostgreSQL
sudo -u postgres psql -d template1

# Create a user for GitLab
# Do not type the 'template1=#', this is part of the prompt
template1=# CREATE USER git CREATEDB;

# Create the GitLab production database & grant all privileges on database
template1=# CREATE DATABASE gitlabhq_production OWNER git;

# Quit the database session
template1=# \q

# Try connecting to the new database with the new user
sudo -u git -H psql -d gitlabhq_production

# Quit the database session
gitlabhq_production> \q

Default repositorys[edit]

git_data_dir "/var/opt/gitlab/git-data"


Registry[edit]

Add to /etc/gitlab/gitlab.rb the following line

registry_external_url 'https://git.rra.lan:4443'

Run

gitlab-ctl reconfigure


Let's Encrypt[edit]

Add to /etc/gitlab/gitlab.rb the following lines

letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['redteam@bbva.com']
letsencrypt['auto_renew_hour'] = "12"
letsencrypt['auto_renew_minute'] = "30"
letsencrypt['auto_renew_day_of_month'] = "*/7"
letsencrypt['auto_renew'] = false

Run

gitlab-ctl reconfigure

Update[edit]

Guide Notes:
If it fails with: gem "pg"...
Edit /home/git/Gemfile
Search for:

 # Supported DBs
 gem "mysql2", '~> 0.3.16', group: :mysql
 #gem "pg", '~> 0.18.2', group: :postgres   <--------COMMENT THIS LINE 

Search for:

 group :production do
   gem "gitlab_meta", '7.0'
   gem "pg", '~> 0.18.2', group: :postgres  <--------- ADD THIS
 end 

If it fails with *pg_trgm*

sudo apt-get install postgresql-contrib
sudo -u postgres psql -d gitlabhq_production -c "create extension pg_trgm;"

CI Runner setup @raspberry pi[edit]

GitLab Documentation

  1. Install Docker
    curl -sSL https://get.docker.com/ | sh
  2. Add gitlab repository
    curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash
  3. Debian should use apt pinning
    cat > /etc/apt/preferences.d/pin-gitlab-runner.pref <<EOF
    
    Explanation: Prefer GitLab provided packages over the Debian native ones
    Package: gitlab-ci-multi-runner
    Pin: origin packages.gitlab.com
    Pin-Priority: 1001
    EOF
  4. Install gitlab-ci-multi-runner
    sudo apt-get install gitlab-ci-multi-runner