GitLab

From KevinWiki

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
[[Category:Issue Tracking System]]
[[Category:Issue Tracking System]]
[[Category:Project Management]]
[[Category:Project Management]]
 +
[[Category:Ruby]]
= Installation =
= Installation =

Revision as of 02:26, 25 August 2013


Contents

Installation

Prerequisite

$sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev 

Install Postfix

Check out the Postfix page

  • If the following warning occurs when sending an email,
postdrop: warning: unable to look up public/pickup: No such file or directory

it's probably because sendmail was installed before and caused it.

  • Stop sendmail and restart postfix.
$ /etc/init.d/sendmail stop 
$ /etc/init.d/postfix restart 

Ruby

Ruby

Add Git User

$ sudo adduser --disabled-login --gecos 'git version control' git 

Install Gitlab-Shell

# Go to home directory
$ cd /home/git 
# Clone gitlab shell
$ sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git 

$ cd gitlab-shell 

# switch to right version
$ sudo -u git -H git checkout v1.7.0 

$ sudo -u git -H cp config.yml.example config.yml 

# Edit config and replace gitlab_url
# with something like 'http://domain.com/'
$ sudo -u git -H editor config.yml 

# Do setup
$ sudo -u git -H ./bin/install 

PostgreSQL

# Install the database packages
$ sudo apt-get install postgresql-9.1 libpq-dev 
# Login to PostgreSQL
$ sudo -u postgres psql -d template1 

# Create a user for GitLab. (change $password to a real password)
template1=# CREATE USER git WITH PASSWORD '$password'; 

# 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 

GitLab Installation

# install GitLab into home directory of the user "git"
$ cd /home/git 

Clone the Source

# Clone GitLab repository
$ sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab 

# Go to gitlab dir
$ cd /home/git/gitlab 

# Checkout to stable release
$ sudo -u git -H git checkout 5-4-stable 


Configuration

cd /home/git/gitlab

# Copy the example GitLab config
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

# Make sure to change "localhost" to the fully-qualified domain name of your
# host serving GitLab where necessary
sudo -u git -H editor config/gitlab.yml

# Make sure GitLab can write to the log/ and tmp/ directories
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX  log/
sudo chmod -R u+rwX  tmp/

# Create directory for satellites
sudo -u git -H mkdir /home/git/gitlab-satellites

# Create directories for sockets/pids and make sure GitLab can write to them
sudo -u git -H mkdir tmp/pids/
sudo -u git -H mkdir tmp/sockets/
sudo chmod -R u+rwX  tmp/pids/
sudo chmod -R u+rwX  tmp/sockets/

# Create public/uploads directory otherwise backup will fail
sudo -u git -H mkdir public/uploads
sudo chmod -R u+rwX  public/uploads

# Copy the example Puma config
sudo -u git -H cp config/puma.rb.example config/puma.rb

# Enable cluster mode if you expect to have a high load instance
# Ex. change amount of workers to 3 for 2GB RAM server
sudo -u git -H editor config/puma.rb

# Configure Git global settings for git user, useful when editing via web
# Edit user.email according to what is set in gitlab.yml
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "gitlab@localhost"

Important!!!!!: Make sure to edit both gitlab.yml and puma.rb to match the actual setup.


Configure GitLab DB settings

  • PostgreSQL

sudo -u git cp config/database.yml.postgresql config/database.yml

# Make sure to update username/password in config/database.yml.
# You only need to adapt the production settings (first part).
# If you followed the database guide then please do as follows:
# Change 'root' to 'gitlab'
# Change 'secure password' with the value you have given to $password
# You can keep the double quotes around the password
sudo -u git -H editor config/database.yml 

# Make config/database.yml readable to git only
sudo -u git -H chmod o-rwx config/database.yml 

Install Gems

cd /home/git/gitlab 

sudo gem install charlock_holmes --version '0.6.9.4' 

# for PostgreSQL (note, the option says "without ... mysql")
sudo -u git -H bundle install --deployment --without development test mysql unicorn aws 

Initialize Database and Activate Advanced Features

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

# Type 'yes' to create the database.

# When done you see 'Administrator account created:'

login.........admin@local.host
password......5iveL!fe


Install Init Script

  • Download the init script (will be /etc/init.d/gitlab):
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab 
sudo chmod +x /etc/init.d/gitlab 
  • Make GitLab start on boot:
sudo update-rc.d gitlab defaults 21 

Check Application Status

# Check if GitLab and its environment are configured correctly:

sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production 

Start GitLab Instance

sudo service gitlab start 
# or
sudo /etc/init.d/gitlab restart 

Double-check Application Status

# To make sure nothing is missing by running a more thorough check with:

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
# If all items are green, then congratulations on successfully installing GitLab! However there are still a few steps left.

Nginx

Installation

Nginx

Site Configuration

  • Download an example site config:
sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab 
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab 

Make sure to edit the config file to match the actual setup:

# Change YOUR_SERVER_FQDN to the fully-qualified
# domain name of your host serving GitLab.
sudo editor /etc/nginx/sites-available/gitlab 
  • Restart
sudo service nginx restart 
login.........admin@local.host
password......5iveL!fe
Personal tools