Gitlab CE 在 Dockerised Nginx 反向代理设置后给出 502 Bad Gateway

Gitlab CE 在 Dockerised Nginx 反向代理设置后给出 502 Bad Gateway

我遵循了流行的 Dockerised Nginx 反向代理设置我的 VPS 可以以容器化方式托管多个网站或应用程序。目前,它运行良好,我可以提供我的静态内容。

虽然目前我正在将 Gitlab 再次设置为容器化,但是502 Bad Gateway当我启动容器后访问 URL 时,它总是出现错误并失败。

docker-compose.yml

version: "3"

services:
  gitlab:
    image: gitlab/gitlab-ce:latest
    container_name: gitlab
    restart: unless-stopped
    expose:
      - 80
    hostname: "gitlab.mydomain.com"
    environment:
      VIRTUAL_HOST: gitlab.mydomain.com
      LETSENCRYPT_HOST: gitlab.mydomain.com
      LETSENCRYPT_EMAIL: [email protected]
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://gitlab.mydomain.com'
    volumes:
      - /srv/gitlab/config:/etc/gitlab
      - /srv/gitlab/logs:/var/log/gitlab
      - /srv/gitlab/data:/var/opt/gitlab

networks:
  default:
    external:
      name: nginx-proxy

当我检查容器的日志时,这里是完整的日志,但基本上它是在抱怨external_url未正确设置,并且Chef Intra Client无法启动。

================================================================================
Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb
================================================================================
RuntimeError
------------
GitLab external URL must include a schema and FQDN, e.g. http://gitlab.example.com/
Cookbook Trace:
---------------
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/gitlab_rails.rb:105:in `parse_external_url'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/gitlab_rails.rb:36:in `parse_variables'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:187:in `block in generate_config'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:185:in `each'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:185:in `generate_config'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb:24:in `from_file'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:26:in `from_file'
Relevant File Content:
----------------------
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/gitlab_rails.rb:

 98:      end
 99:  
100:      def parse_external_url
101:        return unless Gitlab['external_url']
102:  
103:        uri = URI(Gitlab['external_url'].to_s)
104:  
105>>       raise "GitLab external URL must include a schema and FQDN, e.g. http://gitlab.example.com/" unless uri.host
106:  
107:        Gitlab['user']['git_user_email'] ||= "gitlab@#{uri.host}"
108:        Gitlab['gitlab_rails']['gitlab_host'] = uri.host
109:        Gitlab['gitlab_rails']['gitlab_email_from'] ||= "gitlab@#{uri.host}"
110:  
111:        case uri.scheme
112:        when "http"
113:          Gitlab['gitlab_rails']['gitlab_https'] = false
114:          Nginx.parse_proxy_headers('nginx', false)

System Info:
------------
chef_version=15.14.0
platform=ubuntu
platform_version=16.04
ruby=ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
program_name=/opt/gitlab/embedded/bin/chef-client
executable=/opt/gitlab/embedded/bin/chef-client

Running handlers:
Running handlers complete
Chef Infra Client failed. 0 resources updated in 05 seconds
There was an error running gitlab-ctl reconfigure:
GitLab external URL must include a schema and FQDN, e.g. http://gitlab.example.com/
Thank you for using GitLab Docker Image!
Current version: gitlab-ce=13.7.1-ce.0
Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
And restart this container to reload settings.
To do it use docker exec:
  docker exec -it gitlab vim /etc/gitlab/gitlab.rb
  docker restart gitlab
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
If this container fails to start due to permission problems try to fix it by executing:
  docker exec -it gitlab update-permissions
  docker restart gitlab
Cleaning stale PIDs & sockets
Preparing services...
Starting services...
Configuring GitLab...
/opt/gitlab/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 34: ulimit: max user processes: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
Starting Chef Infra Client, version 15.14.0
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - gitlab (0.0.1)
  - logrotate (0.0.0)
  - redis (0.1.0)
  - registry (0.1.0)
  - mattermost (0.1.0)
  - postgresql (0.1.0)
  - consul (0.1.0)
  - praefect (0.1.0)
  - package (0.1.0)
  - gitlab-pages (0.1.0)
  - letsencrypt (0.1.0)
  - nginx (0.1.0)
  - runit (5.1.3)
  - acme (4.1.1)
  - monitoring (0.1.0)
  - gitaly (0.1.0)
  - crond (0.1.0)
  - gitlab-kas (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...

gitlab.rb通过交互进入容器进行了检查并且external_url设置正确,但由于某种我无法弄清楚的原因,它就是不起作用。

相关内容