My GitLab CE notes (Ubuntu .deb installation)

They only way I found to keep my changes after a git-lab reconfigure is by editing default.rb and production.rb, please leave a comment if you know an alternative.

1) Installation

Install omnibus-gitlab from: https://www.gitlab.com/downloads/

sudo dpkg -i gitlab_6.6.5-omnibus-1.ubuntu.12.04_amd64.deb

2) Change Unicorn port and email addresses

Edit /opt/gitlab/embedded/cookbooks/gitlab/attributes/default.rb

# I am running Jenkins on 8080 so I need to change Unicorn port to 9292.
default['gitlab']['gitlab-rails']['internal_api_url'] = "http://localhost:9292"
default['gitlab']['unicorn']['port'] = 9292

# Change default emails
default['gitlab']['user']['git_user_email'] = "[email protected]"
default['gitlab']['gitlab-rails']['gitlab_email_from'] = "[email protected]"
default['gitlab']['gitlab-rails']['gitlab_support_email'] = "[email protected]"

3) (optional) Configure smtp

UPDATE: I decided to configure mailgun directly on my server, see: https://blog.gimpe.com/2014/04/configure-mailgun-on-ubuntu-bsd-mailx-postfix/

Edit /opt/gitlab/embedded/service/gitlab-rails/config/environments/production.rb

# use mailgun for emails
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.smtp_settings = {
    :address => "smtp.mailgun.org",
    :port => 587,
    :domain => "",
    :authentication => :plain,
    :user_name => "",
    :password => "",
    :enable_starttls_auto => true
  }

4) Keep backup for 1 week

Note: I use a ZFS partition with daily snapshots.

Edit /opt/gitlab/embedded/cookbooks/gitlab/attributes/default.rb

default['gitlab']['gitlab-rails']['backup_keep_time'] = 604800

See commit: Merge branch ‘allow_setting_backup_keep_time’ into ‘master’

edit /opt/gitlab/embedded/cookbooks/gitlab/templates/default/gitlab.yml.erb

# uncomment backup keep time
 keep_time: 604800 # default: 0 (forever) (in seconds)

5) Use a NFS mount for backups

Edit /etc/fstab

host:/mnt/vol1/backup/gitlab /var/opt/gitlab/backups nfs _netdev,auto  0  0

6) Schedule daily backups in crontab

Type sudo crontab -e

0 2 * * * gitlab-rake gitlab:backup:create

7) (optional) Change hostname

Edit /var/opt/gitlab/gitlab-rails/etc/gitlab.yml

# change hostname (if needed)
    host: gitlab.local

8) Reconfigure!

sudo gitlab-ctl reconfigure

Leave a Reply

Your email address will not be published. Required fields are marked *