更新于 

GitLab 部署

Docker 方式部署

1
2
3
4
5
6
7
8
9
10
11
docker run -itd \
--hostname gitlab.domain.com\
-p 5761:443 \
-p 5762:80 \
-p 5763:22 \
--name gitlab \
--restart always \
-v /mnt/app/app-config/gitlab/config:/etc/gitlab \ # 配置映射路径
-v /mnt/app/app-config/gitlab/logs:/var/log/gitlab \ # 日志映射路径
-v /mnt/app/app-config/gitlab/data:/var/opt/gitlab \ # 数据映射路径
gitlab/gitlab-ce:latest

关键文件位置

1
2
3
4
# 默认密码位置
/etc/gitlab/initial_root_password
# 配置文件位置
/etc/gitlab/gitlab.rb

初始配置

1
2
3
4
5
6
7
8
9
10
11
12
# 访问 gitlab 的 url
external_url 'http://gitlab.domain.com'
gitlab_rails['time_zone'] = 'Asia/Shanghai'

gitlab_rails['gitlab_default_projects_features_builds'] = false

gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"

gitlab_rails['gitlab_shell_ssh_port'] = 5763

user['git_user_name'] = "GitLab"

邮件发送配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "userName@163.com"
gitlab_rails['smtp_password'] = "email token"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true

gitlab_rails['smtp_openssl_verify_mode'] = 'none'
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'userName@163.com'

postgresql['enable'] = true
postgresql['ssl'] = 'off'

邮件发送测试

1
2
gitlab-rails console
Notify.test_email('receiver@email.com', 'Message Subject', 'Message Body').deliver_now