GitLab 8.9.0.rc6 > 9.0.2 にソースインストールでアップデート

アフィリエイト広告を利用しています

このページの内容が役に立ったら X (旧twitter) でフォローして頂けると励みになります
挨拶や報告は無しで大丈夫です

2017年4月5日(約7年前)の記事となっております。色々ご注意ください。

GitLab 8.9.0.rc6 から GitLab 9.0.2 に更新

停止する

service gitlab stop

rubyのバージョンアップ

GitLab 9 からruby2はサポートされなくなった

cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/ruby-2.4.1.tar.gz
tar zxvf ruby-2.4.1.tar.gz
cd ruby-2.4.1
./configure --disable-install-doc
make
make test
make install
ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

bundlerのインストール

gem install bundler
bundle -v
Bundler version 1.14.6

Passengerのインストール

gem install passenger --no-rdoc --no-ri

PassengerのApache用モジュールのインストール

passenger-install-apache2-module

完了後の内容を httpd.conf に記述 (下記は環境により変わる)

LoadModule passenger_module /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.2/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
    PassengerRoot /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.2
    PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>

もう一度確認するときは、

passenger-install-apache2-module --snippet

Railsのインストール

gem install rails
rails -v
Rails 5.0.2
gem install redis

Gitを最新バージョンへ

アップデート前のバージョン

git --version
git version 2.9.0

Gitをアップデート

cd /tmp
wget https://www.kernel.org/pub/software/scm/git/git-2.9.3.tar.gz 
tar zxvf git-2.9.3.tar.gz
cd git-2.9.3
./configure --prefix=/usr/local
make prefix=/usr/local all
make prefix=/usr/local install

更新後のバージョン

git --version
git version 2.9.3

設定を確認

git config --list

GitLabのアップデート

su - git
cd /home/git

更新前のバージョン確認

cat VERSION
8.9.0-rc6

gitlabの更新

cd /home/git/
cd gitlab/
git remote show origin
* remote origin
  Fetch URL: https://github.com/gitlabhq/gitlabhq.git
  Push  URL: https://github.com/gitlabhq/gitlabhq.git
  HEAD branch: master
  Remote branches:
    3-1-stable                                                                 tracked
    4-0-stable                                                                 tracked
    4-1-stable                                                                 tracked
    4-2-stable                                                                 tracked
    5-0-stable                                                                 tracked
    5-1-stable                                                                 tracked
    5-2-stable                                                                 tracked
    5-3-stable                                                                 tracked
    5-4-stable                                                                 tracked
    6-0-stable                                                                 tracked
    6-1-stable                                                                 tracked
    6-2-stable                                                                 tracked
    6-3-stable                                                                 tracked
    6-4-stable                                                                 tracked
    6-5-stable                                                                 tracked
    6-6-stable                                                                 tracked
    6-7-stable                                                                 tracked
    6-8-stable                                                                 tracked
    6-9-stable                                                                 tracked
    7-0-stable                                                                 tracked
    7-1-stable                                                                 tracked
    7-10-stable                                                                tracked
    7-11-stable                                                                tracked
    7-12-stable                                                                tracked
    7-13-stable                                                                tracked
    7-14-stable                                                                tracked
    7-2-stable                                                                 tracked
    7-3-stable                                                                 tracked
    7-4-stable                                                                 tracked
    7-5-stable                                                                 tracked
    7-6-stable                                                                 tracked
    7-7-stable                                                                 tracked
    7-8-stable                                                                 tracked
    7-9-stable                                                                 tracked
    8-0-stable                                                                 tracked
    8-1-stable                                                                 tracked
    8-10-stable                                                                new (next fetch will store in remotes/origin)
    8-11-stable                                                                new (next fetch will store in remotes/origin)
    8-12-stable                                                                new (next fetch will store in remotes/origin)
    8-13-stable                                                                new (next fetch will store in remotes/origin)
    8-14-stable                                                                new (next fetch will store in remotes/origin)
    8-15-stable                                                                new (next fetch will store in remotes/origin)
    8-16-stable                                                                new (next fetch will store in remotes/origin)
    8-17-stable                                                                new (next fetch will store in remotes/origin)
    8-2-stable                                                                 tracked
    8-3-stable                                                                 tracked
    8-4-stable                                                                 tracked
    8-5-stable                                                                 tracked
    8-6-stable                                                                 tracked
    8-7-stable                                                                 tracked
    8-8-stable                                                                 tracked
    8-9-stable                                                                 tracked
    9-0-stable                                                                 new (next fetch will store in remotes/origin)
    master                                                                     tracked
    refs/remotes/origin/add-prompts-to-tasks-a1814a50                          stale (use 'git remote prune' to remove)
    refs/remotes/origin/api_merge_request-4281de36                             stale (use 'git remote prune' to remove)
    refs/remotes/origin/ce_upstream                                            stale (use 'git remote prune' to remove)
    refs/remotes/origin/contributing-file-46bbeabc                             stale (use 'git remote prune' to remove)
    refs/remotes/origin/contributing_guide-348e9a74                            stale (use 'git remote prune' to remove)
    refs/remotes/origin/cucumber-e15a2b96                                      stale (use 'git remote prune' to remove)
    refs/remotes/origin/dashboard_v2-18e4f154                                  stale (use 'git remote prune' to remove)
    refs/remotes/origin/docker-image                                           stale (use 'git remote prune' to remove)
    refs/remotes/origin/docker-updates                                         stale (use 'git remote prune' to remove)
    refs/remotes/origin/dont-allow-question-mark-in-project-name-8c4b0f98      stale (use 'git remote prune' to remove)
    refs/remotes/origin/fast_automerge-e5f8397f                                stale (use 'git remote prune' to remove)
    refs/remotes/origin/feature/internal_projects-319d2b78                     stale (use 'git remote prune' to remove)
    refs/remotes/origin/feature/poltergeist-ba25b2dc                           stale (use 'git remote prune' to remove)
    refs/remotes/origin/features/projects_page-d24fd32a                        stale (use 'git remote prune' to remove)
    refs/remotes/origin/features/teams-d839f6c5                                stale (use 'git remote prune' to remove)
    refs/remotes/origin/fix-group-remove                                       stale (use 'git remote prune' to remove)
    refs/remotes/origin/fix-group-remove-55715735                              stale (use 'git remote prune' to remove)
    refs/remotes/origin/fix-rake-test-ci-18ef9bef                              stale (use 'git remote prune' to remove)
    refs/remotes/origin/fix_bug_wiki-883d138f                                  stale (use 'git remote prune' to remove)
    refs/remotes/origin/fix_bug_wiki-db469ea3                                  stale (use 'git remote prune' to remove)
    refs/remotes/origin/fix_gfm_auto_complete-77d63289                         stale (use 'git remote prune' to remove)
    refs/remotes/origin/fix_postgres_notes-69c8231b                            stale (use 'git remote prune' to remove)
    refs/remotes/origin/fix_service_gitlab_restart-2b9d48cc                    stale (use 'git remote prune' to remove)
    refs/remotes/origin/green-travis-c3d56441                                  stale (use 'git remote prune' to remove)
    refs/remotes/origin/hook_on_mr_fix-e226551e                                stale (use 'git remote prune' to remove)
    refs/remotes/origin/i-should-no-create-branches-on-github-942cf323         stale (use 'git remote prune' to remove)
    refs/remotes/origin/improve-coveralls-522d754d                             stale (use 'git remote prune' to remove)
    refs/remotes/origin/inline_diff-e3fed8aa                                   stale (use 'git remote prune' to remove)
    refs/remotes/origin/jvanbaarsen-patch-1-823f8c1a                           stale (use 'git remote prune' to remove)
    refs/remotes/origin/jvanbaarsen-patch-1-920a2d97                           stale (use 'git remote prune' to remove)
    refs/remotes/origin/link-to-dot-com-2135da14                               stale (use 'git remote prune' to remove)
    refs/remotes/origin/link_to_spinach_in_readm-895b16ea                      stale (use 'git remote prune' to remove)
    refs/remotes/origin/merge_button-3a6694b5                                  stale (use 'git remote prune' to remove)
    refs/remotes/origin/models_refactoring-0a70aca3                            stale (use 'git remote prune' to remove)
    refs/remotes/origin/namespaces-1d7fdf45                                    stale (use 'git remote prune' to remove)
    refs/remotes/origin/plusone_ui-cbc56a96                                    stale (use 'git remote prune' to remove)
    refs/remotes/origin/refactor_scss-9b57bf78                                 stale (use 'git remote prune' to remove)
    refs/remotes/origin/remove_link_to_function-d5b41831                       stale (use 'git remote prune' to remove)
    refs/remotes/origin/remove_roles-da03a5c7                                  stale (use 'git remote prune' to remove)
    refs/remotes/origin/remove_sorce_branch_after_merge-2d68e7f4               stale (use 'git remote prune' to remove)
    refs/remotes/origin/reproduce-500-for-3092                                 stale (use 'git remote prune' to remove)
    refs/remotes/origin/revert-7252-master-976eb7a9                            stale (use 'git remote prune' to remove)
    refs/remotes/origin/revert-8800-email-settings-317ed1fa                    stale (use 'git remote prune' to remove)
    refs/remotes/origin/revert-9368-patch-1-25a870a6                           stale (use 'git remote prune' to remove)
    refs/remotes/origin/revert-9528-Fixed_alignment_issue-50696ce1             stale (use 'git remote prune' to remove)
    refs/remotes/origin/revert-9758-fix/api-helpers-bad-autoload-name          stale (use 'git remote prune' to remove)
    refs/remotes/origin/revert-9758-fix/api-helpers-bad-autoload-name-49e48bd0 stale (use 'git remote prune' to remove)
    refs/remotes/origin/stable-bbdb2c3f                                        stale (use 'git remote prune' to remove)
    refs/remotes/origin/travis/cmake-4e241fc4                                  stale (use 'git remote prune' to remove)
    refs/remotes/origin/ubuntu_script-7c933079                                 stale (use 'git remote prune' to remove)
    refs/remotes/origin/ui/tiny_nav-55f776f0                                   stale (use 'git remote prune' to remove)
    refs/remotes/origin/use-symlink-cc3892b1                                   stale (use 'git remote prune' to remove)
    refs/remotes/origin/v4.0-api-fixes-eaa99478                                stale (use 'git remote prune' to remove)
  Local branches configured for 'git pull':
    6-8-stable merges with remote 6-8-stable
    7-4-stable merges with remote 7-4-stable
    7-9-stable merges with remote 7-9-stable
    8-3-stable merges with remote 8-3-stable
    8-5-stable merges with remote 8-5-stable
    8-9-stable merges with remote 8-9-stable
    master     merges with remote master
  Local refs configured for 'git push':
# フェッチする
git fetch

# ブランチの一覧
git branch

# タグの一覧
git tag -l

# スタッシュ
git stash save

# スタッシュを作る
git stash save "20170405-version-up"

# スタッシュの内容確認
git stash list -p

最新のバージョンへ

git checkout 9-0-stable
cat VERSION
9.0.2

gitlab-shell

更新前のバージョン

cd /home/git
cd gitlab-shell/
cat VERSION
3.0.0

ブランチの確認

cd /home/git/
cd gitlab-shell/
git remote show origin
git fetch
remote: Counting objects: 694, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 694 (delta 162), reused 170 (delta 162), pack-reused 524
Receiving objects: 100% (694/694), 139.12 KiB | 0 bytes/s, done.
Resolving deltas: 100% (459/459), completed with 41 local objects.
From https://github.com/gitlabhq/gitlab-shell
 * [new branch]      3-6-stable -> origin/3-6-stable
   c6f1495..199e2d6  master     -> origin/master
 * [new tag]         v3.6.7     -> v3.6.7
 * [new tag]         v5.0.0     -> v5.0.0
 * [new tag]         v3.1.0     -> v3.1.0
 * [new tag]         v3.2.0     -> v3.2.0
 * [new tag]         v3.2.1     -> v3.2.1
 * [new tag]         v3.3.0     -> v3.3.0
 * [new tag]         v3.3.1     -> v3.3.1
 * [new tag]         v3.3.2     -> v3.3.2
 * [new tag]         v3.3.3     -> v3.3.3
 * [new tag]         v3.4.0     -> v3.4.0
 * [new tag]         v3.5.0     -> v3.5.0
 * [new tag]         v3.6.0     -> v3.6.0
 * [new tag]         v3.6.1     -> v3.6.1
 * [new tag]         v3.6.2     -> v3.6.2
 * [new tag]         v3.6.3     -> v3.6.3
 * [new tag]         v3.6.4     -> v3.6.4
 * [new tag]         v3.6.5     -> v3.6.5
 * [new tag]         v3.6.6     -> v3.6.6
 * [new tag]         v4.0.0     -> v4.0.0
 * [new tag]         v4.0.1     -> v4.0.1
 * [new tag]         v4.0.2     -> v4.0.2
 * [new tag]         v4.0.3     -> v4.0.3
 * [new tag]         v4.1.0     -> v4.1.0
 * [new tag]         v4.1.1     -> v4.1.1

ブランチの一覧

git branch

タグの一覧

git tag -l

タグを指定して新しいブランチを作る

git checkout -b b5.0.0 refs/tags/v5.0.0

ここまでの確認

cd /home/git/
cd gitlab/
cat VERSION
9.0.2
cd /home/git
cd gitlab-shell/
cat VERSION
5.0.0

マイグレーション

cd /home/git/gitlab
bundle install --without development test postgres --deployment
rails generate mousetrap:install
bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake migrate_iids RAILS_ENV=production
bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
bundle exec rake cache:clear RAILS_ENV=production

設定変更

cd /home/git/
cd gitlab/config

以前の設定をリネーム

mv gitlab.yml gitlab.yml.backup.8.9.0-rc6

サンプルを削除

rm gitlab.yml.example

新しいサンプルを取得

wget https://gitlab.com/gitlab-org/gitlab-ce/raw/9-0-stable/config/gitlab.yml.example
cp gitlab.yml.example gitlab.yml

設定変更(以前のものとdiffしながら)

vi gitlab.yml
  gitlab:
    host: git.aulta.jp
    port: 443
    https: true
    email_from: gitlab@receiver.aulta.net
    email_display_name: GitLab
    email_reply_to: noreply@receiver.aulta.net
  backup:
    path: "/backup/gitlab"
    keep_time: 7200
  gitlab_shell:
    ssh_port: 22230
  git:
    bin_path: /usr/local/bin/git

設定変更

cd /home/git/gitlab/config
mv unicorn.rb unicorn.rb.backup.20170405
rm unicorn.rb.example
wget https://gitlab.com/gitlab-org/gitlab-ce/raw/9-0-stable/config/unicorn.rb.example
cp unicorn.rb.example unicorn.rb
vi unicorn.rb

起動スクリプトの更新

rm /etc/init.d/gitlab
cd /home/git/gitlab
cp lib/support/init.d/gitlab /etc/init.d/gitlab
cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
chmod +x /etc/init.d/gitlab
vi /etc/init.d/gitlab

開始する

service gitlab start

500エラーになっても、1分程度待てば回復する

エラーになった場合

https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update

ログの確認

tail -n 500 /home/git/gitlab/log/production.log

導入サポート・運用サポート

ということで宣伝です。

弊社ではPHP・MySQL・javascriptを使ったWebサイトを得意としています。
これらは2005年頃から触り続けてきていることもあり得意中の得意です。

Git については2012年頃から、GitLab は2014年頃 GitLab 6.8 のときから使い続けています。
ちなみに Github は取引先の都合で使用することはもちろんあります。

1日で完了する簡単なことから、半年・1年規模のものまで幅広く承っています。
特にプログラム開発が必要になるようなカスタマイズは遠慮なくご相談ください。

フロントの見た目に関わるところはデザイン会社が担当、裏方の技術部分を弊社が担当するケースもあり柔軟に対応することができます。

メールやSNSなどのメッセージで簡単に連絡いただいたあとで、電話していただけると確実です。(お問い合わせ