1. 程式人生 > >GitLab CE服務器安裝配置備份恢復升級註意項總結

GitLab CE服務器安裝配置備份恢復升級註意項總結

gitlab ce服務器

GitLab CE安裝

安裝比較簡單,rpm直接在不同平臺安裝

https://about.gitlab.com/installation/

直接下載源包地址

https://about.gitlab.com/downloads/archives/


安裝
#yum install curl openssh-server openssh-clients postfix cronie
#service postfix start
#chkconfig postfix on
#lokkit -s http -s ssh
#rpm -i gitlab-ce-XXX.rpm

GitLab加載配置與啟動

#gitlab-ctl reconfigure
#gitlab-ctl start/restart

GitLab日誌查看

#gitlab-ctl tail nginx 
#gitlab-ctl tail unicorn


GitLab CE 備份與恢復

備份

gitlab-rake gitlab:backup:create

可設置自動備份任務

0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:creat

更改默認路徑,可以在 /etc/gitlab/gitlab.rb 文件的 gitlab_rails[‘backup_path‘] 項中進行設置,默認為 /var/opt/gitlab/backups

恢復

# 停止需要連接數據庫的服務
#gitlab-ctl stop unicorn
#gitlab-ctl stop sidekiq

# 恢復備份的數據,重寫數據庫內容
# GitLab 8.15 版本以前所用的時間戳格式為 EPOCH (1393513186)

#gitlab-rake gitlab:backup:restore BACKUP=1459620009

# 或# GitLab 8.15 版本以後所用的時間戳格式為 EPOCH_YYYY_MM_DD (1491415349_2017_04_06)

# gitlab-rake gitlab:backup:restore BACKUP=1491415349_2017_04_06

# 啟動 GitLabsudo gitlab-ctl start

# 檢查 GitLab 是否正常運行

#gitlab-rake gitlab:check SANITIZE=true


GitLab CE遷移與升級

遷移可參考備份與恢復,需要註意的是:版本號一定要一致

升級

跨版本升級在這裏不過多介紹,如大版本9,升級過程下載相關安裝包進行安裝,自動會完成升級


GitLab CE 使用小節


1、項目地址為localhost

#vi /var/opt/gitlab/gitlab-rails/etc/gitlab.yml

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: localhost
    port: 80
    https: false


2、merge 、chekout 出現以下錯誤:

GitLab: The project you were looking for could not be found.

此類錯誤多出現在git-data掛載軟鏈接導致

如我的掛載 /var/opt/gitlab -> /data/gitlab, 修改參照以下

# /etc/gitlab/gitlab.rb 
......
 git_data_dirs({ "default" => { "path" => "</data/gitlab/git-data>", ‘gitaly_address‘ => ‘unix:/var/opt/gitlab/gitaly/gitaly.socket‘ } })
......












本文出自 “xiangcun168” 博客,請務必保留此出處http://xiangcun168.blog.51cto.com/4788340/1951028

GitLab CE服務器安裝配置備份恢復升級註意項總結