gitlab出现503错误

版本: gitlab/gitlab-ce:latest

问题原因: 权限不足导致(/gitlab/data/gitaly/gitaly.pid)
解决方法: 修改文件权限 chown 998 ./gitaly.pid && chgrp 988 ./gitaly.pid

==> /var/log/gitlab/gitaly/current <==
2020-10-15_07:07:14.07051 time="2020-10-15T07:07:14Z" level=info msg="Wrapper started" wrapper=3997
2020-10-15_07:07:14.07054 time="2020-10-15T07:07:14Z" level=info msg="finding gitaly" pid_file=/var/opt/gitlab/gitaly/gitaly.pid wrapper=3997
2020-10-15_07:07:14.07056 time="2020-10-15T07:07:14Z" level=fatal msg="find gitaly" error="open /var/opt/gitlab/gitaly/gitaly.pid: permission denied" wrapper=3997

gitlab重置root的密码


-sh-4.2$ gitlab-rails console production
-------------------------------------------------------------------------------------
 GitLab:       12.0.3 (08a51a9db93)
 GitLab Shell: 9.3.0
 PostgreSQL:   10.7
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.1.7)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):004:0> user.password=12345678
=> 12345678
irb(main):005:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 60439440-6443-46d1-acda-e29172be146a) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f09e949b958 @uri=#<URI::GID gid://gitlab/User/1>>
=> true
irb(main):006:0> exit
-sh-4.2$ exit
[root@qas-k8s-gitlab gitlab]# gitlab-ctl restart
ok: run: alertmanager: (pid 43507) 0s
ok: run: gitaly: (pid 43523) 0s
ok: run: gitlab-monitor: (pid 43542)
————————————————

原文地址

docker-gitlab方式部署

env

  • mac 10.13.1
  • docker 18.06.0-ce build 0ffa825
  • docker-compose version 1.22.0, build f46880f

部署过程记录-log

开始部署

sudo docker run --detach \
    --hostname gitlab.example.com \
    --publish 44301:443 --publish 8001:80 --publish 2201:22 \
    --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

error01-执行后报错误

docker: Error response from daemon: Mounts denied:
The paths /srv/gitlab/data and /srv/gitlab/logs and /srv/gitlab/config
are not shared from OS X and are not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.

处理将命令改成下面(因为/srv/gitlab 不在docker中的共享目录中, 查看和配置 Docker -> Preferences... -> File Sharing)

sudo docker run --detach \
    --hostname gitlab.example.com \
    --publish 44301:443 --publish 8001:80 --publish 2201:22 \
    --name gitlab \
    --restart always \
    --volume ~/gitlab/config:/etc/gitlab \
    --volume ~/gitlab/logs:/var/log/gitlab \
    --volume ~/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

error02-出现错误

docker: Error response from daemon: Conflict. The container name "/gitlab" is already in use by container "aeddc3ded0840b39404b8117d0d95f9c7cff7533cd9f3f582e7415e6991f3ffc". You have to remove (or rename) that container to be able to reuse that name.

因为容器在运行中 name名字不能有重复的, docker stop gitlab && docker rm gitlab 就OK了.

error01的错误修改好后, docker 就可以运行了, 马上访问下http://127.0.0.1:8001 无法打开???

这个时候容器还在启动中docker ps查下状态Up 48 seconds (health: starting), 直到状态变成Up 5 minutes (healthy), 这时再次访问, 就打开了界面. 第一次访问需要设置root密码.

相关资料

gitlab-self

官方文档-GitLab Docker images
在Mac OS X中用Docker部署GitLab

待处理及待测试资料

关于gitlab汉化问题

GitLab快速搭建及中文汉化
快速安装 GitLab 并汉化

docker-gitlab 汉化版-未测试: https://github.com/beginor/docker-gitlab-ce