gitlabの構築

CentOSでgitlabの構築をします

サーバの用意

vagrantcentos環境を作ります

$ vim Vagrantfile
VAGRANTFILE_API_VERSION = "2"
  
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define :"cent1" do |dev|
    dev.vm.box               = "chef/centos-6.5"
    dev.vm.hostname          = "192.168.1.150"
    dev.vm.network :public_network, ip: "192.168.1.150"
  end
end
 
$ vagrant box add chef/centos-6.5
$ vagrant up
$ vagrant ssh

gitlabのインストール

Ubuntu,Debian,CentOSのパッケージがあります
https://www.gitlab.com/downloads/ 

[vagrant@192 ~]$ wget https://downloads-packages.s3.amazonaws.com/centos-6.5/gitlab-6.8.1_omnibus.4-1.el6.x86_64.rpm
[vagrant@192 ~]$ sudo rpm -ivh gitlab-6.8.1_omnibus.4-1.el6.x86_64.rpm
[vagrant@192 ~]$ sudo gitlab-ctl reconfigure

確認

ブラウザから接続

http://192.168.1.150/

アカウントとパスはこれでログインできます

User: admin@local.host またはroot
Pass: 5iveL!fe

f:id:katashiyo515:20140510132325j:plain

その他

ポートの変更
# 設定ファイルの作成
$ sudo vi /etc/gitlab/gitlab.rb
external_url "http://localhost:8081"
# 設定簿確認
$ sudo gitlab-ctl show-config
# 再設定
$ sudo gitlab-ctl reconfigure
# ブラウザから確認
http://localhost:8081

※reconfigureを実行直後は以下のエラーが出ますが、しばらく待つと接続できるようになります。

502
GitLab is not responding.
リスタート
$ sudo /opt/gitlab/bin/gitlab-ctl restart
ok: run: nginx: (pid 8192) 1s
ok: run: postgresql: (pid 8198) 0s
ok: run: redis: (pid 8207) 0s
ok: run: sidekiq: (pid 8213) 0s
ok: run: unicorn: (pid 8218) 0s
nginxとpostgre使ってます
バックアップ
# バックアップ
$ sudo gitlab-rake gitlab:backup:create
  
# バックアップファイル
$ sudo ls /var/opt/gitlab/backups/
1399691748_gitlab_backup.tar
 
# リストア
sudo gitlab-rake gitlab:backup:restore

参考URL

GitLab | GitLab Community Edition

GitLab.org / GitLab Community Edition | GitLab