gitlab - ljatsh/Test GitHub Wiki
修改历史
- 2018-06-20 初始记录
- 2018-06-25 升级
- 2018-07-18 解决远程push缓冲区溢出错误
- 2018-08-14 git添加文件自动替换换行符
- 2018-12-05 git clone碰到库太大的错误
- 2019-04-28 docker因日志过大罢工
- 2019-05-09 docker碰到too many open files
- 2019-07-10 从mac迁移到ubuntu
- 2021-04-15 配置email
为了简便起见,目前只接触GitLab Docker运行模式
-
从阿里云下载汉化版本:8.8
-
docker pull registry.cn-hangzhou.aliyuncs.com/lab99/gitlab-ce-zh
-
-
直接运行, 做简单的端口映射
docker run --detach \ --publish 80:80 --publish 443:443 \ --restart always \ --name gitlab \ --volume /Users/**/Documents/docker/data/gitlab/config:/etc/gitlab \ --volume /Users/**/Documents/docker/data/gitlab/logs:/var/log/gitlab \ --volume /Users/**/Documents/docker/data/gitlab/data:/var/opt/gitlab \ registry.cn-hangzhou.aliyuncs.com/lab99/gitlab-ce-zh
- 最好是单独配置数据卷,这里直接映射主机目录。没有把数据和容器放在一起,帮助了我从docker被误恢复到出厂设置的灾难中恢复了项目数据!
-
简单地址配置,方便资源访问
- 设置external_url
- 重新生成配置
-
docker exec gitlab gitlab-ctl reconfigure
-
- 重启服务,/etc/gitlab.yml的外部访问地址会生效
- 需要注意的是,端口80不能通过external_url来更改(http://192.168.0.130:80)
- 设置external_url
从8.8.5汉化版本升级直接升级到latest tag(10.8.4),做数据迁移时候,碰到了不能解决的难题,容器不能启动,因此没有机会运行gitlab-ctl reconfigure
。GitLab Docker虽然直接说可以覆盖升级,可是实践下来,并非如此。在一度想放弃的情况下,偶然发现了推荐逐步升级的GitLab Maintenance Policy, 实践下来,顺利走通:
- 8.8.5 -> 9.5.10 虽然碰到下面的错误,通过
gitlab-ctl reconfigure
顺利解决unrecognized configuration parameter "checkpoint_segments" in file "/var/opt/gitlab/postgresql/data/runtime.conf" line 14
- 9.5.10 -> 10.8.4 数据自动迁移成功
- 10.8.4 -> 11.0.0 数据自动迁移成功
升级Ubuntu 17到Ubuntu 18.04.2 LTS
初始迁移逻辑是,直接拷贝数据到Linux平台,但是container一直抱怨各种权限受限制错误。后面只能尝试备份和恢复
- 备份,官方的看这里,实际为了图省事,直接参考了这份资料,备份过程很顺利
- 恢复,Linux上初始遭遇读取备份权限不够的问题,缘故是容器起来后,才拷贝备份,文件Owner不是git,手动更改后恢复正常。但是运行
gitlab-rake gitlab:check SANITIZE=true
提示tmp目录有权限问题,根据提示更改权限即可
参考官方, 实际采用腾讯的企业邮箱, 需要配置安全密码, 而不是邮箱的登录密码
- Git: fatal: The remote end hung up unexpectedly
- gitlab error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
注意,client_max_body_size如果涉及到reverse_proxy,也需要调整,参考这里
- 2018-08-14第一次推送仓库,有碰到这个错误,client_max_body_size设置成0和1000M都不起作用。
docker logs --tail 1000 nginx_1.14.0
查看反向代理日志,有如下错误:尝试修改代理超时限制,获得成功,参考这里2018/08/14 10:05:18 [error] 51#51: *69366 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.17.0.1, server: localhost, request: "POST /longjun/herox.git/git-receive-pack HTTP/1.1", upstream: "http://172.17.0.2:80/longjun/herox.git/git-receive-pack", host: "192.168.0.130" 2018/08/14 10:05:18 [error] 51#51: *69366 client intended to send too large body: 668907198 bytes, client: 172.17.0.1, server: localhost, request: "POST /longjun/herox.git/git-receive-pack HTTP/1.1", upstream: "http://172.17.0.2:80/longjun/herox.git/git-receive-pack", host: "192.168.0.130" 172.17.0.1 - longjun [14/Aug/2018:10:05:18 +0000] "POST /longjun/herox.git/git-receive-pack HTTP/1.1" 413 199 "-" "git/2.15.2 (Apple Git-101.1)" "-"
proxy_read_timeout 120s; proxy_send_timeout 120s;
A: 参考这里设置不同环境的换行符设置
```bash
git config --local core.safecrlf false
git config --local core.autocrlf false
```
A: 参考这里
```bash
git config --global core.compression 0
git clone --depth 1 <your url>
git fetch --unshallow
git pull --all
```
clone成功后, 发现本地库不能看不到所有的分支信息,参考[这里](https://stackoverflow.com/questions/12762922/git-cannot-see-new-remote-branch)更改./git/config的fetch配置信息
A: 在Docker正常运行时,调整虚拟磁盘大小,尽量让容器产生大量的日志;在Docker罢工后,参照Mac修复和Linux修复并未取得成功。 无奈重置Docker,幸好数据是在主机磁盘上,而且容器容易再恢复。
A: docker运行支持调整unlimit参数
- docker的开发和运行