技术平台-开发环境-代码仓库

abstiger大约 1 分钟

代码仓库

基于 gitlab-ce 的开发流程管理。

gitlab-ce的安装与配置

采用Omnibus包的方式安装,采用清华源安装:https://mirrors.tuna.tsinghua.edu.cn/help/gitlab-ce/open in new window

安装步骤

  • 首先信任 GitLab 的 GPG 公钥:
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
  • 再添加清华gitlab-ce源
sudo echo "deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main" > /etc/apt/sources.list.d/gitlab-ce.list
  • 安装 gitlab-ce:
sudo apt-get update
sudo apt-get install gitlab-ce

安装检查

gitlab的构造还蛮复杂的,会创建很多的用户,启动后也会有很多的进程

安装配置

官方参考文档:https://docs.gitlab.com/omnibus/settings/configuration.htmlopen in new window

  • 编辑配置文件,主要修改访问地址和邮箱相关配置:
vi /etc/gitlab/gitlab.rb

external_url 'https://dev.krproject.org/gitlab'

与Apache2的集成与配置

与LDAP的集成与配置

参考文档:https://docs.gitlab.com/ce/administration/auth/ldap.htmlopen in new window

编辑gitlab配置:/etc/gitlab/gitlab.rb,修改ldap配置段如下:

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: 'localhost'
    port: 389
    uid: 'uid'
    method: 'plain' # "tls" or "ssl" or "plain"
    bind_dn: 'cn=admin,dc=krproject,dc=org'
    password: '******'
    active_directory: true
    allow_username_or_email_login: true
    block_auto_created_users: false
    base: 'ou=people,dc=krproject,dc=org'
    user_filter: '(o=*gitlab*)'
    attributes:
      username: ['uid', 'userid', 'sAMAccountName']
      email:    ['mail', 'email', 'userPrincipalName']
      name:       'cn'
      first_name: 'givenName'
      last_name:  'sn'
EOS

重启gitlab以生效:

sudo gitlab-ctl reconfigure
Loading...