docker版gitlab 8.7.5-ce.0
#!/bin/bash
docker run --detach \
--hostname gitlab.domain.cn \
--publish 38443:443 --publish 38080:80 --publish 30022:22 \
--name gitlab875 \
--restart always \
--volume /data/gitlab_875/config:/etc/gitlab \
--volume /data/gitlab_875/logs:/var/log/gitlab \
--volume /data/gitlab_875/data:/var/opt/gitlab \
gitlab/gitlab-ce:8.7.5-ce.0
修改100.230 /data/gitlab_875/config/gitlab.rb (docker gitlab875 /etc/gitlab/gitlab.rb)
增加:
gitlab_rails['smtp_enable'] = true
#gitlab_rails['smtp_address'] = "smtp.domain.cn"
gitlab_rails['smtp_address'] = "12.34.56.78"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "gitlabadmin@domain.cn"
gitlab_rails['smtp_password'] = "yourpassword"
gitlab_rails['smtp_domain'] = "smtp.domain.cn"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'none'
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'gitlabadmin@domain.cn'
gitlab_rails['gitlab_email_display_name'] = 'gitlabadmin'
gitlab_rails['gitlab_email_reply_to'] = 'gitlabadmin@domain.cn'
gitlab_rails['gitlab_email_subject_suffix'] = ''
注意:gitlab_rails['smtp_openssl_verify_mode'] = 'none' 解决ssl certificate验证不通过问题:
OpenSSL::SSL::SSLError: hostname was not match with the server certificate
重启:gitlab-ctl reconfigure
测试:gitlab-rails console
Notify.test_email('test@domain.cn', 'Message Subject', 'Message Body').deliver_now
参考:
https://blog.csdn.net/stwstw0123/article/details/47149453
https://www.cnblogs.com/xishuai/p/ubuntu-install-gitlab-with-docker.html
https://www.centos.bz/2017/08/gitlab-send-email-with-smtp/