설치된 gitlab 을 업그레이드 하는 방법 .

RHEL/CentOS 6 에 DBMS 는 MySQL, 웹서버는 apache 기준이며 git 계정으로 su 하여 수행

 


사전 작업

ruby 업그레이드

  • 루비 1.9 는 지원하지 않으므로 업그레이드가 필요
  • 2.0 은 지원하지만 성능 이슈가 있으므로 2.1.x 이상을 권장

 

  1. github 에서 미리 컴파일된 rpm 다운로드

    wget https://github.com/lesstif/ruby-2.1.x-rpm/releases/download/2.1.5-x64/ruby-2.1.5-1.el6.x86_64.rpm
    CODE
  2. ruby 2.1 rpm 설치

    yum remove ruby
    yum localinstall ruby-2.1.5-1.el6.x86_64.rpm
    CODE
  3. gitlab 이 사용하는 루비 패키지 빌드를 위해 yum 으로 의존성 있는 패키지 설치

    ## charlock_holmes
    yum install libicu-devel cmake
    ## nokogiri
    yum install libxml2-devel libxslt-devel
    ## kerberos 5
    yum install krb5-devel -y
    CODE
  4. bundle 설치

    gem install bundler
    CODE
  5. bundle 로 패키지 설치(RHEL/CentOS 6에 gitlab 설치 참고)

    bundle install --deployment --without development test postgres aws   
    CODE

 

데이타 백업

gitlab 데이타 백업

cd /home/git/gitlab
bundle exec rake gitlab:backup:create RAILS_ENV=production
CODE

 

gitlab 서비스 중지

이 작업만 루트로 수행

sudo service gitlab stop
CODE

 

Upgrade

소스 fetch & checkout

마지막 소스 내려 받기

git fetch --all
CODE

stable 버전 확인을 위해 전체 브랜치 나열

git branch -a
 
From https://gitlab.com/gitlab-org/gitlab-ce
   e8c2c62..9d6d172  7-2-stable -> origin/7-2-stable
   f092e53..fb69ad3  7-3-stable -> origin/7-3-stable
   04dd845..19d572e  7-4-stable -> origin/7-4-stable
 * [new branch]      7-7-stable -> origin/7-7-stable
 * [new branch]      7-8-stable -> origin/7-8-stable
   5dbbec4..8e7e77e  master     -> origin/master
 * [new branch]      relative-sematic-versioning -> origin/relative-sematic-versioning
 * [new tag]         v7.2.3     -> v7.2.3
 * [new tag]         v7.3.3     -> v7.3.3
 * [new tag]         v7.4.5     -> v7.4.5
From https://gitlab.com/gitlab-org/gitlab-ce
 * [new tag]         v7.7.0     -> v7.7.0
 * [new tag]         v7.7.0.rc1 -> v7.7.0.rc1
 * [new tag]         v7.7.0.rc2 -> v7.7.0.rc2
 * [new tag]         v7.7.0.rc3 -> v7.7.0.rc3
 * [new tag]         v7.7.0.rc4 -> v7.7.0.rc4
 * [new tag]         v7.7.1     -> v7.7.1
 * [new tag]         v7.7.2     -> v7.7.2
 * [new tag]         v7.8.0     -> v7.8.0
 * [new tag]         v7.8.0.rc1 -> v7.8.0.rc1
 * [new tag]         v7.8.0.rc2 -> v7.8.0.rc2
 * [new tag]         v7.8.0.rc3 -> v7.8.0.rc3
 * [new tag]         v7.8.0.rc4 -> v7.8.0.rc4
 * [new tag]         v7.8.0.rc5 -> v7.8.0.rc5
 * [new tag]         v7.8.0.rc6 -> v7.8.0.rc6
 * [new tag]         v7.8.1     -> v7.8.1
CODE

업그레이드할 브랜치로 체크아웃. 현재 버전에서 7.8-stable 로 업그레이드할 경우 다음 명령어 실행

git checkout 7-8-stable
CODE

redis 설정 수정

Unix domain socket 을 사용하도록 수정

 

gitlab-shell 업그레이드 

cd /home/git/gitlab-shell
git fetch --all
git checkout v2.5.4
CODE

 

Install libs, migrations, etc.

bundle 업그레이드

cd /home/git/gitlab

# MySQL installations (note: the line below states '--without ... postgres')
bundle install --without development test postgres --deployment
 
# PostgreSQL installations (note: the line below states '--without ... mysql')
bundle install --without development test mysql --deployment
BASH

 

Run database migrations
bundle exec rake db:migrate RAILS_ENV=production
CODE

 

Enable internal issue IDs (introduced in GitLab 6.1)
bundle exec rake migrate_iids RAILS_ENV=production
CODE

 

assets 과 캐쉬 정리

bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
CODE

 

update init.d script

sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
CODE
# Close access to gitlab-satellites for others
sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
CODE

 

Upgrade Config file

현재 버전과 업그레이드할 버전의 설정 파일을 비교하여 차이점이 있으면 설정에 반영

git diff 6-7-stable:config/gitlab.yml.example 7-8-stable:config/gitlab.yml.example
CODE
  • gitlab/config/gitlab.yml
  • gitlab/config/unicorn.rb
  • gitlab-shell/config.yml

 

Copy rack attach middle ware config

cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
CODE

logrotate config

sudo  cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
CODE

 

 

MySQL 설정 변경

reaping_frequency 가 설정되어 있으면 DB connection이 끊기는 문제가 있으므로 database.yml 에서 reaping_frequency  관련 설정을 삭제


서버 시작

app 상태 확인

gitlab 환경 및 버전 확인

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

자세한 정보 확인

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

구동

완료 되었으면 gitlab 과 apache httpd 시작

service gitlab start
service httpd start
CODE

 

 

 

Ref