几周前,我在 Traefik 代理后面的 Docker 环境中设置了 Gitlab(包括 Gitlab CI),一切都很完美。 2天前,我尝试通过扩展GITLAB_OMNIBUS_CONFIG环境变量(并称为
docker exec -it gitlab-ce gitlab-ctl reconfigure
)来启用Gitlab注册表。
侧面信息: 通过这一步,我以某种方式破坏了 gitlab,因为由于 Letsencrypt 错误,它后来没有出现(在我的情况下,SSL 已经在 Traefik 代理处终止 - Gitlab 在代理后面,因此不需要 SSL)。 于是我尝试恢复之前的备份。 不幸的是,从那时起我只收到权限错误。
这是我的 docker-compose.yml: https://gist.github.com/JuKu/68727dfd4f627ac66e1b9607cbc0b995
这是错误消息:
gitlab-ce | 2024-03-20_16:43:10.05166 from /opt/gitlab/embedded/bin/bundle:25:in `<main>'
gitlab-ce | 2024-03-20_16:43:10.05167 /opt/gitlab/embedded/lib/ruby/gems/3.1.0/gems/pg-1.5.4/lib/pg/connection.rb:819:in `connect_start': connection to server on socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432" failed: Permission denied (PG::ConnectionBad)
[...]
gitlab-ce | ==> /var/log/gitlab/postgresql/current <==
gitlab-ce | 2024-03-20_16:43:10.08876 PANIC: could not open file "global/pg_control": Permission denied
gitlab-ce |
gitlab-ce | ==> /var/log/gitlab/gitlab-workhorse/current <==
gitlab-ce | {"correlation_id":"","duration_ms":0,"error":"badgateway: failed to receive response: dial unix /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket: connect: connection refused","level":"error","method":"GET","msg":"","time":"2024-03-20T16:43:10Z","uri":""}
gitlab-ce | {"correlation_id":"01HSEBXHQBRD9ETFSEMQYF1YBY","duration_ms":0,"error":"badgateway: failed to receive response: dial unix /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket: connect: connection refused","level":"error","method":"GET","msg":"","time":"2024-03-20T16:43:10Z","uri":"/help"}
gitlab-ce | {"content_type":"text/html; charset=utf-8","correlation_id":"01HSEBXHQBRD9ETFSEMQYF1YBY","duration_ms":0,"host":"gitlab.studymj.de","level":"info","method":"GET","msg":"access","proto":"HTTP/1.1","referrer":"","remote_addr":"127.0.0.1:0","remote_ip":"127.0.0.1","route":"","status":502,"system":"http","time":"2024-03-20T16:43:10Z","ttfb_ms":0,"uri":"/help","user_agent":"curl/8.6.0-DEV","written_bytes":3216}
gitlab-ce |
gitlab-ce | ==> /var/log/gitlab/nginx/gitlab_access.log <==
gitlab-ce | 127.0.0.1 - - [20/Mar/2024:16:43:10 +0000] "GET /help HTTP/1.1" 502 3216 "" "curl/8.6.0-DEV" -
gitlab-ce |
gitlab-ce | ==> /var/log/gitlab/postgres-exporter/current <==
gitlab-ce | 2024-03-20_16:43:10.90117 ts=2024-03-20T16:43:10.901Z caller=server.go:74 level=info msg="Established new database connection" fingerprint=/var/opt/gitlab/postgresql:5432
gitlab-ce | 2024-03-20_16:43:10.90172 ts=2024-03-20T16:43:10.901Z caller=collector.go:176 level=error msg="Error opening connection to database" err="error querying postgresql version: dial unix /var/opt/gitlab/postgresql/.s.PGSQL.5432: connect: permission denied"
gitlab-ce |
gitlab-ce | ==> /var/log/gitlab/postgresql/current <==
gitlab-ce | 2024-03-20_16:43:11.09523 PANIC: could not open file "global/pg_control": Permission denied
gitlab-ce |
gitlab-ce | ==> /var/log/gitlab/puma/current <==
gitlab-ce | 2024-03-20_16:43:11.59964 {"timestamp":"2024-03-20T16:43:11.592Z","pid":856,"message":"Puma starting in cluster mode..."}
gitlab-ce | 2024-03-20_16:43:11.59969 {"timestamp":"2024-03-20T16:43:11.599Z","pid":856,"message":"* Puma version: 6.4.0 (ruby 3.1.4-p223) (\"The Eagle of Durango\")"}
gitlab-ce | 2024-03-20_16:43:11.59972 {"timestamp":"2024-03-20T16:43:11.599Z","pid":856,"message":"* Min threads: 4"}
gitlab-ce | 2024-03-20_16:43:11.59977 {"timestamp":"2024-03-20T16:43:11.599Z","pid":856,"message":"* Max threads: 4"}
gitlab-ce | 2024-03-20_16:43:11.59979 {"timestamp":"2024-03-20T16:43:11.599Z","pid":856,"message":"* Environment: production"}
gitlab-ce | 2024-03-20_16:43:11.59990 {"timestamp":"2024-03-20T16:43:11.599Z","pid":856,"message":"* Master PID: 856"}
gitlab-ce | 2024-03-20_16:43:11.59995 {"timestamp":"2024-03-20T16:43:11.599Z","pid":856,"message":"* Workers: 8"}
gitlab-ce | 2024-03-20_16:43:11.60001 {"timestamp":"2024-03-20T16:43:11.599Z","pid":856,"message":"* Restarts: (✔️) hot (✖️) phased"}
gitlab-ce | 2024-03-20_16:43:11.60005 {"timestamp":"2024-03-20T16:43:11.600Z","pid":856,"message":"* Preloading application"}
gitlab-ce |
gitlab-ce | ==> /var/log/gitlab/postgres-exporter/current <==
gitlab-ce | 2024-03-20_16:43:11.90192 ts=2024-03-20T16:43:11.901Z caller=postgres_exporter.go:682 level=error err="Error opening connection to database (host=/var/opt/gitlab/postgresql%20user=gitlab-psql%20database=gitlabhq_production): dial unix /var/opt/gitlab/postgresql/.s.PGSQL.5432: connect: permission denied"
gitlab-ce |
gitlab-ce | ==> /var/log/gitlab/alertmanager/current <==
gitlab-ce | 2024-03-20_16:43:12.02749 ts=2024-03-20T16:43:12.027Z caller=cluster.go:700 level=info component=cluster msg="gossip settled; proceeding" elapsed=10.004737016s
gitlab-ce |
gitlab-ce | ==> /var/log/gitlab/postgresql/current <==
[...]
gitlab-ce | 2024-03-20_16:43:12.10113 PANIC: could not open file "global/pg_control": Permission denied
有人可以帮助我吗? :)
我已经尝试过以下方法(仅摘录,不完整):
docker exec -it gitlab-ce gitlab-ctl reconfigure
--> 没有解决任何问题cp --no-preserve=mode,ownership /opt/docker/volumes/<Backup> /opt/docker/volumes/gitlab
将文件从备份复制到新卷而不覆盖文件权限
--> 它不起作用,它没有改变任何东西。docker exec -it gitlab-ce gitlab-ctl reconfigure
--> 它不起作用,它没有改变任何东西。现在我有点不知所措。 已经谢谢你了! :)
我通过调用
docker exec -it gitlab-ce update-permissions
解决了问题。
不管怎么说,还是要谢谢你! :)