Active Directory Setup - 502 Gitlab is not responding

Modified /etc/gitlab/gitlab.rb with the following configuration.

indent preformatted text by 4 spacesgitlab_rails[‘ldap_enabled’] = true
gitlab_rails[‘ldap_servers’] = YAML.load <<-EOS # remember to close this block with ‘EOS’ below

main: # ‘main’ is the GitLab ‘provider ID’ of this LDAP server

 label: 'Active Directory'
 host: '192.168.1.10'
 port: 636
 uid: 'sAMAccountName'
 method: 'ssl' # "tls" or "ssl" or "plain"
 bind_dn: 'CN=git LDAP,CN=Users,DC=dev,DC=domain,DC=com'
 password: 'myBadPassword'
 active_directory: true
 allow_username_or_email_login: false
 base: 'CN=Users,DC=dev,DC=domain,DC=com'

After restarting gitlib, the 502 Gitlab is not responding now shows and prevents any logins.

I have searched through the logs, but not yielding anything that eludes to what the error might be.

Any hints, directions, etc would be helpful.

T

I have this very same issue? Any resolution? It would be extremely helpful for me if you posted your solution.

Eric

I was having the same issue and the resolution for me was proper white space in the gitlab.yml under the LDAP section. In fact, I’m using the omnibus installation so I made my configuration file changes in the /etc/gitlab/gitlab.rb file and then run gitlab-ctl reconfigure to generate the gitlab.yml.

I traced the cause of my problem though the unicorn std-err log which pointed to the file /opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb

The error message was:
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb:108:in block in <top (required)>': undefined method ’ for nil:NilClass (NoMethodError)
from /opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb:107:in each' from /opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb:107:in <top (required)>’
from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/dependencies.rb:241:in load' from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/dependencies.rb:241:in block in load’
from /opt/gitlab/embedded/service/gem/ruby/2.1.0

The code under this section is looking at the ldap settings. In googled the error message and I found a reference to proper white space settings in the gitlab.yml file. I indented the section as follows (spaces, not TABS):

main: # ‘main’ is the GitLab ‘provider ID’ of this LDAP server
label: ‘LDAP’
host: ‘my_ad.mycorp.com’
port: 389
uid: ‘sAMAccountName’
method: ‘plain’ # “tls” or “ssl” or “plain”
bind_dn: ‘CN=svn bind,OU=Service Accounts,OU=RAL,OU=Users,OU=ID,DC=IDCorp,DC=com’
password: ‘xxx’
base: ‘OU=Users,OU=ID,DC=IDCorp,DC=com’

I reran gitlab-ctl reconfigure and it was fine.

the post stripped my white space in the configuration file section above

gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
   main: # 'main' is the GitLab 'provider ID' of this LDAP server
       label: 'LDAP'
       host: 'my_ad.mycorp.com'
       port: 389
       uid: 'sAMAccountName'
       method: 'plain' # "tls" or "ssl" or "plain"
       bind_dn: 'CN=svn bind,OU=Service Accounts,OU=RAL,OU=Users,OU=ID,DC=IDCorp,DC=com'
       password: 'xxx'
       base: 'OU=Users,OU=ID,DC=IDCorp,DC=com'
EOS