Gitlab-ce и Registry [docker-compose] - PullRequest
       11

Gitlab-ce и Registry [docker-compose]

0 голосов
/ 12 декабря 2018

Я пытаюсь создать gitlab с реестром через docker-compose.yml

Я следовал инструкциям и руководствам, я много пробовал, но все же мне не удалось заставить его работать.

guide :

сначала сгенерируйте ключ

sudo mkdir -p certs
sudo openssl req \
  -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key \
  -x509 -days 365 -out certs/domain.crt
(note CN must be same as hostname)

, затем создайте docker-compose.yaml и запустите sudo docker-compose up

version: '3'

services:
  gitlab:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    hostname: 'example.customsite.com'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://example.customsite.com/'
        registry_external_url 'https://example.customsite.com:4443'
        #gitlab_rails['registry_api_url'] = "https://example.customsite.com:4443"

        registry_nginx['ssl_certificate'] = "/etc/gitlab/ssl/example.customsite.com.crt"
        registry_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/example.customsite.com.key"

        gitlab_rails['lfs_enabled'] = true;
        gitlab_rails['registry_path'] = "/etc/registry"

        # Add any other gitlab.rb configuration here, each on its own line
    ports:
      - '8080:80'
      - '443:443'
      - '2222:22'
    volumes:
      - ./certs:/etc/gitlab/ssl/
      - ./srv/gitlab/config:/etc/gitlab
      - ./srv/gitlab/logs:/var/log/gitlab
      - ./srv/gitlab/data:/var/opt/gitlab
      - ./registry:/etc/registry


  registry:
    image: registry:2
    restart: always
    environment:
      REGISTRY_HTTP_ADDR: 0.0.0.0:443
      REGISTRY_HTTP_TLS_CERTIFICATE: '/certs/example.customsite.com.crt'
      REGISTRY_HTTP_TLS_KEY: '/certs/example.customsite.com.key'
      STORAGE_PATH: '/registry'
    ports:
      - 443:443
    volumes:
      - './certs:/certs'
      - './registry:/registry'

Проблема

Чтобы я мог использовать реестр (push / pull), проверьте с помощью URL https://example.customsite.com:4443/v2/_catalog, существуют ли изображения, но ничего в репозитории на сайте gitlab.

, но если я добавлю gitlab_rails['registry_api_url'] = "https://example.customsite.com:4443" в gitlab environment docker-compose, я получу код ошибки 500, когда я пытаюсь получить доступ к реестру из репозитория, и в журналах я вижу, что

gitlab_1    | Started GET "/root/test/container_registry" for *.*.*.* at 2018-12-12 13:37:40 +0000
gitlab_1    | Processing by Projects::Registry::RepositoriesController#index as HTML
gitlab_1    |   Parameters: {"namespace_id"=>"root", "project_id"=>"test"}
gitlab_1    | Completed 500 Internal Server Error in 288ms (ActiveRecord: 5.5ms)
gitlab_1    |
gitlab_1    | Faraday::ConnectionFailed (Failed to open TCP connection to registry:4443 (Connection refused - connect(2) for "registry" port 4443)):
gitlab_1    |   lib/container_registry/client.rb:21:in `repository_tags'
gitlab_1    |   app/models/container_repository.rb:38:in `manifest'
gitlab_1    |   app/models/container_repository.rb:43:in `tags'
gitlab_1    |   app/models/container_repository.rb:55:in `has_tags?'
gitlab_1    |   lib/gitlab/metrics/instrumentation.rb:159:in `block in has_tags?'
gitlab_1    |   lib/gitlab/metrics/method_call.rb:34:in `measure'
gitlab_1    |   lib/gitlab/metrics/instrumentation.rb:159:in `has_tags?'
gitlab_1    |   app/controllers/projects/registry/repositories_controller.rb:46:in `block (2 levels) in ensure_root_container_repository!'
gitlab_1    |   app/controllers/projects/registry/repositories_controller.rb:45:in `tap'
gitlab_1    |   app/controllers/projects/registry/repositories_controller.rb:45:in `block in ensure_root_container_repository!'
gitlab_1    |   app/controllers/projects/registry/repositories_controller.rb:42:in `tap'
gitlab_1    |   app/controllers/projects/registry/repositories_controller.rb:42:in `ensure_root_container_repository!'
gitlab_1    |   lib/gitlab/i18n.rb:55:in `with_locale'
gitlab_1    |   lib/gitlab/i18n.rb:61:in `with_user_locale'
gitlab_1    |   app/controllers/application_controller.rb:419:in `set_locale'
gitlab_1    |   lib/gitlab/middleware/multipart.rb:101:in `call'
gitlab_1    |   lib/gitlab/request_profiler/middleware.rb:14:in `call'
gitlab_1    |   lib/gitlab/middleware/go.rb:17:in `call'
gitlab_1    |   lib/gitlab/etag_caching/middleware.rb:11:in `call'
gitlab_1    |   lib/gitlab/middleware/rails_queue_duration.rb:22:in `call'
gitlab_1    |   lib/gitlab/metrics/rack_middleware.rb:15:in `block in call'
gitlab_1    |   lib/gitlab/metrics/transaction.rb:53:in `run'
gitlab_1    |   lib/gitlab/metrics/rack_middleware.rb:15:in `call'
gitlab_1    |   lib/gitlab/middleware/read_only/controller.rb:38:in `call'
gitlab_1    |   lib/gitlab/middleware/read_only.rb:16:in `call'
gitlab_1    |   lib/gitlab/middleware/basic_health_check.rb:25:in `call'
gitlab_1    |   lib/gitlab/request_context.rb:20:in `call'
gitlab_1    |   lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
gitlab_1    |   lib/gitlab/middleware/release_env.rb:10:in `call'

Я пробовал также, что https://gitlab.com/gitlab-org/gitlab-ce/issues/32990

...