Gitlab 5.0のインストール (CentOS 6.5)
の後に行った作業です。
Requirements
- CentOS (Tested on 6.5)
- ruby (Tested on 1.9.3)
Upgrade
- gitlabサーバ停止
sudo service gitlab stop
- バックアップ
su - git
cd /home/git/gitlab
mkdir /home/git/gitlab/public/uploads
chown git:git /home/git/gitlab/public/uploads
bundle exec rake gitlab:backup:create RAILS_ENV=production
- 6.0のコードをチェックアウト
cd /home/git/gitlab
sudo -u git -H git fetch
sudo -u git -H git checkout 6-0-stable
- gitlab-shellをアップデート
cd /home/git/gitlab-shell
sudo -u git -H git fetch
sudo -u git -H git checkout v1.7.0
- 追加パッケージをインストール
sudo yum install -y python-docutils
# ubuntuの場合
# apt-get install python-docutils
- GemfileとGemfile.lockを書き換え
Gemfile:136
- gem "modernizr", "2.6.2"
+ gem "modernizr-rails", "2.7.1"
Gemfile.lock:286
- modernizr (2.6.2)
+ modernizr-rails (2.7.1)
Gemfile.lock:600
- modernizr (= 2.6.2)
+ modernizr-rails (= 2.7.1)
- 依存gemインストール。
su - git
cd /home/git/gitlab
bundle install --deployment --without development test postgres
- DBのマイグレーション
bundle exec rake db:migrate RAILS_ENV=production
- グループのマイグレーション
bundle exec rake migrate_groups RAILS_ENV=production
6.0よりグローバル名前空間が非互換になったのでグローバルのプロジェクトをグループ以下の名前空間に移動する
プロジェクト所有者が既に存在しない場合移動は失敗するので手動でどこかの名前空間以下に移動しておくとよさそう
bundle exec rake migrate_global_projects RAILS_ENV=production
- フィンガープリントをDB内のssh鍵に追加するマイグレーション(鍵の重複を防ぐため?)。とりあえずnoにしたけど動いた。
bundle exec rake migrate_keys RAILS_ENV=production
- noteのマイグレーション
bundle exec rake migrate_inline_notes RAILS_ENV=production
- gitlab-satellitesを生成しなおす。サーバ移動時などまだ生成されていない場合実行。
bundle exec rake gitlab:satellites:create RAILS_ENV=production
- redisのキャッシュを削除
bundle exec rake cache:clear RAILS_ENV=production
- その他
bundle exec rake assets:clean RAILS_ENV=production
bundle exec rake assets:precompile RAILS_ENV=production
- configファイルのアップデート
cd /home/git/gitlab/config
cp gitlab.yml{,.bak} # バックアップ
rm gitlab.yml.example
wget https://raw.github.com/gitlabhq/gitlabhq/6-0-stable/config/gitlab.yml.example
cp gitlab.yml.example gitlab.yml
vim gitlab.yml
16 gitlab:
17 ## Web server settings
18 host: gitlab.local.com //変更
19 port: 80
20 https: false //httpsが必要な場合は変更
- unicorn.rbの変更
cd /home/git/gitlab/config
cp unicorn.rb{,.bak}
rm unicorn.rb.example
wget https://raw.github.com/gitlabhq/gitlabhq/6-0-stable/config/unicorn.rb.example
cp unicorn.rb.example unicorn.rb
- 6.0用のinitスクリプトをDL
curl --output /etc/init.d/gitlab https://raw.githubusercontent.com/gitlabhq/gitlabhq/6-0-stable/lib/support/init.d/gitlab
chmod +x /etc/init.d/gitlab
- 起動
service gitlab start
- ログ確認
cd /home/git/gitlab/log
tail -f *.log
- gitlab環境の確認
bundle exec rake gitlab:env:info RAILS_ENV=production
- 動作確認
bundle exec rake gitlab:check RAILS_ENV=production