当前位置:   article > 正文

Gitlab部署管理

Gitlab部署管理

一、安装

1.docker安装gitlab
sudo docker run -d \
  -p 6080:80 -p 6022:22 \
  --name gitlab \
  --restart always \
  -v /srv/gitlab/config:/etc/gitlab \
  -v /srv/gitlab/logs:/var/log/gitlab \
  -v /srv/gitlab/data:/var/opt/gitlab \
  gitlab/gitlab-ce:latest
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
2.存储说明
  • 存储应用数据:/srv/gitlab/data -> /var/opt/gitlab
  • 存储日志数据:/srv/gitlab/logs -> /var/log/gitlab
  • 存储 gitlab 配置文件:/srv/gitlab/config -> /etc/gitlab
3.Gitlab 配置
docker exec -it gitlab /bin/bash
vi /etc/gitlab/gitlab.rb
docker restart gitlab

# 初始root密码在登录时不能手动设置,查看日志,输出在文件
# cat /etc/gitlab/initial_root_password
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
4.配置邮件
# gitlab/config/gitlab.rb
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "gitlab@jsdfycwlkjyxg.wecom.work"
gitlab_rails['smtp_password'] = "EfiSJYPexHjVYE2S"
gitlab_rails['smtp_domain'] = "qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_pool'] = false

docker exec -it gitlab /bin/bash
gitlab-ctl reconfigure
gitlab-ctl restart

gitlab-rails console
Notify.test_email('xxx@qq.com','gitlab邮箱通知测试','这是正文内容').deliver_now
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
遇到openSSL报错

启用如下配置

gitlab_rails['smtp_openssl_verify_mode'] = 'none'                                          
                        
gitlab_rails['smtp_ca_path'] = "/etc/ssl/certs"                                            
gitlab_rails['smtp_ca_file'] = "/etc/ssl/certs/ca-certificates.crt"
  • 1
  • 2
  • 3
  • 4
报错From必须与user一致
gitlab_rails['gitlab_email_from'] = 'gitlab@jsdfycwlkjyxg.wecom.work'              
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
  • 1
  • 2
邮件域名不对
external_url 'https://git.xxx.com'
  • 1

注意:设置external_url后,gitlab将自动将nginx开放到对应端口,https对应443,http对应80,需注意docker容器的端口映射。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/184530
推荐阅读
  

闽ICP备14008679号