利用 Docker 快速搭建 git 倉庫 Gitlab 與程式碼審閱 Gerrit 平臺

weixin_34365417發表於2018-04-08

大多數程式猿都用過全球最大的git託管平臺Github,上面有豐富的開源專案。在Github上託管開源專案是免費的,但是私有專案需要收取管理費。對於擁有云伺服器的開發者或者團隊,可以使用本文介紹的Gitlab平臺。 話不多說,我們來看看具體的步驟。

系統環境:騰訊雲伺服器,配置1核心2G記憶體,系統Centos7.2

Step1:初始化伺服器環境

1、設定系統Swap。根據gitlab官方的介紹,硬體建議使用雙核4G記憶體的配置。本文主要介紹安裝和配置方法,選用的是單核2G記憶體的機器,為了提高系統的響應,設定2G大小的Swap。設定過程簡略,參考連線 https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-6 設定完成後執行,可以看到swap設定成功。

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# free -m
total used free shared buff/cache available
Mem: 1840 88 83 8 1668 1589
Swap: 2047 0 2047
</pre>

2、安裝Nginx 為了使所有流量走80埠,本文使用Nginx做反向代理。 Nginx在Centos官方的源中是沒有這個軟體包的,需要執行

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">yum install epel-release
</pre>

新增EPEL源,騰訊雲的Centos上已經包含了EPEL源,直接執行

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# yum install nginx
</pre>

即可安裝 這裡需要注意的是騰訊雲在雲伺服器的控制檯這裡配置了安全組策略,預設的linux安全策略組沒有開啟80埠,需要手動新增80埠的規則。

<figure style="box-sizing: border-box; list-style: inherit; margin: 20px 0px; display: block; text-align: center; color: rgb(51, 51, 51); font-family: PingFangSC-Light, "hiragino sans gb", "helvetica neue", "microsoft yahei ui", "microsoft yahei", simsun, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

5776456-70ddab6639bd019f.png
image

</figure>

2、安裝docker centos7安裝docker非常方便,直接執行

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# yum install docker -y
</pre>

3、啟動docker

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# systemctl start docker.service
[root@VM_26_11_centos ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
</pre>

目前docker服務還沒有任何容器 4、更新docker映象源 由於docker的映象伺服器在國外,直接拉取映象的時候速度非常慢。有很多國內的docker映象,本文以daocloud.io為例,在daocloud註冊後,會得到一個更新映象源的命令:

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://b3d8b7d9.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://b3d8b7d9.m.daocloud.io"],
"live-restore": true
}
Success.
You need to restart docker to take effect: sudo systemctl restart docker
[root@VM_26_11_centos ~]# systemctl restart docker
</pre>

到這裡就已經初始化好了執行的環境

Step2:安裝Gitlab

1、映象選擇 Gitlab官方在DockerHub上有映象,一些第三方開發者也上傳了自己的Gitlab映象,通過執行搜尋命令可以看到可用的docker映象:

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker search gitlab
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/gitlab/gitlab-ce GitLab Community Edition docker image base... 1105 [OK]
docker.io docker.io/sameersbn/gitlab Dockerized gitlab web server 873 [OK]
docker.io docker.io/gitlab/gitlab-runner 177 [OK]
docker.io docker.io/gitlab/gitlab-ee GitLab Enterprise Edition docker image bas... 57
docker.io docker.io/twang2218/gitlab-ce-zh 這是漢化的 GitLab 社群版 Docker Image 30 [OK]
docker.io docker.io/anapsix/gitlab-ci GitLab-CI Continuous Integration in Docker... 28 [OK]
docker.io docker.io/centurylink/gitlab This image uses the image from sameersbn /... 24 [OK]
docker.io docker.io/genezys/gitlab Dockerized GitLab using the official omnib... 15 [OK]
</pre>

我們可以根據自己的喜好選擇docker映象。本文使用的是一個sameersbn/gitlab的映象(有關這個映象的詳細說明參考 https://github.com/sameersbn/docker-gitlab) 2、拉取映象 根據映象的說明,還需要使用資料庫和Redis,也可使用Docker映象,如https://github.com/sameersbn/docker-gitlab 中介紹的docker映象。本文使用的是已建好的Mysql和Redis資源,

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker pull docker.io/sameersbn/gitlab
[root@VM_26_11_centos ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/sameersbn/gitlab latest c7cd44692430 30 hours ago 1.083 GB
</pre>

由於我們之前設定了docker映象源,拉取映象的過程只需要兩分鐘就完成了。 3、建立容器

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker run --name gitlab -d
-p 127.0.0.1:10443:443 -p 127.0.0.1:10022:22 -p 127.0.0.1:10080:80
--env 'REDIS_HOST=redis.fin.red' --env 'REDIS_PORT=6379'
--env 'DB_ADAPTER=mysql2' --env 'DB_HOST=mysql.fin.red'
--env 'DB_NAME=gitlabhq_production_demo'
--env 'DB_USER=root' --env 'DB_PASS=2017123456' --env 'DB_PORT=3306'
--env 'GITLAB_HOST=gitlab.fin.red' --env 'GITLAB_ROOT_EMAIL=709729863@qq.com'
--env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string'
--env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string'
--env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string'
--env 'GITLAB_MAX_OBJECT_SIZE=125829120'
--volume /var/www/Docker/gitlab:/home/git/data
docker.io/sameersbn/gitlab
</pre>

檢查容器執行情況

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8e6bca607900 docker.io/sameersbn/gitlab "/sbin/entrypoint.sh " 51 seconds ago Up 50 seconds 0.0.0.0:10022->22/tcp, 0.0.0.0:10080->80/tcp, 0.0.0.0:10443->443/tcp gitlab
[root@VM_26_11_centos ~]# netstat -nptl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:10443 0.0.0.0:* LISTEN 5378/docker-proxy-c
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 24029/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 700/sshd
tcp 0 0 127.0.0.1:10080 0.0.0.0:* LISTEN 5385/docker-proxy-c
tcp 0 0 127.0.0.1:10022 0.0.0.0:* LISTEN 5392/docker-proxy-c
tcp6 0 0 :::22 :::* LISTEN 700/sshd
</pre>

說明gitlab的docker容器已經正常執行起來了。

Step3:安裝Gerrit

1、映象選擇 類似Gitlab,先搜尋gerrit映象

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker search gerrit
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/openfrontier/gerrit The Gerrit docker support PostgreSQL MySQL... 45 [OK]
docker.io docker.io/larrycai/gerrit The Gerrit code review system based on ubuntu 17 [OK]
docker.io docker.io/gerritforge/gerrit-centos7 Gerrit Code Review on CentOS 7 13
docker.io docker.io/gerritforge/gerrit-ubuntu15.04 Gerrit Code Review on Ubuntu 15.04 12
docker.io docker.io/accenture/adop-gerrit ADOP Gerrit 5 [OK]
docker.io docker.io/fabric8/gerrit 5 [OK]
</pre>

Gerrit官方沒有提供映象,本文選擇openfrontier/gerrit映象

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker pull docker.io/openfrontier/gerrit
</pre>

2、建立容器 本文采用github的Oauth登入方式,需要在Github先註冊一個Oauth賬號,註冊內容如下

<figure style="box-sizing: border-box; list-style: inherit; margin: 20px 0px; display: block; text-align: center; color: rgb(51, 51, 51); font-family: PingFangSC-Light, "hiragino sans gb", "helvetica neue", "microsoft yahei ui", "microsoft yahei", simsun, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

5776456-a934fc1b4a3f6f6e.png
image

</figure>

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker run
--name gerrit
-p 127.0.0.1:9418:8080
-p 127.0.0.1:19418:29418
-e WEBURL=http://gerrit.fin.red
-e USER_NAME=gerrit
-e USER_EMAIL=709729863@qq.com
-e AUTH_TYPE=OAUTH
-e OAUTH_ALLOW_EDIT_FULL_NAME=true
-e OAUTH_ALLOW_REGISTER_NEW_EMAIL=true
-e OAUTH_GITHUB_CLIENT_ID=4c70bd6eb7c87395ea69
-e OAUTH_GITHUB_CLIENT_SECRET=1bb740e97d47d4b5af0b842702beaf818c6b980a
-v /var/www/Docker/gerrit:/var/gerrit/review_site
-d docker.io/openfrontier/gerrit
[root@VM_26_11_centos ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f261556de08 openfrontier/gerrit "/gerrit-entrypoint.s" 5 minutes ago Up 5 minutes 127.0.0.1:9418->8080/tcp, 127.0.0.1:19418->29418/tcp gerrit
75b4f71615a2 docker.io/sameersbn/gitlab "/sbin/entrypoint.sh " 9 days ago Up 2 minutes 127.0.0.1:10022->22/tcp, 127.0.0.1:10080->80/tcp, 127.0.0.1:10443->443/tcp gitlab
[root@VM_26_11_centos ~]# netstat -nptl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9418 0.0.0.0:* LISTEN 2752/docker-proxy-c
tcp 0 0 127.0.0.1:10443 0.0.0.0:* LISTEN 3230/docker-proxy-c
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3204/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 699/sshd
tcp 0 0 127.0.0.1:19418 0.0.0.0:* LISTEN 2745/docker-proxy-c
tcp 0 0 127.0.0.1:10080 0.0.0.0:* LISTEN 3237/docker-proxy-c
tcp 0 0 127.0.0.1:10022 0.0.0.0:* LISTEN 3244/docker-proxy-c
tcp6 0 0 :::22 :::* LISTEN 699/sshd
</pre>

說明gerrit的容器已經正常執行起來了

Step4:Gerrit與Gitlab配置及使用

由於我們的伺服器安全組只開了80埠,而Gerrit與Gitlab都不是工作在80埠,因此考慮使用Nginx做反向代理。 Nginx的反向代理很簡單,在/etc/nginx/conf.d/目錄下新建

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# cd /etc/nginx/conf.d/
[root@VM_26_11_centos conf.d]# vi virtual.conf
</pre>

輸入以下內容並儲存

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">#gitlab server
server
{
listen 80;
server_name gitlab.fin.red;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://0.0.0.0:10080;
}
}

gerrit server

server
{
listen 80;
server_name gerrit.fin.red;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://0.0.0.0:9418;
}
}
</pre>

測試配置檔案有無錯誤並給ngixn傳送reload指令

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@VM_26_11_centos conf.d]# nginx -s reload
</pre>

在瀏覽器中分別輸入 gitlab.fin.red以及gerrit.fin.red

<figure style="box-sizing: border-box; list-style: inherit; margin: 20px 0px; display: block; text-align: center; color: rgb(51, 51, 51); font-family: PingFangSC-Light, "hiragino sans gb", "helvetica neue", "microsoft yahei ui", "microsoft yahei", simsun, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

5776456-70470d36bdf3432b.png
image

</figure>

<figure style="box-sizing: border-box; list-style: inherit; margin: 20px 0px; display: block; text-align: center; color: rgb(51, 51, 51); font-family: PingFangSC-Light, "hiragino sans gb", "helvetica neue", "microsoft yahei ui", "microsoft yahei", simsun, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

5776456-d38d3258889efe24.png
image

</figure>

到這裡就完成了Gitlab與Gerrit的安裝安裝

相關文章