LDAP 集成gitlab jenkins 以及禅道

1.docker 安装

由于手动部署ldap时间成本太大,故本文章采用docker部署,及本文章账号集成只是可以登录,没有细节分组之类,如有需要,望诸君自行研究

1. curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun  #一键安装docker
2. systemctl start docker  #启动docker

2.LDAP 部署

docker run \
-p 389:389 \
-p 636:636 \
--name your_ldap \
--network bridge \
--hostname openldap-host \
--env LDAP_ORGANISATION="bitshare" \
--env LDAP_DOMAIN="bitshare.com" \
--env LDAP_ADMIN_PASSWORD="123456" \
--detach osixia/openldap
————————————————

其中 -p 389:389 \ TCP/IP访问端口,-p 636:636 \ SSL连接端口。
–name your_ldap 自行设置容器名称
–network bridge 连接默认的bridge网络(docker0)
–hostname openldap-host 设置容器主机名称为 openldap-host
–env LDAP_ORGANISATION=“bitshare” 配置LDAP组织名称
–env LDAP_DOMAIN=“bitshare.com” 配置LDAP域名
–env LDAP_ADMIN_PASSWORD=“123456” 配置LDAP密码
默认登录用户名:admin
————————————————

原文链接:https://blog.csdn.net/qq_41916805/article/details/107206646

使用ldapadmin进行连接ldap服务


image.png

登录LDAP进行创建用户及用户组


image.png
image.png
image.png

创建完账号记得设置密码

3.Jenkins 部署集成

本文章为方便,使用的是jenkins 的war包进行的部署,及本文将gitlab,jenkins 禅道部署在同一台机器上

git-jenkins ]# mkdir /opt/src
git-jenkins ]# cd  /opt/src

# 安装jdk
git-jenkins ]# wget http://file.zhidianjh.com:28085/jdk/jdk-8u221-linux-x64.tar.gz
git-jenkins ]# tar xf jdk-8u221-linux-x64.tar.gz -C /usr/local/
git-jenkins ]# cat >>/etc/profile< 

访问jenkins 登录地址,IP+port 进行首次访问,初始化配置,配置Jenkins 集成ldap


image.png

image.png

保存应用,测试账号是否能登录

4. gitlab搭建

https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ 清华大学源gitlab下载地址

git-jenkins ]# cd /opt/src/
git-jenkins ]# wget http://file.zhidianjh.com:28085/gitlab/gitlab-ce-12.3.0-ce.0.el7.x86_64.rpm
git-jenkins ]# yum localinstall gitlab-ce-12.3.0-ce.0.el7.x86_64.rpm -y
git-jenkins ]# vim /etc/gitlab/gitlab.rb
        external_url 'http://0.0.0.0'  #配置URL
        gitlab_rails['gitlab_email_enabled'] = true
        gitlab_rails['gitlab_email_from'] = "[email protected]"  # 发件邮箱
        gitlab_rails['gitlab_email_display_name'] = 'OldXu-GitLab' # 发件人显示名称
        
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = "smtp.qq.com"
        gitlab_rails['smtp_port'] = 465
        gitlab_rails['smtp_user_name'] = "[email protected]" #发件人邮箱账户
        gitlab_rails['smtp_password'] = ""  #发件人邮箱客户端授权码
        gitlab_rails['smtp_domain'] = "qq.com"
        gitlab_rails['smtp_authentication'] = "login"
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['smtp_tls'] = true
        关闭不需要的程序(可选)
        1385 prometheus['enable'] = false
        1474 node_exporter['enable'] = fals
        1493 redis_exporter['enable'] = false
        1511 postgres_exporter['enable'] = false
        1560 grafana['enable'] = false
git-jenkins ]# cd /opt/src/
git-jenkins ]# wget https://gitlab.com/xhang/gitlab/-/archive/12-3-stable/gitlab-12-3-stable.tar.gz
git-jenkins ]# tar xf gitlab-12-3-stable.tar.gz 
git-jenkins ]# \cp -r gitlab-12-3-stable/* /opt/gitlab/embedded/service/gitlab-rails/
git-jenkins ]# gitlab-ctl reconfigure 
git-jenkins ]# gitlab-ctl start 

访问gitlab地址,初始化密码


image.png

调整偏好设置


image.png

image.png

调整gitlab配置文件,集成ldap
git-jenkins ]# vim /etc/gitlab/gitlab.rb
        gitlab_rails['ldap_enabled'] = true
        
        ###! **remember to close this block with 'EOS' below**
        gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
        main: # 'main' is the GitLab 'provider ID' of this LDAP server
            label: 'LDAP'
            host: '172.16.20.73'
            port: 389
            uid: 'cn'
        
        ###! **remember to close this block with 'EOS' below**
        gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
        main: # 'main' is the GitLab 'provider ID' of this LDAP server
            label: 'LDAP'
            host: '172.16.20.73'
            port: 389
            uid: 'cn'
            bind_dn: 'cn=admin,dc=bitshare,dc=com'
            password: '123456'
            encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
            verify_certificates: true
            smartcard_auth: false
            active_directory: true
            allow_username_or_email_login: false
            lowercase_usernames: false
            block_auto_created_users: false
            base: 'dc=bitshare,dc=com'
            user_filter: ''
        EOS
git-jenkins ]# gitlab-ctl stop
git-jenkins ]# gitlab-ctl reconfigure 
git-jenkins ]# gitlab-ctl start

访问gitlab,此时会出来一个LDAP的标签,测试账号是否能够登录


image.png

5.部署禅道

git-jenkins ]#  cd /opt/src/
git-jenkins ]#  wget https://www.zentao.net/dl/zentao/15.2/ZenTaoPMS.15.2.zbox_64.tar.gz 
git-jenkins ]#  tar xf ZenTaoPMS.15.2.zbox_64.tar.gz -C /opt/
git-jenkins ]#  /opt/zbox/zbox start
PS :  如果所有的服务都部在同一台服务器上,记得修改端口
git-jenkins ]#  /opt/zbox/zbox status

我这里部署的是15.2的版本,需要安装插件进行集成ldap


image.png
image.png

你可能感兴趣的:(LDAP 集成gitlab jenkins 以及禅道)