- アイコンがかわいくないので
- あとCIが使いたいので
ソース版でMySQLのCE 7.3.1から最終的にomnibusでPostgreSQLなCE 8.15.2 日本語化にします。
- 社内プロダクトでは元々別に立ってるGitリポジトリを使っているのだけど、インターン生やエンジニアが好き勝手に作っては捨て作っては捨てできるリポジトリとして別に立てました
- インターン生などGit初心者でも親しみやすいように日本語化パッチを適用します
- OSはUbuntu14.04
- 8.15.2なのは当時最新だったから
- ちなみに過去2.xから7.3.1に上げた時は新しく立て直した
ver.8.15.2から9.0.4にする続きも書きました。
手順
- 本番環境のデータをバックアップ
- PostgreSQLに変換
- 8系へアップデート
- omnibusへデータ移行
- 最新までアップデート
- 日本語パッチ適用
7系GitLabのイメージも過去あったような気がしたが今見当たらなかったので、rpmがある最低バージョンまでソース版を上げてそこからはapt-getでアップデートします
1. 本番環境からデータをバックアップしPostgreSQLに変換(code版 7.3.1 MySQL)
- 現行Gitlab(code版 7.3.1 MySQL)で以下の手順に従いPostgreSQLのバックアップデータを作成
2. ローカルにリストア(code版 7.3.1 PostgreSQL)
- ローカルにcode版 7.3.1 PostgreSQL環境のGitlabを構築
- https://github.com/gitlabhq/gitlabhq/blob/v7.3.1/doc/install/installation.md
- PostgreSQLの方で立てる
- ブランチ 7-3-stable ではバージョンが違ってリストアできないので気をつけること
- 以下の手順でリストア
3. 7.14化(code版 7.14 PostgreSQL)
- 以下の手順で7.14に上げる
- https://gitlab.com/gitlab-org/gitlab-ee/blob/master/doc/update/6.x-or-7.x-to-7.14.md
- PostgreSQLの方で立てる
- pgのgemが入らなければ手動で入れる
$ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: Ubuntu 14.04
Current User: git
Using RVM: no
Ruby Version: 2.1.6p336
Gem Version: 2.2.3
Bundler Version:1.13.7
Rake Version: 10.4.2
Sidekiq Version:3.3.0
GitLab information
Version: 7.14.3
Revision: 84bf092
Directory: /home/git/gitlab
DB Adapter: postgresql
URL: http://localhost:8080
HTTP Clone URL: http://localhost:8080/some-group/some-project.git
SSH Clone URL: git@localhost:some-group/some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 2.6.5
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
4. 8.0.5化(code版 8.0.5 PostgreSQL)
- 以下の手順で8.0.5に上げる
- https://github.com/gitlabhq/gitlabhq/blob/v8.13.3/doc/update/7.14-to-8.0.md
- PostgreSQLの方で立てる
- pgのgemが入らなければ手動で入れる
- バックアップを取る
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
$ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: Ubuntu 14.04
Current User: git
Using RVM: no
Ruby Version: 2.1.6p336
Gem Version: 2.2.3
Bundler Version:1.13.7
Rake Version: 10.4.2
Sidekiq Version:3.3.0
GitLab information
Version: 8.0.5
Revision: 2c03667
Directory: /home/git/gitlab
DB Adapter: postgresql
URL: http://localhost:8080
HTTP Clone URL: http://localhost:8080/some-group/some-project.git
SSH Clone URL: git@localhost:some-group/some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 2.6.5
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
5. omubus化する(omunibus版 8.0.8 PostgreSQL)
- omunibusの環境を用意(8.0.5)
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce=8.0.5-ce.0
なんかあったらいろいろいじったりreconfigしたり、removeしたりinstallする
sudo gitlab-ctl reconfigure
sudo apt-get remove gitlab-ce=8.0.5-ce.0
sudo apt-get install gitlab-ce=8.0.5-ce.0
- ソース版のバックアップデータをリストアする
6. 8.13.3まで上げる(omunibus版 8.13.3 PostgreSQL)
sudo chmod 2770 /var/opt/gitlab/git-data/repositories
sudo apt-get install gitlab-ce=8.13.3-ce.0
なんか動かない時
apt-get install libicu-dev libxml2-dev libxslt-dev
gem install charlock_holmes --version '0.6.9'
sudo apt-get install cmake
$ sudo gitlab-rake gitlab:env:info
System information
System: Ubuntu 14.04
Current User: git
Using RVM: no
Ruby Version: 2.3.1p112
Gem Version: 2.6.6
Bundler Version:1.13.5
Rake Version: 10.5.0
Sidekiq Version:4.2.1
GitLab information
Version: 8.13.3
Revision: 8d79ab3
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: http://xxxxxxxxxxx
HTTP Clone URL: http://xxxxxxxxxxx/some-group/some-project.git
SSH Clone URL: git@xxxxxxxxxxx:some-group/some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 3.6.6
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
7. 8.15.2まで上げる(omunibus版 8.15.2 PostgreSQL)
sudo apt-get install gitlab-ce=8.15.2-ce.0
$ sudo gitlab-rake gitlab:env:info
System information
System: Ubuntu 14.04
Current User: git
Using RVM: no
Ruby Version: 2.3.3p222
Gem Version: 2.6.6
Bundler Version:1.13.7
Rake Version: 10.5.0
Sidekiq Version:4.2.7
GitLab information
Version: 8.15.2
Revision: 790035f
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: http://xxxxxxxxxxx
HTTP Clone URL: http://xxxxxxxxxxx/some-group/some-project.git
SSH Clone URL: git@xxxxxxxxxxx:some-group/some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 4.1.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
8. 日本語化パッチ
see https://github.com/ksoichiro/gitlab-i18n-patch
wget https://raw.githubusercontent.com/ksoichiro/gitlab-i18n-patch/master/patches/v8.15.2/app_ja.patch
cd /opt/gitlab/embedded/service/gitlab-rails
sudo patch -p1 < ~/app_ja.patch
sudo gitlab-ctl reconfigure
設定
- omnibus版にしたことにより各種の設定が初期化されてるので、変更する
- メール
- バックアップ * バックアップは公式ドキュメントに書かれているバックアップ手順をcronに登録している * そのうち他のマシンにデータ転送するやつを書きたい
- Container Registry
- CI
- など