GitLab 7.9.4 > 8.3.0.rc2 にソースインストールでアップデート

2015年12月18日(約9年前)の記事となっております。色々ご注意ください。

GitLab 7.9.4 から GitLab 8.3.0.rc2 に更新

停止する

service gitlab stop

Gitを最新バージョンへ

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

git --version
git version 2.3.6

Gitをアップデート

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

更新後のバージョン

git --version
git version 2.6.4

設定を確認

git config --list

GitLabのアップデート

su - git
cd /home/git

バージョン確認

cat VERSION
7.9.4

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                                   new (next fetch will store in remotes/origin)
    7-12-stable                                   new (next fetch will store in remotes/origin)
    7-13-stable                                   new (next fetch will store in remotes/origin)
    7-14-stable                                   new (next fetch will store in remotes/origin)
    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                                    new (next fetch will store in remotes/origin)
    8-1-stable                                    new (next fetch will store in remotes/origin)
    8-2-stable                                    new (next fetch will store in remotes/origin)
    8-3-stable                                    new (next fetch will store in remotes/origin)
    ce_upstream                                   new (next fetch will store in remotes/origin)
    docker-image                                  new (next fetch will store in remotes/origin)
    docker-updates                                new (next fetch will store in remotes/origin)
    fix-group-remove                              new (next fetch will store in remotes/origin)
    master                                        tracked
    reproduce-500-for-3092                        new (next fetch will store in remotes/origin)
    revert-9758-fix/api-helpers-bad-autoload-name new (next fetch will store in remotes/origin)
  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
    master     merges with remote master
  Local refs configured for 'git push':
    6-8-stable pushes to 6-8-stable (up to date)
    7-4-stable pushes to 7-4-stable (local out of date)
    7-9-stable pushes to 7-9-stable (up to date)
    master     pushes to master     (local out of date)
# フェッチする
git fetch

# ブランチの一覧
git branch

# タグの一覧
git tag -l

# スタッシュ
git stash save

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

最新のバージョンへ

git checkout 8-3-stable
cat VERSION
8.3.0.rc2

gitlab-shell

更新前のバージョン

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

ブランチの確認

cd /home/git/
cd gitlab-shell/
git remote show origin
* remote origin
  Fetch URL: https://github.com/gitlabhq/gitlab-shell.git
  Push  URL: https://github.com/gitlabhq/gitlab-shell.git
  HEAD branch: master
  Remote branches:
    add_local_update_hook tracked
    master                tracked
    version-1-9           tracked
  Local branches configured for 'git pull':
    master      merges with remote master
    version-1-9 merges with remote version-1-9
  Local refs configured for 'git push':
    master      pushes to master      (local out of date)
    version-1-9 pushes to version-1-9 (up to date)
git fetch
remote: Counting objects: 240, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 240 (delta 57), reused 54 (delta 49), pack-reused 166
Receiving objects: 100% (240/240), 53.74 KiB | 0 bytes/s, done.
Resolving deltas: 100% (149/149), completed with 17 local objects.
From https://github.com/gitlabhq/gitlab-shell
   4d30c0c..962f7a3  master     -> origin/master
 * [new tag]         v2.6.3     -> v2.6.3
 * [new tag]         v2.6.4     -> v2.6.4
 * [new tag]         v2.6.5     -> v2.6.5
 * [new tag]         v2.6.6     -> v2.6.6
 * [new tag]         v2.6.7     -> v2.6.7
 * [new tag]         v2.6.8     -> v2.6.8

ブランチの一覧

git branch

タグの一覧

git tag -l

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

git checkout -b b2.6.8 refs/tags/v2.6.8

ここまでの確認

cd /home/git/
cd gitlab/
cat VERSION
8.3.0.rc2
cd /home/git
cd gitlab-shell/
cat VERSION
2.6.8

マイグレーション

cd /home/git/gitlab
bundle install --without development test postgres --deployment
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.7.9.4

サンプルを削除

rm gitlab.yml.example

新しいサンプルを取得

wget https://gitlab.com/gitlab-org/gitlab-ce/raw/8-3-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: 3600
  gitlab_shell:
    ssh_port: 22230
  git:
    bin_path: /usr/local/bin/git

設定変更

cd /home/git/gitlab/config
mv unicorn.rb unicorn.rb.backup.20151218
rm unicorn.rb.example
wget https://gitlab.com/gitlab-org/gitlab-ce/raw/8-3-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分程度待てば回復する

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

ということで宣伝です。

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

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

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

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

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