gitlab 容器化部署
docker run -d \
-p 80:80 \
-p 443:443 \
-p 22:22 \
--name gitlab \
--restart unless-stopped \
-v /data/gitlab/config:/etc/gitlab \
-v /data/gitlab/logs:/var/log/gitlab \
-v /data/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:15.2.2-ce.0
#查看密码
docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
修改密码
root@c2a89b6edebf:/# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
GitLab: 15.2.2 (4ecb014a935) FOSS
GitLab Shell: 14.9.0
PostgreSQL: 13.6
------------------------------------------------------------[ booted in 37.12s ]
Loading production environment (Rails 6.1.4.7)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0>
irb(main):003:0> user.password = 'admin123456'
=> "admin123456"
irb(main):004:0> user.password_confirmation = 'admin123456'
=> "admin123456"
irb(main):005:0> user.save
=> true
irb(main):006:0>
添加用户,开启SMTP
# 网易企业邮箱
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtphz.qiye.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "abc@163.com"
gitlab_rails['smtp_password'] = "Y9zyx2gzTXsCJ8wW" # 网易企业邮箱授权码
gitlab_rails['smtp_domain'] = "qiye.163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'abc@163.com'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
#重新加载配置
gitlab-ctl reconfigure
gitlab-ctl restart
#邮箱测试
gitlab-rails console
Notify.test_email('你的收件邮箱', '邮件标题', '邮件正文').deliver_now