技术解析
3 年前我用 CentOS6 安装了 Docker GitLab,配合 yum 安装的 Nginx 做了 https 站点,当时觉得蛮简单的,也记录下当时的命令:
sudo docker run --detach \
--hostname 公网 IP \
--publish 443:8443 --publish 80:8080 --publish 22:8022 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
后来我也如法炮制,给公司和客户在 CentOS7 上搭建了 https 域名 Docker GitLab 。但是最近我的个人服务器换成了 Ubuntu19.10 ,怎么搭建都不成功。耐心尝试过几个教程,完全跟着步骤来,得到的结果都是一样,就是 docker run 之后会一直处于 staring 的状态,docker container logs -f gitlab 总是在
* execute[/opt/gitlab/bin/gitlab-ctl start grafana] action run
[execute] ok: run: grafana: (pid 1568) 7s
- execute /opt/gitlab/bin/gitlab-ctl start grafana
Recipe: gitlab::gitlab-rails
* execute[clear the gitlab-rails cache] action run%
处卡住然后 Exited 。经过多番搜索,尝试修改 /etc/gitlab/gitlab.rb
以下内容:
nginx['ssl_certificate'] = "/etc/gitlab/dingchil.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/dingchil.com.key"
external_url "https://gl.dingchil.com"
nginx['enable'] = false
web_server['external_users'] = ['root']
gitlab_workhorse['listen_network'] = "tcp"
我还想过是不是 Docker Nginx 、端口、权限、防火墙的问题,最后我想到什么都不弄,就一句 sudo docker run -d -p 443:8443 -p 80:8080 -p 22:8022 --name gitlab gitlab/gitlab-ce:latest
结果是 logs 跑完之后,显示的是 unhealthy 。直接访问域名:端口也不行,显示 502 。后来特意搜索 grafana,虽然没有找到有用的结果但是给 /etc/gitlab/gitlab.rb
加了一句 grafana['enable'] = false
就会输出大量的:
{"error":"listen tcp: address /var/opt/gitlab/gitlab-workhorse/socket: missing port in address","level":"fatal","msg":"Failed to listen","time":"2020-04-10T16:46:49Z"}
{"error":"rpc error: code = DeadlineExceeded desc = context deadline exceeded","level":"warning","msg":"gitaly-ruby worker health check failed","time":"2020-04-10T16:46:30.792Z","worker.name":"gitaly-ruby.1"}
有点摸不着头脑了,有没有刚搭建过的 v 友讲一下?另外我还有个小问题,希望有人解惑:v2ex.com/t/660862