1. 程式人生 > >Gitlab安裝使用及漢化配置

Gitlab安裝使用及漢化配置

一、GitLab簡介

GitHub是2008年由Ruby on Rails編寫而成,與業界聞名的Github類似;但要將程式碼上傳到GitHub上面,而且將專案設為私有還要收費。GitLab 是一個用於倉庫管理系統的開源專案,使用Git作為程式碼管理工具,可通過Web介面進行訪問公開的或者私人專案,非常適合在團隊內部使用。

在gitlab中有三個版本,分別是CE(社群版)、EE(企業版)、OM(RPM包完整版,裡面包括nginx、redis等其它軟體,比較大)。這裡的編譯安裝版,是指CE版的原始碼安裝

官網https://docs.gitlab.com/

這裡呢建議大家使用rpm安裝

1.1 Gitlab提供的功能

1.     程式碼託管服務

2.     訪問許可權控制

3.     問題跟蹤,bug的記錄和討論

4.     程式碼審查,可以檢視、評論程式碼

5.     社群版基於 MIT License開源完全免費

1.2 Gitlab(Github)和Git區別

Github和Git是兩回事。

Git是版本控制系統,Github是線上的基於Git的程式碼託管服務。

1.3 Github PK Sourceforge

為什麼現在Github這麼火,以至於世界頂級公司和專案的原始碼很多都託管在Github上

Why

1.     顏值高

2.     簡潔大方

2011年,Github已經取代Sourceforge,成為最活躍的程式碼交流社群。這意味著在Open SourceCommunity(開源社群),Git取代了SVN已經成為事實。

1.3.1 Github介面

1.3.2 Sourceforge介面

1.4 搭建私有Git服務的優勢

公司的專案,因為商業層面的原因,需要把程式碼託管到自有的伺服器上,並且伺服器很有可能是放在企業內網中,不對公網開放。

出於安全性的考慮,暫時沒有使用國內的Git服務平臺的計劃。

GitHub和BitBucket,GitLab,由於服務商是在國外,受地域的影響,因此在網路訪問上會有延遲。

現有的服務商,對於免費的套餐都有一定的限制,比如GitHub只允許建立免費的開源repository,不允許建立私有的倉庫。BitBucket允許建立無限制的私有專案,不過對於專案中參與的開發人員是有人數限制的。當團隊中開發者規模達到一定數量後,需要付費購買相應的套餐。

二、Gitlab安裝

2.1 環境配置

硬體:

redhat-7.x系列_x86_64

Mem建議至少2G

軟體:

       gitlab-ce.x86_64 0:8.8.0-ce

       git-2.11.0

       ruby2.1(至少是2.1)

server

client

192.168.201.148

192.168.201.130(作為測試端)

本次採用Omnibus 安裝方式

2.2 gitlab環境要求

#系統層

Ubuntu

Debian

CentOS

Red Hat Enterprise Linux (please use the CentOSpackages and instructions)

Scientific Linux (please use the CentOSpackages and instructions)

Oracle Linux (please use the CentOS packagesand instructions)

不支援win

#Ruby versions

GitLab需要Ruby(MRI)2.3。支援低於2.3(2.1,2.2)的Ruby版本將停止與GitLab 8.13

#硬體要求

必要的硬碟驅動器空間很大程度上取決於您要儲存在GitLab中的存檔的大小,但是根據經驗,您應該至少擁有與所有存檔組合相同的可用空間。

如果你希望在將來考慮使用LVM來安裝硬碟驅動器空間方面具有靈活性,那麼您可以在需要時新增更多的硬碟驅動器。

除本地硬碟驅動器外,你還可以安裝支援網路檔案系統(NFS)協議的卷。此卷可能位於檔案伺服器,網路連線儲存(NAS)裝置,儲存區域網路(SAN)或Amazon Web Services(AWS)彈性塊儲存(EBS)捲上。

如果你有足夠的RAM記憶體和最近的CPU,則GitLab的速度主要受硬碟搜尋時間的限制。快速驅動(7200 RPM或更高)或固態硬碟(SSD)將提高GitLab的響應速度

#CPU

1核心的CPU,基本上可以滿足需求,大概支撐100個左右的使用者,不過在執行GitLab網站的同時,還需要執行多個worker以及後臺job,顯得有點捉襟見肘了。

兩核心的CPU是推薦的配置,大概能支撐500個使用者.

4核心的CPU能支撐 2,000 個使用者.

8核心的CPU能支撐 5,000 個使用者.

16核心的CPU能支撐 10,000 個使用者.

32核心的CPU能支撐 20,000 個使用者.

64核心的CPU能支援多達 40,000 個使用者.

#Memory 

你需要至少4GB的可定址記憶體(RAM交換)來安裝和使用GitLab!作業系統和任何其他正在執行的應用程式也將使用記憶體,因此請記住,在執行GitLab之前,您至少需要4GB的可用空間。使用更少的記憶體GitLab將在重新配置執行期間給出奇怪的錯誤,並在使用過程中發生500個錯誤.

1GBRAM + 3GB of swap is the absolute minimum but we strongly adviseagainst this amount of memory. See the unicorn worker section belowfor more advice.

2GBRAM + 2GB swap supports up to 100 users but it will be very slow

4GBRAM isthe recommended memory size for all installations and supportsup to 100 users

8GBRAM supports up to 1,000 users

16GBRAM supports up to 2,000 users

32GBRAM supports up to 4,000 users

64GBRAM supports up to 8,000 users

128GBRAM supports up to 16,000 users

256GBRAM supports up to 32,000 users

建議伺服器上至少有2GB的交換,即使您目前擁有足夠的可用RAM。如果可用的記憶體更改,交換將有助於減少錯誤發生的機會。

#Unicorn Workers(程序數) 

可以增加獨角獸工人的數量,這通常有助於減少應用程式的響應時間,並增加處理並行請求的能力.

對於大多數情況,我們建議使用:CPU核心1 =獨角獸工人。所以對於一個有2個核心的機器,3個獨角獸工人是理想的。

對於所有擁有2GB及以上的機器,我們建議至少三名獨角獸工人。如果您有1GB機器,我們建議只配置兩個Unicorn工作人員以防止過度的交換.

#Database 

PostgreSQL

MySQL/MariaDB

強烈推薦使用PostgreSQL而不是MySQL/ MariaDB,因為GitLab的所有功能都不能與MySQL/ MariaDB一起使用。例如,MySQL沒有正確的功能來以有效的方式支援巢狀組.

執行資料庫的伺服器應至少有5-10 GB的可用儲存空間,儘管具體要求取決於GitLab安裝的大小

#PostgreSQL要求

從GitLab 9.0起,PostgreSQL 9.2或更新版本是必需的,不支援早期版本。

#Redis and Sidekiq

Redis儲存所有使用者會話和後臺任務佇列。Redis的儲存要求最低,每個使用者大約25kB。

Sidekiq使用多執行緒程序處理後臺作業。這個過程從整個Rails堆疊(200MB)開始,但是由於記憶體洩漏,它可以隨著時間的推移而增長。在非常活躍的伺服器(10,000個活躍使用者)上,Sidekiq程序可以使用1GB的記憶體。

#Prometheus and its exporters

從Omnibus GitLab 9.0開始,預設情況下,Prometheus及其相關出口商啟用,可以輕鬆,深入地監控GitLab。這些程序將使用大約200MB的記憶體,具有預設設定。這個還可以監控k8s

#Node exporter

節點匯出器允許您測量各種機器資源,如記憶體,磁碟和CPU利用率。預設埠9100

#Redis exporter

       Redis出口商允許您測量各種Redis指標。

#Postgres exporter

Postgres匯出器允許您測量各種PostgreSQL度量。

#GitLab monitor exporter

GitLab監視器匯出器允許您測量各種GitLab指標。

#Supported web browsers

支援Firefox,Chrome /Chromium,Safari和Microsoft瀏覽器(Microsoft Edge和Internet Explorer 11)的當前和之前的主要版本。

2.3 安裝

1、關閉SELinux

#下面的命令實現永久關閉SELinux

[[email protected] ~]# sed -i's/^SELINUX=.*/#&/;s/^SELINUXTYPE=.*/#&/;/SELINUX=.*/aSELINUX=disabled' /etc/sysconfig/selinux

#下面的命令實現臨時關閉SELinux

[[email protected] ~]# setenforce 0

setenforce: SELinux is disabled

#永久修改下主機名,需要重啟系統之後生效

Redhat6中修改

[[email protected] ~]# vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=git.server.com #修改成你自己的主機名

Redhat7中修改

[[email protected] ~]# vi /etc/hostname

gitlab.server.com

#永久修改

[[email protected] ~]#hostnamectl set-hostname gitlab.server.com

#新增域名

[[email protected] ~]#cat /etc/hosts

192.168.201.131 gitlab.server.com

2、關閉firewall

#臨時關閉

[[email protected] yum.repos.d]# iptables -F

或者

[[email protected] gitlab_pack]# systemctl stopfirewalld.service

#永久關閉,需要下次重啟系統之後生效

[[email protected] gitlab_pack]# systemctl disablefirewalld.service

Removed symlink/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

Removed symlink/etc/systemd/system/basic.target.wants/firewalld.service.

#線上開啟防火牆

[[email protected] ~]# firewall-cmd --permanent--add-service=http

success

[[email protected] ~]# firewall-cmd --permanent--add-service=https

Success

[[email protected] ~]# firewall-cmd --reload

success

#重新載入配置

[[email protected] ~]#systemctl reload firewalld

3、同步時間

[[email protected] yum.repos.d]# ntpdate time.nist.gov

10 Apr 11:00:04 ntpdate[40122]: step timeserver 216.229.0.179 offset 53747.856066 sec

4、配置gitlab-ce yum源

[[email protected] yum.repos.d]# cat gitlab.repo

[gitlab-ce]

name=gitlab-ce

baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7

repo_gpgcheck=0

gpgcheck=0

enabled=1

gpgkey=https://packages.gitlab.com/gpg.key

註解

如果想要在centos6系列上安裝,只需把el7修改成el6

5、Gitlab安裝方式

Gitlab兩種安裝方式

編譯安裝

優點:可定製性強。資料庫既可以選擇MySQL,也可以選擇PostgreSQL;伺服器既可以選擇Apache,也可以選擇Nginx。

缺點:國外的源不穩定,被牆時,依賴軟體包難以下載。配置流程繁瑣、複雜,容易出現各種各樣的問題。依賴關係多,不容易管理,解除安裝GitLab相對麻煩。

rpm包安裝

優點:安裝過程簡單,安裝速度快。採用rpm包安裝方式,安裝的軟體包便於管理。

缺點:資料庫預設採用PostgreSQL,伺服器預設採用Nginx,不容易定製。

gitlab安裝

1,下載
2,安裝

#官方地址

https://about.gitlab.com/downloads/#centos7

#如果想檢視rpm中內容,預設安裝的位置

[[email protected]b gitlab_pack]# rpm2cpiogitlab-ce-8.8.0-ce.0.el6.x86_64.rpm | cpio -ivd

[[email protected] yum.repos.d]# yum install curlopenssh-server openssh-clients postfix -y

[[email protected] yum.repos.d]# yum install gitlab-ce-8.8.0-y

#這裡為了節省時間,直接rpm安裝

[[email protected] gitlab_pack]# rpm -ivhgitlab-ce-8.8.0-ce.0.el6.x86_64.rpm

Preparing...                         ################################# [100%]

Updating / installing...

  1:gitlab-ce-8.8.0-ce.0.el6        ################################# [100%]

gitlab: Thank you for installing GitLab!

gitlab: To configure and start GitLab, RUN THEFOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable athttp://localhost

gitlab: Otherwise configure GitLab for yoursystem by editing /etc/gitlab/gitlab.rb file

gitlab: And running reconfigure again.

gitlab:

gitlab: For a comprehensive list ofconfiguration options please see the Omnibus GitLab readme

gitlab:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

gitlab:

It looks like GitLab has not been configuredyet; skipping the upgrade script.

至此gitlab安裝成功

注意:

       rpm 安裝Gitlab的預設位置在/opt下

6、修改下配置檔案

#修改url,供外部訪問

[[email protected] ~]# vi /etc/gitlab/gitlab.rb

external_url'http://gitlab.server.com'

external_url 修改成自己的ip或者域名

#修改配置檔案之後,需要重新是配置檔案生效下,初始化下

[[email protected] ~]#gitlab-ctl reconfigure #這裡會花費一定的時間(1-10min),如果這裡記憶體小,將會花費大量時間

Recipe: gitlab::gitlab-rails

  *execute[clear the gitlab-rails cache] action run

    -execute /opt/gitlab/bin/gitlab-rake cache:clear

  *execute[clear the gitlab-rails cache] action run

    -execute /opt/gitlab/bin/gitlab-rake cache:clear

Recipe: gitlab::unicorn

  *service[unicorn] action restart

    -restart service service[unicorn]

Recipe: gitlab::redis

  *ruby_block[reload redis svlogd configuration] action create

    -execute the ruby block reload redis svlogd configuration

Recipe: gitlab::postgresql

  *ruby_block[reload postgresql svlogd configuration] action create

    -execute the ruby block reload postgresql svlogd configuration

Recipe: gitlab::unicorn

  *ruby_block[reload unicorn svlogd configuration] action create

    -execute the ruby block reload unicorn svlogd configuration

Recipe: gitlab::sidekiq

  *ruby_block[reload sidekiq svlogd configuration] action create

    -execute the ruby block reload sidekiq svlogd configuration

Recipe: gitlab::gitlab-workhorse

  *service[gitlab-workhorse] action restart

    -restart service service[gitlab-workhorse]

  *ruby_block[reload gitlab-workhorse svlogd configuration] action create

    -execute the ruby block reload gitlab-workhorse svlogd configuration

Recipe: gitlab::gitlab-workhorse

  *service[gitlab-workhorse] action restart

    -restart service service[gitlab-workhorse]

  *ruby_block[reload gitlab-workhorse svlogd configuration] action create

    -execute the ruby block reload gitlab-workhorse svlogd configuration

Recipe: gitlab::nginx

  *ruby_block[reload nginx svlogd configuration] action create

    -execute the ruby block reload nginx svlogd configuration

Recipe: gitlab::logrotate

  *ruby_block[reload logrotate svlogd configuration] action create

    -execute the ruby block reload logrotate svlogd configuration

Running handlers:

Running handlers complete

Chef Client finished, 222/309 resources updatedin 02 minutes 50 seconds

gitlab Reconfigured!#如果在此期間沒有出現error,證明成功

7、啟動Gitlab服務

[[email protected] ~]# gitlab-ctl start

ok: down:gitaly: 0s, normally up

ok: down:gitlab-monitor: 1s, normally up

ok: down: gitlab-workhorse: 0s, normally up

ok: down: logrotate: 0s, normally up

ok: down: nginx: 0s, normally up

ok: down:node-exporter: 0s, normally up

ok: down:postgres-exporter: 1s, normally up

ok: down: postgresql: 0s, normally up

ok: down:prometheus: 1s, normally up

ok: down: redis: 0s, normally up

ok: down:redis-exporter: 0s, normally up

ok: down: sidekiq: 0s, normally up

ok: down: unicorn: 1s, normally up

註解:

綠色部分是9中新新增的

ü  gitlab-workhorse這個“工作馬”,就是gitlab-Git-http-server(GitlabV8.0出現,V8.2名稱變更為Gitlab-workhorse)

ü  sidekiq多執行緒啟動

ü  unicorn是ruby的http server,可以通過http://localhost:8080埠訪問, 預設埠是8080

ü  nginx作為方向代理,代理到unicorn,nginx預設埠是80

ü  postgresql作為資料庫,預設埠是5432

ü  redis作為一個佇列(NoSql),用於儲存使用者session和任務,任務包括新建倉庫、傳送郵件等等,預設埠是6379

ü  logrotate切割日誌

ü  prometheus監控,預設埠9090

ü  gitlab-monitor預設埠9168

注:

(可選)如果系統資源不足,可以通過以下命令關閉Sidekiq來釋放一部分記憶體

[[email protected] ~]# gitlab-ctl stop sidekiq

ok: down: sidekiq: 0s, normally up

7.1 RPM安裝模式下的啟動、停止、重啟

#初次配置服務

# gitlab-ctlreconfigure

#啟動服務

# gitlab-ctl start

#停止服務

# gitlab-ctl stop

#重啟服務

# gitlab-ctl restart

#狀態

#gitlab-ctl status

#監控

#gitlab-ctl tailunicorn 監控unicorn日誌

#gitlab-ctl tail

8、登入

訪問地址http://ip

由於第一次登陸,需要設定密碼

登入

登入之後的介面

Gitlab8的介面

Gitlab9版本

9、解除安裝

重新安裝清理

1,解除安裝

[[email protected] Gitlab-cn]# rpm -e gitlab-ce

2,刪除檔案

[[email protected] Gitlab-cn]#rm -rf /etc/gitlab/*/var/log/gitlab/ /var/opt/gitlab/ /opt/gitlab/

2.4 漢化

#檢視版本

[[email protected] .ssh]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

9.1.2

#8版本下載漢化包並漢化

[[email protected] hanhua]# git clonehttps://gitlab.com/larryli/gitlab.git Gitlab-cn && cd Gitlab-cn

#備份/opt/gitlab/embedded/service目錄下的gitlab-rails目錄,該目錄下的內容主要是web應用部分

#備份

[[email protected] Gitlab-cn]#\cp -rf/opt/gitlab/embedded/service/gitlab-rails{,.ori}

#關閉gitlab這個服務

[[email protected] Gitlab-cn]#gitlab-ctl stop

#開始漢化

[[email protected] gitlab_pack]# \cp -rf Gitlab-cn/*/opt/gitlab/embedded/service/gitlab-rails/

測試是否漢化成功

[[email protected] ~]# gitlab-ctl start

ok: run: gitlab-workhorse: (pid 1407) 263s

ok: run: logrotate: (pid 1403) 263s

ok: run: nginx: (pid 1404) 263s

ok: run: postgresql: (pid 1405) 263s

ok: run: redis: (pid 1402) 263s

ok: run: sidekiq: (pid 1400) 263s

ok: run: unicorn: (pid 1401) 263s

登入

#9版本漢化

Cloning into 'gitlab'...

remote: Counting objects: 496150, done.

remote: Compressing objects: 100%(103590/103590), done.

remote: Total 496150 (delta 387041), reused495906 (delta 386824)Receiving objects: 100% (496150/496150), 220.14 MiB | 2

Resolving deltas: 100% (387041/387041), done.

Checking out files: 100% (9254/9254), done

#更新包

[[email protected] ~]# cd gitlab/

[[email protected] [9-1-stable-zh ≡]# git fetch

#生成補丁,進入到gitlab目錄下

[[email protected] gitlab]# git diff v9.1.2 v9.1.2-zh> ../9.1.2-zh.diff

#打補丁

[[email protected] gitlab]# patch -d/opt/gitlab/embedded/service/gitlab-rails -p1 < ../9.1.2-zh.diff

2.5 Gitlab命令使用

語法:

gitlab-ctl command (subcommand)

Service Management Commands

start

啟動所有服務

stop

關閉所有服務

restart

重啟所有服務

status

檢視所有服務狀態

tail

檢視日誌資訊

service-list

列舉所有啟動服務

graceful-kill

平穩停止一個服務

例子:

#啟動所有服務

[[email protected] ~]# gitlab-ctl start

#啟動單獨一個服務

[[email protected] ~]# gitlab-ctl start nginx

#檢視日誌,檢視所有日誌

[[email protected] ~]# gitlab-ctl tail

#檢視具體一個日誌,類似tail -f

[[email protected] ~]# gitlab-ctl tail nginx

help

幫助

reconfigure

修改配置檔案之後,需要重新載入下

show-config

檢視所有服務配置檔案資訊

uninstall

解除安裝這個軟體

cleanse

刪除gitlab資料,重新白手起家

例子:

#顯示所有服務配置檔案

[[email protected] ~]#gitlab-ctl show-config

#解除安裝gitlab

[[email protected] ~]#gitlab-ctl uninstall

Database Commands

pg-upgrade

更新postgresql版本

revert-pg-upgrade

還遠先前的(離現在正在使用靠近的版本)一個數據庫版本

例子:

#升級資料庫

[[email protected] ~]# gitlab-ctl pg-upgrade

Checking for an omnibus managed postgresql: OK

Checking if we already upgraded: OK

The latest version 9.6.1 is already running,nothing to do

#降級資料庫版本

[[email protected] ~]# gitlab-ctl revert-pg-upgrade

Toggling deploy page:cp/opt/gitlab/embedded/service/gitlab-rails/public/deploy.html/opt/gitlab/embedded/service/gitlab-rails/public/index.html

Toggling deploy page: OK

Toggling services:ok: down: gitaly: 129s,normally up

ok: down: gitlab-monitor: 128s, normally up

ok: down: logrotate: 127s, normally up

ok: down: node-exporter: 127s, normally up

ok: down: postgres-exporter: 126s, normally up

ok: down: prometheus: 125s, normally up

ok: down: redis-exporter: 125s, normally up

ok: down: sidekiq: 123s, normally up

Toggling services: OK

Checking if we need to downgrade: NOT OK

/var/opt/gitlab/postgresql/data.9.2.18 does notexist, cannot revert data

Will proceed with reverting the running programversion only, unless you interrupt

Reverting database to 9.2.18 in 5 seconds

=== WARNING ===

This will revert the database to what it wasbefore you upgraded, including the data.

Please hit Ctrl-C now if this isn't what youwere looking for

=== WARNING ===

== Reverting ==

ok: down: postgresql: 131s, normally up

ok: run: postgresql: (pid 12102) 0s

== Reverted ==

Toggling deploy page:rm -f/opt/gitlab/embedded/service/gitlab-rails/public/index.html

Toggling deploy page: OK

Toggling services:ok: run: gitaly: (pid 12107)1s

ok: run: gitlab-monitor: (pid 12111) 0s

ok: run: logrotate: (pid 12115) 1s

ok: run: node-exporter: (pid 12121) 0s

ok: run: postgres-exporter: (pid 12125) 0s

ok: run: prometheus: (pid 12130) 1s

ok: run: redis-exporter: (pid 12139) 0s

ok: run: sidekiq: (pid 12144) 1s

Toggling services: OK

2.6 gitlab配置詳解

名稱

配置路徑

gitlab配置檔案

/etc/gitlab/gitlab.rb

unicorn配置檔案

/var/opt/gitlab/gitlab-rails/etc/unicorn.rb

nginx配置檔案

/var/opt/gitlab/nginx/conf/gitlab-http.conf

gitlab倉庫預設位置

/var/opt/gitlab/git-data/repositories

#修改web埠

如果80和8080埠被佔用可以修改

[[email protected]_pack]# vi /var/opt/gitlab/gitlab-rails/etc/unicorn.rb

listen"127.0.0.1:8080", :tcp_nopush => true #這一行埠修改為你要埠

#修改nginx

[[email protected]_pack]# vi /var/opt/gitlab/nginx/conf/gitlab-http.conf

server{ #這裡的80埠修改為你所需要的埠

  listen *:80;

注:

只要修改了配置檔案一定要重新載入配置

#修改Prometheus埠

#Prometheus預設埠是9090

[[email protected]_pack]# vi /etc/gitlab/gitlab.rb

#根據自己情況自行修改成自己需要的port

#修改專案工程數量

預設安裝好,你能建立的專案,只能建立10個

#第一種方式修改

[[email protected] gitlab_pack]# vi/opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb

Settings.gitlab['default_projects_limit'] ||=10

修改成你自己所需要的引數,儲存

Settings.gitlab['default_projects_limit'] ||=10000

#重新初始化

[[email protected] postgresql]# gitlab-ctlreconfigure

#檢視修改之後專案數量

注:

這個是在安裝完gitlab之後修改,如果已經使用一段時間,在修改專案的數量,需要你自己在自己的使用者下修改,第二次初始化,會縮短時間

#第二種方式修改

#首先登入gitlab
#點選Adminstrator這個使用者
#點選編輯

#關閉註冊功能

預設註冊功能是開啟的, 對於個人的gitlab, 沒有對外公佈的必要

#首先點選管理區域---à在點選設定按鈕

找到註冊限制

選中,然後儲存

#關閉監控

#關閉服務

[[email protected] gitlab_pack]# gitlab-ctl stop

[[email protected]_pack]# vi /etc/gitlab/gitlab.rb

把true改成false

prometheus_monitoring['enable']= true

prometheus_monitoring['enable']= false

#儲存

#重新載入配置檔案

[[email protected]_pack]# gitlab-ctl reconfigure

#啟動服務

[[email protected] gitlab_pack]# gitlab-ctl start

ok: run: gitaly: (pid 21611) 0s

ok: run: gitlab-workhorse: (pid 21615) 1s

ok: run: logrotate: (pid 21622) 0s

ok: run: nginx: (pid 21628) 1s

ok: run: postgresql: (pid 21633) 0s

ok: run: redis: (pid 21641) 0s

ok: run: sidekiq: (pid 21645) 1s

ok: run: unicorn: (pid 21648) 0s

#很顯然沒有prometheus這個服務

2.7 gitlab安全

#Custom password length limits

#初始化器的密碼長度設定為最少8個字元

[[email protected] opt]# cd/opt/gitlab/embedded/service/gitlab-rails/config/initializers

[[email protected] initializers]#cpdevise_password_length.rb.example devise_password_length.rb<