DEV Community

WildTuna
WildTuna

Posted on • Edited on

5 3

Ошибка обновления GitLab из-за ошибки обновления Let’s Encrypt

Image description

Столкнулся недавно с проблемой обновления GitLab до версии 12.6 из-за ошибки реконфигурации, вызываемой попыткой обновления сертификата Let’s Encrypt. Так получилось, что обновление пришлось на день, когда был просрочен сертификат. Не беда! Отключаем использование сертификата в /etc/gitlab/gitlab.rb и запускаем реконфигурацию вручную:

nano /etc/gitlab/gitlab.rb
// Находим это строку и выставляем значение false
letsencrypt['enable'] = false
// Сохраняем файл и выполняем реконфигурацию
gitlab-ctl reconfigure
Enter fullscreen mode Exit fullscreen mode

Теперь GitLab успешно применит новые параметры и сможет обновиться. После завершения обновления возвращаем использование Let’s Encrypt в /etc/gitlab/gitlab.rb, снова реконфигурируем GitLab и… снова получаем прежнюю ошибку!

Running handlers:
There was an error running gitlab-ctl reconfigure:
letsencrypt_certificate[git.hostname.com] (letsencrypt::http_authorization line 5) had an error: RuntimeError: acme_certificate[staging] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/letsencrypt/resources/certificate.rb line 25) had an error: RuntimeError: ruby_block[create certificate for git.lapaygroup.ru] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/acme/resources/certificate.rb line 108) had an error: RuntimeError: [git.hostname.com] Validation failed, unable to request certificate
Enter fullscreen mode Exit fullscreen mode

Огорченный полез гуглить. Оказалось, проблема не только у меня, но четкого решения проблемы нет. После пары часов изучения баг-трекера GitLab и тщетных попыток устранить проблему мой рецепт решения был найден, и он очень простой:

  1. проверить, что порты 80 и 443 открыты;
  2. проверить домен на сайте Let’s Encrypt;
  3. установить параметры в /etc/gitlab/gitlab.rb: nginx[‘redirect_http_to_https’] = true nginx[‘redirect_http_to_https_port’] = 80
  4. удалить файлы проблемного сертификата из папки /etc/gitlab/ssl;
  5. запросить новый сертификат: gitlab-ctl renew-le-certs.

В моем случае оказался закрыт 80 порт и что-то случилось с правами на файлы сертификата в /etc/gitlab/ssl — при обновлении GitLab не мог их заменить.

Надеюсь, мой рецепт поможет решить проблему и вам!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay