docker-compose.yml
version: '2'
services:
web:
image: 'gitlab/gitlab-ce:12.10.14-ce.0'
restart: always
hostname: 'gitlab.inner.xxx.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.inner.xxx.com'
gitlab_rails['gitlab_shell_ssh_port'] = 2224
ports:
- '8089:80'
# - '443:443'
- '2224:22'
extra_hosts:
- "ldap.inner.xxx.com:172.16.xxx.xxx"
volumes:
- './gitlab_data/config:/etc/gitlab'
- './gitlab_data/logs:/var/log/gitlab'
- './gitlab_data/data:/var/opt/gitlab'
然后修改一下gitlab.rb配置文件,集成ldap和修改timezone问题
gitlab.rb
root@gitlab:/# grep -Ev "^$|[#;]" /etc/gitlab/gitlab.rb
gitlab_rails['time_zone'] = 'Asia/Shanghai'
gitlab_rails['ldap_enabled'] = true
gitlab_rails['prevent_ldap_sign_in'] = false
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
label: 'LDAP'
host: 'ldap.inner.abc.com'
port: 389
uid: 'uid'
bind_dn: 'cn=admin,dc=abc,dc=com'
password: 'xxxxx'
active_directory: false
allow_username_or_email_login: true
lowercase_usernames: false
block_auto_created_users: false
base: 'DC=abc,DC=com'
user_filter: ''
attributes:
username: ['uid', 'userid', 'sAMAccountName']
email: ['mail', 'email', 'userPrincipalName']
EOS
修改配置文件后,需要重新加载配置文件
gitlab-ctl reconfigure
检测ldap是否集成成功,如果ldap连接成功的话,可以显示前50名用户。
gitlab-rails gitlab:ldap:check