Gitlab相关站点
Gitlab官方文档
Gitlab官方网站
Gitlab官方容器
容器部署的优势
全部配置都可以自定义
方便迁移、备份
不限制宿主机的系统
目录管理更加清晰
Gitlab容器部署
docker-compose
运行Gitlab
vim docker-compose.yaml
version: "3.5"
services:
gitlab-ce:
image: gitlab/gitlab-ce:15.1.2-ce.0
container_name: gitlab
restart: always
hostname: gitlab.test.com
ports:
- "443:443"
- "22:22" #必须修改宿主机的sshd的服务端口
volumes:
#证书目录需要自己创建并且准备好证书
- "./ssl:/etc/gitlab/ssl"
- "./etc:/etc/gitlab"
- "./logs:/var/log/gitlab"
- "./opt:/var/opt/gitlab"
- "/etc/localtime:/etc/localtime:ro"
shm_size: 256m
environment:
GITLAB_OMNIBUS_CONFIG: |
#配置访问URL
external_url "https://gitlab.test.com";
#配置全局时区
gitlab_rails["time_zone"] = "Asia/Shanghai";
#配置GitLab发件箱
gitlab_rails["smtp_enable"] = true;
gitlab_rails['smtp_address'] = "smtp.qq.com";
gitlab_rails["smtp_port"] = 465;
gitlab_rails['smtp_user_name'] = "123456@qq.com";
gitlab_rails["smtp_password"] = "password";
gitlab_rails["smtp_domain"] = "qq.com";
gitlab_rails["smtp_authentication"] = "login";
gitlab_rails["smtp_enable_starttls_auto"] = false;
gitlab_rails["smtp_tls"] = true;
gitlab_rails["smtp_openssl_verify_mode"] = "none";
gitlab_rails["gitlab_email_enabled"] = true;
gitlab_rails["gitlab_email_from"] = "123456@qq.com";
gitlab_rails["gitlab_email_display_name"] = "GitLab Server";
#配置SSL证书
nginx["ssl_certificate"] = "/etc/gitlab/ssl/nginx.pem";
nginx["ssl_certificate_key"] = "/etc/gitlab/ssl/nginx.key";
network_mode: bridge
#可以通过GITLAB_OMNIBUS_CONFIG将环境变量添加到Docker run命令来预先配置GitLab Docker映像
该变量可以包含任何gitlab.rb设置
并在加载容器文件之前进行评估gitlab.rb
#其他的一些自定义容器参数
https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersdocker-section
运行容器
#运行容器
docker-compose up -d
#关闭容器
docker-compose down
配置偏好
用户设置