群晖应用中自带了gitlab,版本较老,故采用docker里自行部署的方式架设gitlab和gitlab-runner。
相比较而言,群晖硬件能力有限,跑VMM虚拟机有些吃力,跑docker效率要好很多。
使用gitlab官方docker image:
https://hub.docker.com/r/gitlab/gitlab-ce/
https://hub.docker.com/r/gitlab/gitlab-runner/
Docker gitlab 配置



其中1080为gitlab访问端口,1081为gitlab-pages访问端口
gitlab.rb配置
## external_url 不用配置,上述docker图形化配置里已配置过
## external_url 'http://192.168.111.7:11080'
## 更改时区
gitlab_rails['time_zone'] = 'Asia/Shanghai'
################################################################################
## GitLab Pages
##! Docs: https://docs.gitlab.com/ce/pages/administration.html
################################################################################
##! Define to enable GitLab Pages
## 设置pages_external_url为自定义可用的域名,端口为1081,和docker图形化配置中的保持一致
pages_external_url "http://pthis.net:1081/"
gitlab_pages['enable'] = true
gitlab_pages['inplace_chroot'] = true
gitlab-runner配置

注册Runner
## 进入docker container
sudo docker exec -it gitlab-runner bash
## 注册Runner
gitlab-runner register --clone-url http://192.168.2.10:1080
注册使用gitlab-runner时必须增加–clone-url参数,否则gitlab里出现如下报错

解决方法参考链接:
https://docs.gitlab.com/runner/configuration/advanced-configuration.html#how-clone_url-works
安装yarn用于文档管理(基于vuePress)
## 进入docker container
sudo docker exec -it gitlab-runner bash
## 安装Nodejs 8
curl -sL https://deb.nodesource.com/setup_8.x | bash -
apt-get install -y nodejs
## 安装yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update && sudo apt-get install yarn
附:gitlab-ce安装目录结构 https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#directory-structure
/opt/gitlab
holds application code for GitLab and its dependencies./var/opt/gitlab
holds application data and configuration files thatgitlab-ctl reconfigure
writes to./etc/gitlab
holds configuration files for omnibus-gitlab. These are the only files that you should ever have to edit manually./var/log/gitlab
contains all log data generated by components of omnibus-gitlab.