Docker 部署 Gitlab 踩坑填坑记

本文采用docker-compose配置,如直接使用dockr run....类同。

创建docker-compose.yml, 内容如下:

web:

image: 'gitlab/gitlab-ee:latest'

container_name: gitlab

restart: always

hostname: 'localhost'

environment:

GITLAB_OMNIBUS_CONFIG: |

# Host and port

external_url 'http://xxx.xxx.xxx.xxx:10080'

nginx['listen_port'] = 10080

gitlab_rails['gitlab_shell_ssh_port'] = 10022

# Mail setting

gitlab_rails['gitlab_email_enabled'] = true

gitlab_rails['gitlab_email_from'] = '[email protected]'

gitlab_rails['gitlab_email_display_name'] = 'Example Gitlab'

gitlab_rails['gitlab_email_reply_to'] = '[email protected]'

gitlab_rails['gitlab_email_subject_suffix'] = 'Gitlab'

# Smtp setting

gitlab_rails['smtp_enable'] = true

gitlab_rails['smtp_address'] = 'smtp.yyyyyyy.com'

gitlab_rails['smtp_port'] = 465

gitlab_rails['smtp_user_name'] = '[email protected]'

gitlab_rails['smtp_password'] = '你的密码'

gitlab_rails['smtp_domain'] = 'smtp.yyyyyyy.com'

gitlab_rails['smtp_authentication'] = 'login'

#坑1:发送邮件可能会失败,务必参考以下配置(此处使用的是阿里云的企业邮箱,其它的邮箱可能略有不同)

gitlab_rails['smtp_enable_starttls_auto'] = true

gitlab_rails['smtp_tls'] = true

gitlab_rails['smtp_openssl_verify_mode'] = 'none'

ports:

# 坑2:如果使用反向代理,80端口多被用于其它业务,如果external_url中带了端口,docker 内的nginx会自动使用external_url中指定的端口(如10080),官方并没有说明!

- '10080:10080'

- '10443:443'

# 坑3:为避免与主机的ssh服务冲突,务必绑定别的端口(如10022)。

- '10022:22'

volumes:

- '/srv/gitlab/config:/etc/gitlab'

- '/srv/gitlab/logs:/var/log/gitlab'

- '/srv/gitlab/data:/var/opt/gitlab'

 

你可能感兴趣的:(项目管理,DevOps)