i Install and configure gitlab in ubuntu 16.04 from Omnibus package – All things in moderation

Install and configure gitlab in ubuntu 16.04 from Omnibus package

introduction

  • Gitlab is a Git-based fully featured platform for software development!
  • GitLab CE (Community Edition), is an open source application primarily used to host Git repositories. It is designed to be hosted using your own infrastructure, and provides flexibility in deploying as an internal repository store for your development team.
  • Omnibus is a way to package different services and tools required to run GitLab, so that most users can install it without laborious configuration.
  • In this tutorial, I will cover you how to install and configure gitLab-ce on an ubuntu 16.04 server from Omnibus package.

hardware requirements

The published GitLab hardware requirements recommend using a server with:
– CPU: 2 cores is the recommended number of cores and supports up to 500 users
– RAM: 8GB RAM is the recommended memory size for all installations and supports up to 100 users

Gitlab Omnibus package installation

sudo apt-get update -y
sudo apt-get install ca-certificates curl openssh-server postfix -y
cd /tmp
wget  https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
sudo bash /tmp/script.deb.sh
sudo apt-get install gitlab-ce -y
sudo gitlab-ctl start 

http://server_ip_address and setup your admin password

Editing the GitLab Configuration File

– Config file setup public domain:** /etc/gitlab/gitlab.rb**

# Auto redirect to domain
external_url 'https://yourdomain.com'

# Letsencrypt cert 
letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['[email protected]']

-Save and close the file, then run following command to reconfigure gitlab:

sudo gitlab-ctl reconfigure

– Create cron job to auto renew let’s encrypt certificates:

Create following script and save to /etc/cron.daily/gitlab-le (auto renew each day)

#!/bin/bash
set -e
/usr/bin/gitlab-ctl renew-le-certs > /dev/null

Then set make executable for this file:

sudo chmod +x /etc/cron.daily/gitlab-le

BACKUP & RESTORE

1. backup

– Create backup

sudo gitlab-rake gitlab:backup:create

Backup location: /var/opt/gitlab/backups/ **(Described in the gitlab.rb configuration gitlab_rails[‘backup_path’]. Default is **/var/opt/gitlab/backups/)

– Auto Upload backup to remote store:

Edit config in /etc/gitlab/gitlab.rb
**Google cloud: **

gitlab_rails['backup_upload_connection'] = {
  'provider' => 'Google',
  'google_storage_access_key_id' => 'Access Key',
  'google_storage_secret_access_key' => 'Secret'
}
gitlab_rails['backup_upload_remote_directory'] = 'my.google.bucket'

Amazon S3

gitlab_rails['backup_upload_connection'] = {
  'provider' => 'AWS',
  'region' => 'eu-west-1',
  'aws_access_key_id' => 'AKIAKIAKI',
  'aws_secret_access_key' => 'secret123'
  # If using an IAM Profile, don't configure aws_access_key_id & aws_secret_access_key
  # 'use_iam_profile' => true
}
gitlab_rails['backup_upload_remote_directory'] = 'my.s3.bucket'

– Save configure fo the changes take effect:

sudo gitlab-ctl reconfigure

2. Restore backup:

– Copy backup file to backup locaton:

sudo cp 11493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar /var/opt/gitlab/backups/

– Stop the processes that are connected to the database. Leave the rest of GitLab running:

sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# Verify status
sudo gitlab-ctl status

– Start restore backup:

sudo gitlab-rake gitlab:backup:restore BACKUP=1493107454_2018_04_25_10.6.4-ce

Reference

https://docs.gitlab.com/

Leave a Reply