天天看點

GitLab CE伺服器安裝配置備份恢複更新注意項總結

GitLab CE安裝

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

<code>https:</code><code>//about</code><code>.gitlab.com</code><code>/installation/</code>

直接下載下傳源包位址

<a href="https://about.gitlab.com/downloads/archives/" target="_blank">https://about.gitlab.com/downloads/archives/</a>

<code>安裝</code>

<code>#yum install curl openssh-server openssh-clients postfix cronie</code>

<code>#service postfix start</code>

<code>#chkconfig postfix on</code>

<code>#lokkit -s http -s ssh</code>

<code>#rpm -i gitlab-ce-XXX.rpm</code>

GitLab加載配置與啟動

<code>#gitlab-ctl reconfigure</code>

<code>#gitlab-ctl start/restart</code>

GitLab日志檢視

<code>#gitlab-ctl tail nginx </code>

<code>#gitlab-ctl tail unicorn</code>

GitLab CE 備份與恢複

備份

<code>gitlab-rake gitlab:backup:create</code>

<code>可設定自動備份任務</code>

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

更改預設路徑,可以在 <code>/etc/gitlab/gitlab.rb</code> 檔案的 <code>gitlab_rails['backup_path']</code> 項中進行設定,預設為 <code>/var/opt/gitlab/backups</code>。

恢複

<code># 停止需要連接配接資料庫的服務</code>

<code>#gitlab-ctl stop unicorn</code>

<code>#gitlab-ctl stop sidekiq</code>

<code># 恢複備份的資料,重寫資料庫内容</code>

<code># GitLab 8.15 版本以前所用的時間戳格式為 EPOCH (1393513186)</code>

<code>#gitlab-rake gitlab:backup:restore BACKUP=1459620009</code>

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

<code># gitlab-rake gitlab:backup:restore BACKUP=1491415349_2017_04_06</code>

<code># 啟動 GitLabsudo gitlab-ctl start</code>

<code># 檢查 GitLab 是否正常運作</code>

<code>#gitlab-rake gitlab:check SANITIZE=true</code>

GitLab CE遷移與更新

遷移可參考備份與恢複,需要注意的是:版本号一定要一緻

更新

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

GitLab CE 使用小節

1、項目位址為localhost

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

<code>  </code><code>## GitLab settings</code>

<code>  </code><code>gitlab:</code>

<code>    </code><code>## Web server settings (note: host is the FQDN, do not include http://)</code>

<code>    </code><code>host: localhost</code>

<code>    </code><code>port: 80</code>

<code>    </code><code>https: </code><code>false</code>

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

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

此類錯誤多出現在git-data挂載軟連結導緻

如我的挂載 /var/opt/gitlab -&gt; /data/gitlab, 修改參照以下

<code># /etc/gitlab/gitlab.rb </code>

<code>......</code>

<code> </code><code>git_data_dirs({ </code><code>"default"</code> <code>=&gt; { </code><code>"path"</code> <code>=&gt; </code><code>"&lt;/data/gitlab/git-data&gt;"</code><code>, </code><code>'gitaly_address'</code> <code>=&gt; </code><code>'unix:/var/opt/gitlab/gitaly/gitaly.socket'</code> <code>} })</code>

本文轉自 jackjiaxiong 51CTO部落格,原文連結:http://blog.51cto.com/xiangcun168/1951028