GitLab SMTP配置例外(GitLab SMTP config exception)

2019-10-21 04:53发布

我使用SMTP想安装GitLab电子邮件通知。
我有GitLab 7.4.3关于Ruby 2.1.2p95来说,Rails 4.1.1。
我跟着这些指示和提出的smtp_settings.rb.example以下方式复制:

sudo cp /opt/gitlab/embedded/service/gitlab-railsconfig/initializers/smtp_settings.rb.sample /opt/gitlab/embedded/service/gitlab-railsconfig/initializers/smtp_settings.rb

现在,当我尝试运行:

sudo gitlab-ctl reconfigure

我得到以下异常:

Starting Chef Client, version 11.12.2
Compiling Cookbooks...
Recipe: gitlab::default
  * directory[/etc/gitlab] action create (up to date)
[2014-10-31T17:53:57-04:00] WARN: Cloning resource attributes for directory[/var/opt/gitlab] from prior resource (CHEF-3694)
[2014-10-31T17:53:57-04:00] WARN: Previous directory[/var/opt/gitlab]: /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb:40:in `from_file'
[2014-10-31T17:53:57-04:00] WARN: Current  directory[/var/opt/gitlab]: /opt/gitlab/embedded/cookbooks/gitlab/recipes/users.rb:23:in `from_file'
[2014-10-31T17:54:02-04:00] WARN: Cloning resource attributes for directory[/var/opt/gitlab/gitlab-rails/etc] from prior resource (CHEF-3694)
[2014-10-31T17:54:02-04:00] WARN: Previous directory[/var/opt/gitlab/gitlab-rails/etc]: /opt/gitlab/embedded/cookbooks/gitlab/recipes/gitlab-rails.rb:36:in `block in from_file'
[2014-10-31T17:54:02-04:00] WARN: Current  directory[/var/opt/gitlab/gitlab-rails/etc]: /opt/gitlab/embedded/cookbooks/gitlab/definitions/unicorn_config.rb:21:in `block in from_file'
[2014-10-31T17:54:02-04:00] WARN: Cloning resource attributes for service[unicorn] from prior resource (CHEF-3694)
[2014-10-31T17:54:02-04:00] WARN: Previous service[unicorn]: /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb:60:in `block in from_file'
[2014-10-31T17:54:02-04:00] WARN: Current  service[unicorn]: /opt/gitlab/embedded/cookbooks/runit/definitions/runit_service.rb:191:in `block in from_file'
[2014-10-31T17:54:02-04:00] WARN: Cloning resource attributes for service[sidekiq] from prior resource (CHEF-3694)
[2014-10-31T17:54:02-04:00] WARN: Previous service[sidekiq]: /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb:60:in `block in from_file'
[2014-10-31T17:54:02-04:00] WARN: Current  service[sidekiq]: /opt/gitlab/embedded/cookbooks/runit/definitions/runit_service.rb:191:in `block in from_file'
Converging 176 resources
  * directory[/etc/gitlab] action nothing (skipped due to action :nothing)
  * directory[/var/opt/gitlab] action create (up to date)
Recipe: gitlab::users
  * directory[/var/opt/gitlab] action create (up to date)
  * group[git] action create (up to date)
  * user[git] action create (up to date)
  * template[/var/opt/gitlab/.gitconfig] action create (up to date)
Recipe: gitlab::web-server
  * group[gitlab-www] action create (up to date)
  * user[gitlab-www] action create (up to date)
Recipe: gitlab::gitlab-shell
  * directory[/var/opt/gitlab/git-data/repositories] action create (up to date)
  * directory[/var/opt/gitlab/.ssh] action create (up to date)
  * file[/var/opt/gitlab/.ssh/authorized_keys] action create (up to date)
  * file[/opt/gitlab/embedded/service/gitlab-shell/authorized_keys.lock] action create (up to date)
  * execute[chcon --recursive --type ssh_home_t /var/opt/gitlab/.ssh] action run (skipped due to only_if)
  * directory[/var/log/gitlab/gitlab-shell/] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-shell] action create (up to date)
  * directory[/var/opt/gitlab/git-data] action create (up to date)
  * template[/var/opt/gitlab/gitlab-shell/config.yml] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-shell/config.yml] action create (up to date)
Recipe: gitlab::gitlab-rails
  * directory[/var/opt/gitlab/gitlab-rails/etc] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/working] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/tmp] action create (up to date)
  * directory[/var/opt/gitlab/backups] action create (up to date)
  * directory[/var/log/gitlab/gitlab-rails] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/uploads] action create (up to date)
  * directory[/opt/gitlab/etc/gitlab-rails/env] action create (up to date)
  * template[/opt/gitlab/etc/gitlab-rails/gitlab-rails-rc] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/secret] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/.secret] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/database.yml] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/database.yml] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/resque.yml] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/resque.yml] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/aws.yml] action delete (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/aws.yml] action delete (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/smtp_settings.rb] action delete (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb] action delete
    * Cannot delete link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb] at /opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb! Not a symbolic link.
================================================================================
Error executing action `delete` on resource 'link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb]'
================================================================================


Chef::Exceptions::Link
----------------------
Cannot delete link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb] at /opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb! Not a symbolic link.


Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/gitlab/definitions/template_symlink.rb

 33:   link params[:link_from] do
 34:     to params[:name]
 35:     action params[:action]
 36:   end
 37: end



Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/gitlab/definitions/template_symlink.rb:33:in `block in from_file'

link("/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb") do
  params {:link_from=>"/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb", :source=>nil, :owner=>"root", :group=>"root", :mode=>"0644", :variables=>{"dir"=>"/var/opt/gitlab/gitlab-rails", "log_directory"=>"/var/log/gitlab/gitlab-rails", "environment"=>"production", "env"=>{"BUNDLE_GEMFILE"=>"/opt/gitlab/embedded/service/gitlab-rails/Gemfile", "PATH"=>"/opt/gitlab/bin:/opt/gitlab/embedded/bin:/bin:/usr/bin"}, "internal_api_url"=>nil, "uploads_directory"=>"/var/opt/gitlab/gitlab-rails/uploads", "rate_limit_requests_per_period"=>10, "rate_limit_period"=>60, "gitlab_host"=>"localhost", "gitlab_port"=>80, "gitlab_https"=>false, "gitlab_ssh_host"=>nil, "gitlab_email_from"=>"gitlab@localhost", "gitlab_default_projects_limit"=>nil, "gitlab_default_can_create_group"=>nil, "gitlab_username_changing_enabled"=>nil, "gitlab_default_theme"=>nil, "gitlab_signup_enabled"=>nil, "gitlab_signin_enabled"=>nil, "gitlab_restricted_visibility_levels"=>nil, "gitlab_default_projects_features_issues"=>nil, "gitlab_default_projects_features_merge_requests"=>nil, "gitlab_default_projects_features_wiki"=>nil, "gitlab_default_projects_features_wall"=>nil, "gitlab_default_projects_features_snippets"=>nil, "gitlab_default_projects_features_visibility_level"=>nil, "gitlab_repository_downloads_path"=>nil, "issues_tracker_redmine"=>false, "issues_tracker_redmine_title"=>"Redmine", "issues_tracker_redmine_project_url"=>"http://redmine.sample/projects/:issues_tracker_id", "issues_tracker_redmine_issues_url"=>"http://redmine.sample/issues/:id", "issues_tracker_redmine_new_issue_url"=>"http://redmine.sample/projects/:issues_tracker_id/issues/new", "issues_tracker_jira"=>false, "issues_tracker_jira_title"=>"Atlassian Jira", "issues_tracker_jira_project_url"=>"http://jira.sample/issues/?jql=project=:issues_tracker_id", "issues_tracker_jira_issues_url"=>"http://jira.sample/browse/:id", "issues_tracker_jira_new_issue_url"=>"http://jira.sample/secure/CreateIssue.jspa", "gravatar_enabled"=>true, "gravatar_plain_url"=>nil, "gravatar_ssl_url"=>nil, "ldap_enabled"=>false, "ldap_servers"=>[], "ldap_host"=>nil, "ldap_base"=>nil, "ldap_port"=>nil, "ldap_uid"=>nil, "ldap_method"=>nil, "ldap_bind_dn"=>nil, "ldap_password"=>nil, "ldap_allow_username_or_email_login"=>nil, "ldap_user_filter"=>nil, "ldap_group_base"=>nil, "ldap_admin_group"=>nil, "ldap_sync_ssh_keys"=>nil, "ldap_sync_time"=>nil, "ldap_active_directory"=>nil, "omniauth_enabled"=>false, "omniauth_allow_single_sign_on"=>nil, "omniauth_block_auto_created_users"=>nil, "omniauth_providers"=>[], "satellites_path"=>"/var/opt/gitlab/git-data/gitlab-satellites", "satellites_timeout"=>nil, "backup_path"=>"/var/opt/gitlab/backups", "backup_keep_time"=>nil, "backup_upload_connection"=>nil, "backup_upload_remote_directory"=>nil, "gitlab_shell_path"=>"/opt/gitlab/embedded/service/gitlab-shell/", "gitlab_shell_repos_path"=>"/var/opt/gitlab/git-data/repositories", "gitlab_shell_hooks_path"=>"/opt/gitlab/embedded/service/gitlab-shell/hooks/", "gitlab_shell_upload_pack"=>nil, "gitlab_shell_receive_pack"=>nil, "gitlab_shell_ssh_port"=>nil, "git_bin_path"=>"/opt/gitlab/embedded/bin/git", "git_max_size"=>nil, "git_timeout"=>nil, "extra_google_analytics_id"=>nil, "extra_piwik_url"=>nil, "extra_piwik_site_id"=>nil, "extra_sign_in_text"=>nil, "aws_enable"=>false, "aws_access_key_id"=>nil, "aws_secret_access_key"=>nil, "aws_bucket"=>nil, "aws_region"=>nil, "db_adapter"=>"postgresql", "db_encoding"=>"unicode", "db_database"=>"gitlabhq_production", "db_pool"=>10, "db_username"=>"gitlab", "db_password"=>nil, "db_host"=>nil, "db_port"=>5432, "db_socket"=>nil, "redis_host"=>"127.0.0.1", "redis_port"=>nil, "redis_socket"=>"/var/opt/gitlab/redis/redis.socket", "smtp_enable"=>false, "smtp_address"=>nil, "smtp_port"=>nil, "smtp_user_name"=>nil, "smtp_password"=>nil, "smtp_domain"=>nil, "smtp_authentication"=>nil, "smtp_enable_starttls_auto"=>nil, "smtp_tls"=>nil, "smtp_openssl_verify_mode"=>nil, "webhook_timeout"=>nil, "root_password"=>nil, "secret_token"=>"f7e2400b922a15a85f1d82bed2f6ffa04db35e70f50850c0556a7b6e557ccb6457cae601519e0c2ec5b069ae651a6de6d053db9e1728d81a9b10119ca967fdde"}, :helpers=>nil, :notifies=>nil, :restarts=>["service[unicorn]", "service[sidekiq]"], :action=>:delete, :name=>"/var/opt/gitlab/gitlab-rails/etc/smtp_settings.rb"}
  provider Chef::Provider::Link
  action [:delete]
  retries 0
  retry_delay 2
  guard_interpreter :default
  to "/var/opt/gitlab/gitlab-rails/etc/smtp_settings.rb"
  link_type :symbolic
  target_file "/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb"
  cookbook_name :gitlab
  recipe_name "gitlab-rails"
end




Running handlers:
[2014-10-31T17:54:05-04:00] ERROR: Running exception handlers
Running handlers complete

[2014-10-31T17:54:05-04:00] ERROR: Exception handlers complete
[2014-10-31T17:54:05-04:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 13.264773272 seconds
[2014-10-31T17:54:05-04:00] ERROR: link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb] (gitlab::gitlab-rails line 33) had an error: Chef::Exceptions::Link: Cannot delete link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb] at /opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb! Not a symbolic link.
[2014-10-31T17:54:05-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Answer 1:

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md

编辑/etc/gitlab/gitlab.rb文件,以配合您的SMTP服务器的设置和凭据。

gitlab_rails['smtp_enable'] = true  
gitlab_rails['smtp_address'] = "smtp.server"  
gitlab_rails['smtp_port'] = 456  
gitlab_rails['smtp_user_name'] = "smtp user"  
gitlab_rails['smtp_password'] = "smtp password"  
gitlab_rails['smtp_domain'] = "example.com"  
gitlab_rails['smtp_authentication'] = "login"  
gitlab_rails['smtp_enable_starttls_auto'] = true
# If your SMTP server does not like the default 'From: gitlab@localhost' you
# can change the 'From' with this setting.
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'  

然后运行sudo gitlab-ctl reconfigure



文章来源: GitLab SMTP config exception