gitlab 管理员

好风 发表于 2017-02-04T03:11:32.093677Z
引用地址:https://plus.ooclab.com/note/article/1340

配置

使用外部的 OpenID 验证

应用

monitor

  • https://github.com/timoschwarzer/gitlab-monitor
  • https://gitlab.com/car2go/birdperson

FAQ

Fingerprint has already been taken

如果我们增加一个 public key 时,出现以下错误:

The form contains the following error:

    Fingerprint has already been taken

这是因为已经有用户添加过这个 key 。通过下面方法可以查看是哪个用户添加的该 key 。

1、 获取该 key 的 fingerprint

# ssh-keygen -lf ~/.ssh_bak/id_rsa.pub 
4096 e3:24:57:c3:cc:69:7b:33:a7:1a:17:72:10:3b:c4:2e  root@localhost (RSA)

2、 进入 postgresql 数据库(我的 gitlab 使用 docker 运行,默认配置 pg 数据库)

# su - gitlab-psql
$ /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production    
psql (9.2.18)
Type "help" for help.

gitlabhq_production=# select id, user_id from keys where fingerprint LIKE 'e3:24:57:c3:cc:69:7b:33:a7:1a:17:72:10:3b:c4:2e';
 id | user_id 
----+---------
 12 |       3
(1 row)

gitlabhq_production=# select * from users where id=3;

要求 /var/opt/gitlab/git-data/repositories 目录权限为 2770

Configuring GitLab...

================================================================================
Error executing action `run` on resource 'ruby_block[directory resource: /var/opt/gitlab/git-data/repositories]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Failed asserting that mode permissions on "/var/opt/gitlab/git-data/repositories" is 2770
---- Begin output of set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] ----
STDOUT: 
STDERR: + grep -o ....$
+ readlink -f /var/opt/gitlab/git-data/repositories
+ stat --printf=%04a /var/opt/gitlab/git-data/repositories
+ [ 0770 = 2770 ]
---- End output of set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] ----
Ran set -x && [ "$(stat --printf='%04a' $(readlink -f /var/opt/gitlab/git-data/repositories) | grep -o '....$')" = '2770' ] returned 1

修改该目录权限即可:

chmod 2770 /var/opt/gitlab/git-data/repositories

gitlab-rails/sockets/gitlab.socket 文件已经存在

Kubernetes 中使用 helm 部署 gitlab , 如果delete,会导致 gitlab.socket 一类 临时文件不被删除(kurbenetes强制gitlab容器退出),因此下次启动会有错误。处理方式直接删除该文件即可:

rm /data/nfsdata/default-gitlab-data-claim-pvc-27bd310c-bfe2-11e7-b9d7-00163e0aacc0/gitlab-rails/sockets/gitlab.socket