SMTP config not being applied in docker
Summary
It is not currently possible to get a working SMTP (external) config working. Either via the gitlab.rb, or via docker environment variables.
Steps to reproduce
Uncomment and attempt to use any smtp settings, and run gitlab-ctl reconfigure
, then run gitlab-rails console production
, followed by ActionMailer::Base.delivery_method
. This will show :sendmail
.
For environment variable issue: Pass relevant smtp settings to docker via environment variable (as described here). Re-comment out any smtp lines from gitlab.rb if you uncommented them above. Run the docker. Error after trying to compile cookbooks.
What is the current bug behavior?
(What actually happens)
What is the expected correct behavior?
Either ruby would be showing smtp correctly with just the .rb edits (and thus send mail properly to users) OR docker environment variables would not fail to reconfigure at start.
Relevant logs
Relevant logs
RAILS CONSOLE after .rb edit and reconfigureroot@e2aeac57ec5b:/# gitlab-rails console production ------------------------------------------------------------------------------------- GitLab: 11.10.4-ee (88a3c791734) GitLab Shell: 9.0.0 PostgreSQL: 11.2 ------------------------------------------------------------------------------------- Loading production environment (Rails 5.0.7.2) irb(main):001:0> ActionMailer::Base.delivery_method => :sendmailDOCKER after environement variables used:
Thank you for using GitLab Docker Image! Current version: gitlab-ee=11.10.4-ee.0Configure 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
Preparing services... Starting services... Configuring GitLab... /opt/gitlab/embedded/bin/runsvdir-start: line 29: ulimit: open files: 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 Client, version 13.6.4[0m
resolving cookbooks for run list: ["gitlab-ee"][0m Synchronizing Cookbooks:[0m
- gitlab-ee (0.0.1)[0m
- package (0.1.0)[0m
- gitlab (0.0.1)[0m
- consul (0.1.0)[0m
- repmgr (0.1.0)[0m
- runit (4.3.0)[0m
- postgresql (0.1.0)[0m
- redis (0.1.0)[0m
- registry (0.1.0)[0m
- mattermost (0.1.0)[0m
- gitaly (0.1.0)[0m
- letsencrypt (0.1.0)[0m
- nginx (0.1.0)[0m
- acme (3.1.0)[0m
- crond (0.1.0)[0m
- compat_resource (12.19.1)[0m Installing Cookbook Gems:[0m Compiling Cookbooks...[0m [0m ================================================================================[0m [31mRecipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/default.rb[0m
================================================================================[0m
[0mNoMethodError[0m -------------[0m undefined method `nl' for nil:NilClass[0m
[0mCookbook Trace:[0m
---------------[0m
/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:100:in block in from_file' [0m /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/config_mash.rb:28:in
auto_vivify'
[0m /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:100:in from_file' [0m /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb:23:in
from_file'
[0m /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:26:in from_file' [0m /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/default.rb:20:in
from_file'[0m
[0mRelevant File Content:[0m ----------------------[0m /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb: [0m [0m 93: def ee_attribute(name, **config) [0m 94: config = { ee: true }.merge(config) [0m 95: attribute(name, **config) [0m 96: end [0m 97: [0m 98: def from_file(_file_path) [0m 99: # Allow auto mash creation during from_file call [0m100>> Gitlab::ConfigMash.auto_vivify { super } [0m101: end [0m102: [0m103: def method_missing(method_name, *arguments) # rubocop:disable Style/MethodMissing [0m104: # Give better message for NilClass errors [0m105: # If there are no arguements passed, this is a 'GET' call, and if [0m106: # there is no matching key in the configuration, then it has not been set (not even to nil) [0m107: # and we will output a nicer error above the exception
[0m108: if arguments.length.zero? && !configuration.key?(method_name) [0m109: breaktxt = '=' * 80 [0m [0mSystem Info:[0m ------------[0m chef_version=13.6.4 [0mplatform=ubuntu [0mplatform_version=16.04 [0mruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux] [0mprogram_name=/opt/gitlab/embedded/bin/chef-client [0mexecutable=/opt/gitlab/embedded/bin/chef-client[0m
[0m[0m Running handlers:[0m There was an error running gitlab-ctl reconfigure:
undefined method `nl' for nil:NilClass
Running handlers complete [0mChef Client failed. 0 resources updated in 03 seconds[0m
Details of package version
Provide the package version installation details
Docker - 11.10.4-ee/ce
Environment details
- Operating System:
unRAID 6.6.7
- Installation Target, remove incorrect values:
- VM: Other
Docker
- VM: Other
- Installation Type, remove incorrect values:
- New Installation
- Is there any other software running on the machine:
Yes, using external postgres and redis.
- Is this a single or multiple node installation?
- Resources
- CPU:
Threadripper 2990wx
- Memory total:
64GB
- CPU:
Configuration details
Provide the relevant sections of `/etc/gitlab/gitlab.rb`
gitlab_rails['gitlab_email_enabled'] = true gitlab_rails['gitlab_email_from'] = 'gitlab@domain.nl' gitlab_rails['gitlab_email_display_name'] = 'Gitlab' gitlab_rails['gitlab_email_reply_to'] = 'noreply@domain.nl' gitlab_rails['gitlab_email_subject_suffix'] = '' ... gitlab_rails['smtp_enable'] = 'true' gitlab_rails['smtp_address'] = "mail.domain.nl" gitlab_rails['smtp_port'] = '587' gitlab_rails['smtp_user_name'] = "gitlab@domain.nl" gitlab_rails['smtp_password'] = "wordpass" gitlab_rails['smtp_domain'] = "domain.nl" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = 'true' gitlab_rails['smtp_tls'] = 'false' gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
--env GITLAB_OMNIBUS_CONFIG="gitlab_rails['smtp_enable']=true; gitlab_rails['smtp_address']="mail.example.nl"; gitlab_rails['smtp_port']=587; gitlab_rails['smtp_user_name']="gitlab@example.nl"; gitlab_rails['smtp_password']="wordpass"; gitlab_rails['smtp_domain']="example.nl"; gitlab_rails['smtp_authentication']="login";gitlab_rails['smtp_enable_starttls_auto'] = 'true';gitlab_rails['smtp_tls'] = 'false';gitlab_rails['smtp_openssl_verify_mode'] = 'peer';"