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

2016年2月24日(約8年前)の記事となっております。色々ご注意ください。

GitLab 8.3.0.rc2 から GitLab 8.5.0.rc4 に更新

停止する

service gitlab stop

Gitを最新バージョンへ

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

git --version
git version 2.6.4

Gitをアップデート

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

更新後のバージョン

git --version
git version 2.7.2

設定を確認

git config --list

GitLabのアップデート

su - git
cd /home/git

更新前のバージョン確認

cat VERSION
8.3.0.rc2

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 save "20160224-version-up"

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

最新のバージョンへ

git checkout 8-3-stable
cat VERSION
8.5.0

gitlab-shell

更新前のバージョン

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

ブランチの確認

cd /home/git/
cd gitlab-shell/
git remote show origin
git fetch
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 24 (delta 14), reused 15 (delta 14), pack-reused 8
Unpacking objects: 100% (24/24), done.
From https://github.com/gitlabhq/gitlab-shell
   962f7a3..f1ac6cb  master     -> origin/master
 * [new tag]         v2.6.9     -> v2.6.9
 * [new tag]         v2.6.10    -> v2.6.10

ブランチの一覧

git branch

タグの一覧

git tag -l

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

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

ここまでの確認

cd /home/git/
cd gitlab/
cat VERSION
8.5.0
cd /home/git
cd gitlab-shell/
cat VERSION
2.6.10

マイグレーション

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.8.3.0.rc2

サンプルを削除

rm gitlab.yml.example

新しいサンプルを取得

wget https://gitlab.com/gitlab-org/gitlab-ce/raw/8-5-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.20160224
rm unicorn.rb.example
wget https://gitlab.com/gitlab-org/gitlab-ce/raw/8-5-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分程度待てば回復する

エラーになった場合

GitLab 8.2からGo言語とgitlab-workhorseが必要になっている

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/8.1-to-8.2.md

Goをインストール

https://sites.google.com/a/aulta.jp/doc/01-sakuravps-centos/111-go-lang

gitlab-workhorseをインストール

su - git
cd /home/git
git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
cd gitlab-workhorse
git tag -l
git checkout 0.6.5
cat VERSION
make

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

ということで宣伝です。

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

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

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

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

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