Gitlab使用
一、常用命令
gitlab-ctl status:查看gitlab組件狀態
gitlab-ctl start:啟動全部服務
gitlab-ctl restart:重啟全部服務
gitlab-ctl stop:停止全部服務
gitlab-ctl reconfigure:使配置文件生效(一般修改完主配置文件/etc/gitlab/gitlab.rb,需要執行此命令)
gitlab-ctl show-config :驗證配置文件
gitlab-ctl uninstall:刪除gitlab(保留數據)
gitlab-ctl cleanse:刪除所有數據,從新開始
gitlab-ctl tail <service name>查看服務的日志
二、常用的組件
nginx:靜態Web服務器
gitlab-shell:用於處理Git命令和修改authorized keys列表,我們的gitlab是以Git做為最層的,你操作實際上最后就是調用gitlab-shell命令進行處理。
gitlab-workhorse:輕量級的反向代理服務器
logrotate:日志文件管理工具
postgresql:數據庫
redis:緩存數據庫
sidekiq:用於在后台執行隊列任務(異步執行)
unicorn:GitLab Rails應用是托管在這個服務器上面的
三、基礎目錄:
/var/opt/gitlab/git-data/repositories:庫默認存儲目錄
/opt/gitlab: 應用代碼和相應的依賴程序
/var/opt/gitlab:gitlab-ctl reconfigure命令編譯后的應用數據和配置文件,不需要人為修改配置
/etc/gitlab: 配置文件目錄
/var/log/gitlab:此目錄下存放了gitlab各個組件產生的日志
/var/opt/gitlab/backups/:備份文件生成的目錄
四、Gitlab基本配置
1、關閉注冊
由於我們Gitlab系統是私有倉庫,一般用戶都是由管理員創建和分派的,所以我們需要關閉注冊。
2、create group
group(項目)下面可以創建subgroup,創建project(項目下的具體工程),添加user。group就是把相關的project或者user放在一起,進行統一的權限管理。
我們創建一公司網站的項目web-site,項目下面有兩個工程,一個是前台pro-frontend, 一個是后台管理pro-backend。
visibility Level:選擇誰可以訪問該組:我們默認選擇private,因為我建設的是私有倉庫
Private:只有授權的用戶才可以看到
Internal:只要是登錄gitlab的用戶就可以看到
Public:只要可以訪問gitlab web頁面的人就可以看到
點擊group名稱進去,我們在web-site下面創建project:
此時我們已經創建了一個frontend的project,是一個空的工程。我們暫時先不管其他的,使用同樣的方法創建backend project。
subgroup創建同group同樣,在此我們不再詳細說明。
3、create user
我們主要創建這兩類用戶,一類是項目經理PM(用來管理項目),另一類是開發DEV(項目功能的實現)。
注:1、郵件不能重復;
2、新建用戶不能設置密碼,需要我們在添加完用戶名,編輯用戶並為用戶設置一個初始密碼,用戶第一次登錄時系統要求用戶更改密碼;
3、去掉勾選,普通用戶我們一般不需要create group。
重復以上步驟,我們創建dev,dev1,dev2用戶。
4、grant user
創建完user后,我們需要將user添加到組或者project上,並選擇不同的role。
首先我們add user to group
我們將選擇dev1用戶,角色選擇Developer,過期日期不設置為永遠不過期。
用同樣的方法添加dev2,pm(角色Master),添加到group.
將用戶添加到組后,我們發現組里的每個project下自動添加了我們剛才添加的用戶。
我們將dev用戶添加到backend中,
我們切換到frontend project看一下:發現沒有dev用戶。
現在我們可以使用用戶模擬的功能看一下每個用戶的權限。
具體每一種角色的權限,可以參考如下地址:
http://192.168.56.12/help/user/permissions ,地址換成你的Gitlab地址即可。
5、添加SSH Key
我們使用dev1帳號登錄到Gitlab,然后切換到一個具體的project下:
我們為dev1用戶添加一個SSH Key,SSH Key可以讓我以SSH的方式鏈接到代碼倉庫,然后就可以在本地和Gitlab倉庫之間拉取和推送代碼。SSH Key全局唯一。
我們在node1節點上生成SSH Key:
[root@node1 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:eEoexwPCixJX99Gr7H3Sn29BS4RIJ4IBIbnr2fGme1M root@node1
The key's randomart image is:
+---[RSA 2048]----+
| .oo+.+o.o... |
| +.. o .o.o. . |
|. . + . . . . |
| o o o + . o |
|. . o +.S. o .|
| . . + =oE o |
| . o =... . .|
| o . =. o o ..|
| o= . o .oo.|
+----[SHA256]-----+
[root@node1 ~]# ll .ssh/
total 12
-rw------- 1 root root 1679 Dec 4 15:17 id_rsa
-rw-r--r-- 1 root root 392 Dec 4 15:17 id_rsa.pub
-rw-r--r-- 1 root root 803 Dec 1 13:26 known_hosts
[root@node1 ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnWbgoAKbW5nCTnRo4IfAJ0KrEdbhiyEea2NTROP5QVsIZo8B7iIcoq78XfIZWscGkDypWRa1HTAGrdem0d28ihqrcFsepnKhRpiXC4ZbycZ7DIU1LXtCBioNrCJdm7fGOse/pUGt8qpmeFProrkwFeUG5nxUBOChjYRqpwUQm4Nq5Z+fRGYVGiTngHyQ7L1d67Eqs4xuFjlTi72c0sySiOhk0lu4gFFyE9WuXBdiFGsNdOz504ypKxI2uMws6vj9k28ETykx5RC/0Uyk+xJMwoJE9L4xB+ihtMCQBGw1UG6T4djsoDniTp++PGpMxePieZQ88cB1dIJMqhTV0y0mv root@node1
我們將公鑰id_rsa.pub的內容添加到Gitlab dev1用戶的SSH Key中。
至此,我們已經完成打通了dev1的本機與Gitlab倉庫之間的通道。
我們再將我們的windows的SSH Key添加到Gitlab,首先我們要安裝Git GUI(參考gitlab安裝文檔):
在窗口中重復執行我們在linux中創建SSH Key的過程
然后根據提示找到id_rsa.pub,將該文件中的內容添加到Gitlab中dev2的SSH Key。
由於SSH Key全局唯一,所以我只要任何一個用戶中添加都可以。
6、初始化GitLab倉庫
剛才我們創建的前台和后台兩個project現在還是空的,本次教程我們只使用其中的frontend,現在我們首先對這兩個倉庫進行初始化,並創建兩個分支master,dev。我們使用pm用戶對frontend進行初始化操作。
接下來我們自動創建dev分支:
我們可以mster分支是默認的分支,而且是受保護的。
在實際的開發過程中,master分支一般用來版本發布,dev分支用於存放開發代碼。
7、使用Gitlab遠程倉庫
前面我們已經創建了frontend的遠程倉庫,現在我們分別在linux下和windows下連接遠程倉庫,實現代碼的摘取與推送。
linux:
使用git clone 命令克隆遠程frontend倉庫到本地
[root@node1 ~]# git clone git@192.168.56.12:web-site/frontend.git
Cloning into 'frontend'...
The authenticity of host '192.168.56.12 (192.168.56.12)' can't be established.
ECDSA key fingerprint is SHA256:SjPoetHYvGBI08VxTdzYOys+QpjR5vLNbU9Obs2Lx9Q.
ECDSA key fingerprint is MD5:39:3e:52:a1:45:9b:3e:23:72:e6:0d:0e:76:00:17:55.
Are you sure you want to continue connecting (yes/no)? yes /*第一次連接時會出現該提示
Warning: Permanently added '192.168.56.12' (ECDSA) to the list of known hosts.
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
[root@node1 ~]# ll
total 4
-rw-------. 1 root root 1374 Nov 27 00:14 anaconda-ks.cfg
drwxr-xr-x 3 root root 94 Nov 30 22:28 demo
drwxr-xr-x 3 root root 32 Dec 4 21:02 frontend
drwxr-xr-x 3 root root 97 Dec 2 19:48 git-test
drwxr-xr-x 4 root root 49 Nov 30 15:53 web-site
[root@node1 ~]# cd frontend/
[root@node1 frontend]# ll
total 4
-rw-r--r-- 1 root root 16 Dec 4 21:02 README
[root@node1 frontend]# git branch
* master
[root@node1 frontend]# git remote -v
- origin git@192.168.56.12:web-site/frontend.git (fetch)
- origin git@192.168.56.12:web-site/frontend.git (push)
從遠程倉庫拉下dev分支到本地
[root@node1 frontend]# git pull origin dev
From 192.168.56.12:web-site/frontend
* branch dev -> FETCH_HEAD
Already up-to-date.
切換到dev分支
[root@node1 frontend]# git checkout dev
Branch dev set up to track remote branch dev from origin.
Switched to a new branch 'dev'
[root@node1 frontend]# git branch
* dev
master
在dev分支下添加linux.txt文件,然后commit。
[root@node1 frontend]# echo "this is linux agnet" >> linux.txt
You have new mail in /var/spool/mail/root
[root@node1 frontend]# git add .
[root@node1 frontend]# git commit -m "add linux.txt file"
[dev cdd58d8] add linux.txt file
1 file changed, 1 insertion(+)
create mode 100644 linux.txt
推送本地dev分支到遠程倉庫的dev分支
[root@node1 frontend]# git push origin dev
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 291 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for dev, visit:
remote: http://192.168.56.12/web-site/frontend/merge_requests/new?merge_request%5Bsource_branch%5D=dev
remote:
To 192.168.56.12:web-site/frontend.git
8a36a7f..cdd58d8 dev -> dev
然后我們在Gitlab上查看:
windows:
第一次連接會出現此對話框,請輸入yes。
拉取遠程dev分支,然后切換
我們在frontend文件夾里添加windows文件
上面的兩個過程我們都是從本地的dev推送到Gitlab倉庫的dev分支,那我是不是可以直接在本地合並到master分支,然后推送master分支到Gitlab呢?這個問題留給大家課后實際操作一下。
實驗結果:
[root@node1 frontend]# git checkout master
Switched to branch 'master'
[root@node1 frontend]# git merge dev
Updating 8a36a7f..cdd58d8
Fast-forward
linux.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 linux.txt
[root@node1 frontend]# ll
total 8
-rw-r--r-- 1 root root 20 Dec 4 21:50 linux.txt
-rw-r--r-- 1 root root 16 Dec 4 21:02 README
[root@node1 frontend]# git push origin master
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 291 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: You are not allowed to push code to protected branches on this project.
To 192.168.56.12:web-site/frontend.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@192.168.56.12:web-site/frontend.git'
五、Gitlab高級使用
在開始我們的講解前,我們先為我們的frontend項目做一個開發計划:
v1.0版本:開始時間為12月5日,結束時間為12月11,工期5天 |
||||
模塊 |
開發者 |
完成日期 |
|
|
首頁 |
dev1 |
7 |
|
|
新聞 |
dev1 |
8 |
|
|
產品 |
dev2 |
9 |
|
|
關於我們 |
dev2 |
10 |
|
|
1、Milestones(里程碑)
里程碑計划是一個目標計划,它表明為了達到特定的里程碑,去完成一系列活動。根據frontend的開發計划,我們為frontend建立一個v1.0的里程碑。
2、Issue and Issue Tracker(問題跟蹤器)
Issue可以有很多的作用:1、闡述一個新的想法;2、提交功能建議;3、報告bugs等。
根據我們frontend的開發計划,我們使用Issue來分派計划中的任務:
使用同樣的方法,添加剩下的三個計划。完成后如下:
我們使用dev2用戶登錄,可以看到:
然后我們模擬dev2用戶在本地開發about功能,並將開發的代碼上傳gitlab,然后合並到dev分支。本地編輯文件並上傳部分請參考前面(4.7章節),完成后gitlab上4-about分支的狀態如下:
然后我們發送一個合並請求給pm,請我們的about功能合並到開發分支。
然后我們使用pm用戶登錄:
檢查正確后,點擊merge
我們可以看about.html文件已經合並到了dev分支,並且生成了一次Merge branch的commit記錄。然后我們就可以關閉about 的issue。我們可以使用同樣的方法完成其他幾個模塊的開發,並最后合並到dev分支。當所有的開發工作完成后,由PM將dev分支合並到mster分支,然后我們可以在Master分支創建一個發布版本進行發布。
3、GitLab CI
3.1簡介
gitlab-ci全稱是gitlab continuous integration的意思,也就是持續集成。中心思想是當每一次push到gitlab的時候,都會觸發一次腳本執行,然后腳本的內容包括了測試,編譯,部署等一系列自定義的內容。
GitLab CI是 GitLab 提供的持續集成服務,只要在你的倉庫根目錄 創建一個.gitlab-ci.yml 文件, 並為該項目指派一個Runner,當有合並請求或者 push的時候就會觸發build。
這個.gitlab-ci.yml 文件定義GitLab runner要做哪些操作。 默認有3個[stages(階段)]: build、test、deploy。
所以簡單的說,要讓CI工作可總結為以下幾點:
在倉庫根目錄創建一個名為.gitlab-ci.yml 的文件
為該項目配置一個Runner
完成上面的步驟后,每次push代碼到Git倉庫, Runner就會自動開始pipeline。
3.2組件
GitLab-CI
這個是一套配合GitLab使用的持續集成系統,是GitLab自帶的,也就是你裝GitLab的那台服務器上就帶有的。無需多考慮。.gitlab-ci.yml的腳本解析就由它來負責。
GitLab-Runner
這個是腳本執行的承載者,.gitlab-ci.yml的script部分的運行就是由runner來負責的。GitLab-CI瀏覽過項目里的.gitlab-ci.yml文件之后,根據里面的規則,分配到各個Runner來運行相應的腳本script。這些腳本有的是測試項目用的,有的是部署用的。
因為 GitLab Runner 可以安裝到不同的機器上,所以在構建任務運行期間並不會影響到 GitLab 的性能
.gitlab-ci.yml
這個是在git項目的根目錄下的一個文件,記錄了一系列的階段和執行規則。GitLab-CI在push后會解析它,根據里面的內容調用runner來運行。
3.3安裝
安裝GitLab-CI
這個不用安裝了,裝好GitLab就自帶了
安裝GitLab-Runner
[root@node1 src]# cd /usr/local/src/
[root@node1 src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ci-multi-runner/yum/el7/gitlab-ci-multi-runner-9.5.1-1.x86_64.rpm
[root@node1 src]# rpm -ivh gitlab-ci-multi-runner-9.5.1-1.x86_64.rpm
3.4注冊
向gitlab-CI注冊這個runner
[root@node1 src]# gitlab-ci-multi-runner register
Running in system-mode.
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://192.168.56.12 gitlab地址
Please enter the gitlab-ci token for this runner:
WUsLpmDFu6q4snDSqmds project的token
Please enter the gitlab-ci description for this runner:
[node1]: node1 runner的描述
Please enter the gitlab-ci tags for this runner (comma separated):
node1-runner runner標簽
Whether to run untagged builds [true/false]:
[false]: true
Whether to lock Runner to current project [true/false]:
[false]: false
Registering runner... succeeded runner=WUsLpmDF
Please enter the executor: docker, docker-ssh, virtualbox, kubernetes, parallels, shell, ssh, docker+machine, docker-ssh+machine:
shell 選擇runner的類型
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
[root@node1 src]# gitlab-ci-multi-runner list
Listing configured runners ConfigFile=/etc/gitlab-runner/config.toml
node1 Executor=shell Token=bcb3699e350002b905bcfead2f3f6d URL=http://192.168.56.12
[root@node1 src]#
3.5啟動
[root@node1 src]# gitlab-ci-multi-runner start
3.6編寫gitlab-ci.yml
我們先介紹幾個基本概念:
Pipeline
一次 Pipeline 其實相當於一次構建任務,里面可以包含多個流程,如安裝依賴、運行測試、編譯、部署測試服務器、部署生產服務器等流程。
Stages
Stages 表示構建階段,說白了就是上面提到的流程。
我們可以在一次 Pipeline 中定義多個 Stages,這些 Stages 會有以下特點:
所有 Stages 會按照順序運行,即當一個 Stage 完成后,下一個 Stage 才會開始
只有當所有 Stages 完成后,該構建任務 (Pipeline) 才會成功
如果任何一個 Stage 失敗,那么后面的 Stages 不會執行,該構建任務 (Pipeline) 失敗
Jobs
Jobs 表示構建工作,表示某個 Stage 里面執行的工作。
我們可以在 Stages 里面定義多個 Jobs,這些 Jobs 會有以下特點:
相同 Stage 中的 Jobs 會並行執行
相同 Stage 中的 Jobs 都執行成功時,該 Stage 才會成功
如果任何一個 Job 失敗,那么該 Stage 失敗,即該構建任務 (Pipeline) 失敗
基本寫法
# 定義 stages
stages:
- build
- deploy
# 定義 job
job1:
stage: deploy
script:
- echo "I am job1"
- scp web.tar.gz /tmp
- pwd
# 定義 job
job2:
stage: build
script:
- echo "I am job2"
- tar czf web.tar.gz ./*
用 stages 關鍵字來定義 Pipeline 中的各個構建階段,然后用一些非關鍵字來定義 jobs。
每個 job 中可以可以再用 stage 關鍵字來指定該 job 對應哪個 stage。
job 里面的 script 關鍵字是最關鍵的地方了,也是每個 job 中必須要包含的,它表示每個 job 要執行的命令。
六、GitLab備份
對gitlab進行備份將會創建一個包含所有庫和附件的歸檔文件。對備份的恢復只能恢復到與備份時的gitlab相同的版本。將gitlab遷移到另一台服務器上的最佳方法就是通過備份和還原。
gitlab提供了一個簡單的命令行來備份整個gitlab,並且能靈活的滿足需求。
備份文件將保存在配置文件中定義的backup_path中,文件名為TIMESTAMP_gitlab_backup.tar,TIMESTAMP為備份時的時間戳。TIMESTAMP的格式為:EPOCH_YYYY_MM_DD_Gitlab-version。
如果自定義備份目錄需要賦予git權限
配置文件中加入
gitlab_rails['backup_path'] = '/data/backup/gitlab'
gitlab_rails['backup_keep_time'] = 604800 備份保留的時間(以秒為單位,這個是七天默認值),
mkdir /data/backup/gitlab
chown -R git.git /data/backup/gitlab
完成后執行gitlab-ctl reconfigure
1、手動備份
執行:gitlab-rake gitlab:backup:create生成一次備份。
[root@node2 ~]# gitlab-rake gitlab:backup:create
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
* web-site/frontend ... [DONE]
* web-site/frontend.wiki ... [SKIPPED]
* web-site/backend ... [SKIPPED]
* web-site/backend.wiki ... [SKIPPED]
* devops/accout ... [DONE]
* devops/accout.wiki ... [SKIPPED]
* devops/user ... [DONE]
* devops/user.wiki ... [SKIPPED]
* web-site/accout ... [DONE]
* web-site/accout.wiki ... [SKIPPED]
done
Dumping uploads ...
done
Dumping builds ...
done
Dumping artifacts ...
done
Dumping pages ...
done
Dumping lfs objects ...
done
Dumping container registry images ...
[DISABLED]
Creating backup archive: 1512811475_2017_12_09_10.2.2_gitlab_backup.tar ... done
Uploading backup archive to remote storage ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping
[root@node2 ~]# ll /var/opt/gitlab/backups/
total 272
-rw------- 1 git git 276480 Dec 9 17:24 1512811475_2017_12_09_10.2.2_gitlab_backup.tar
2、定時備份
在定時任務里添加:
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
環境變量CRON=1的作用是如果沒有任何錯誤發生時, 抑制備份腳本的所有進度輸出。
3、恢復
只能還原到與備份文件相同的gitlab版本。
執行恢復操作時,需要gitlab處於運行狀態,備份文件位於gitlab_rails['backup_path']。
[root@node2 ~]# ll /var/opt/gitlab/backups/
total 272
-rw------- 1 git git 276480 Dec 9 17:24 1512811475_2017_12_09_10.2.2_gitlab_backup.tar
停止連接到數據庫的進程(也就是停止數據寫入服務),但是保持GitLab是運行的。
[root@node2 ~]# gitlab-ctl stop unicorn
- ok: down: unicorn: 0s, normally up
[root@node2 ~]# gitlab-ctl stop sidekiq
- ok: down: sidekiq: 0s, normally up
確認:
[root@node2 ~]# gitlab-ctl status
run: gitaly: (pid 1497) 0s; run: log: (pid 540) 0s
run: gitlab-monitor: (pid 1507) 0s; run: log: (pid 543) 0s
run: gitlab-workhorse: (pid 1517) 0s; run: log: (pid 508) 0s
run: logrotate: (pid 14405) 1564s; run: log: (pid 510) 0s
run: nginx: (pid 1532) 0s; run: log: (pid 507) 0s
run: node-exporter: (pid 1538) 0s; run: log: (pid 525) 0s
run: postgres-exporter: (pid 1543) 0s; run: log: (pid 530) 0s
run: postgresql: (pid 1551) 0s; run: log: (pid 492) 0s
run: prometheus: (pid 1559) 0s; run: log: (pid 535) 0s
run: redis: (pid 1567) 0s; run: log: (pid 491) 0s
run: redis-exporter: (pid 1572) 0s; run: log: (pid 547) 0s
down: sidekiq: 121s, normally up; run: log: (pid 500) 0s
down: unicorn: 133s, normally up; run: log: (pid 502) 0s
[root@node2 ~]#
接下我們進行恢復,指定時間戳你要從那個備份恢復:
[root@node2 ~]# gitlab-rake gitlab:backup:restore BACKUP=1512811475_2017_12_09_10.2.2
Unpacking backup ... done
Before restoring the database, we will remove all existing
tables to avoid future upgrade problems. Be aware that if you have
custom tables in the GitLab database these tables and all data will be
removed.
Do you want to continue (yes/no)?
將移除我們自建的表。回答yes
Restoring uploads ...
done
Restoring builds ...
done
Restoring artifacts ...
done
Restoring pages ...
done
Restoring lfs objects ...
done
This will rebuild an authorized_keys file.
You will lose any data stored in authorized_keys file.
Do you want to continue (yes/no)?
將移除所有的認證Key。回答yes
....
Deleting tmp directories ... done
done
done
done
done
done
done
done
完成后重啟GitLab服務
[root@node2 ~]# gitlab-ctl restart
- ok: run: gitaly: (pid 18194) 0s
- ok: run: gitlab-monitor: (pid 18204) 0s
- ok: run: gitlab-workhorse: (pid 18209) 1s
- ok: run: logrotate: (pid 18224) 0s
- ok: run: nginx: (pid 18231) 1s
- ok: run: node-exporter: (pid 18237) 0s
- ok: run: postgres-exporter: (pid 18242) 0s
- ok: run: postgresql: (pid 18314) 0s
- ok: run: prometheus: (pid 18317) 1s
- ok: run: redis: (pid 18326) 0s
- ok: run: redis-exporter: (pid 18330) 0s
- ok: run: sidekiq: (pid 18345) 0s
- ok: run: unicorn: (pid 18354) 0s
檢查GitLab的服務
[root@node2 ~]# gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...
GitLab Shell version >= 5.9.4 ? ... OK (5.9.4)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
2/3 ... ok
2/4 ... repository is empty
7/5 ... ok
7/7 ... ok
2/8 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet)
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ...
2/3 ... yes
2/4 ... yes
7/5 ... yes
7/7 ... yes
2/8 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.3.5)
Git version >= 2.7.3 ? ... yes (2.13.6)
Git user has default SSH configuration? ... yes
Active users: ... 5
Checking GitLab ... Finished