Docker-Compose 部署Gitlab

【Docker-Compose 部署Gitlab】知识养成了思想,思想同时又在融化知识。这篇文章主要讲述Docker-Compose 部署Gitlab相关的知识,希望能为你提供帮助。
1.简介GitlabGitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具; 本次安装我们使用Compose在Linux系统上部署Gitlab中文社区版本。
2.前置安装docker及compose安装,参照:
Docker 安装 :https://blog.51cto.com/peak715/5320100
Docker-Compose 安装:https://blog.51cto.com/peak715/5320101
3.docker-Compose.yml 编排文件编写

version: "3.9" services: gitlab: restart: always image: twang2218/gitlab-ce-zh:latest container_name: gitlab hostname: xxxx.com.cn environment: TZ: Asia/Shanghai GITLAB_OMNIBUS_CONFIG: | external_url http://xxxx.com.cn/gitlab gitlab_rails[gitlab_shell_ssh_port] = 8022 nginx[listen_port] = 80 nginx[client_max_body_size] = 2048m gitlab_rails[smtp_enable] = true gitlab_rails[smtp_address] = "smtp.mail.qq.com" gitlab_rails[smtp_port] = 465 gitlab_rails[smtp_user_name] = "test@qq.com" gitlab_rails[smtp_password] = "password" gitlab_rails[smtp_authentication] = "login" gitlab_rails[smtp_enable_starttls_auto] = true gitlab_rails[smtp_tls] = true gitlab_rails[gitlab_email_from] = test@qq.com gitlab_rails[smtp_domain] = "smtp.mail.qq.com" user["git_user_email"] = "test@qq.com" gitlab_rails[openssl_verify_mode] = false gitlab_rails[smtp_openssl_verify_mode] = none ports: - 8088:80 - 8022:22 volumes: - /data/gitlab/config:/etc/gitlab - /data/gitlab/logs:/var/log/gitlab - /data/gitlab/data:/var/opt/gitlab shm_size: 256m

4.配置说明 Nginx配置
# 配置Gitlab内置Nginx监听端口 nginx[listen_port] = 80 # 配置Gitlab内置Nginx接收最大请求体大小(当一次性提交大批量文件进需要配置) nginx[client_max_body_size] = 2048m # 双层Nginx配置 对于公司而言,一般都有外层Nginx,用于对公司域名请求的监听及配置,当我们需要将gitlab映射到域名下,并需要通过项目名称访问时(如:http://www.abc.com/gitlab),需要特定配置: # 设置gitlab内部请求地址,添加/gitlab; 添加后通过域名或IP访问均需要加上/gitlab external_url http://xxxx.com.cn/gitlab

邮件服务配置
gitlab_rails[smtp_enable] = true gitlab_rails[smtp_address] = "smtp.mail.qq.com" gitlab_rails[smtp_port] = 465 gitlab_rails[smtp_user_name] = "test@qq.com" gitlab_rails[smtp_password] = "password" gitlab_rails[smtp_authentication] = "login" gitlab_rails[smtp_enable_starttls_auto] = true gitlab_rails[smtp_tls] = true gitlab_rails[gitlab_email_from] = test@qq.com gitlab_rails[smtp_domain] = "smtp.mail.qq.com" user["git_user_email"] = "test@qq.com"

邮件服务配置测试
# 进入容器 docker exec -it gitlab bash # 进入gitlab控制台,发送测试指令 Notify.test_email(545615947@qq.com, Gitlab测试邮件, 这是一封测试邮件,用于检测Gitlab邮件服务配置情况。).deliver_now # 当出现SSL错误相关提示时需要配置 gitlab_rails[openssl_verify_mode] = false gitlab_rails[smtp_openssl_verify_mode] = none

注意:修改配置后需要删除容器并重启

    推荐阅读