reference
gitlab-install-using-docker
gitlab-ce-images-tags
gitlab-backup-restore
gitlab-ldap
gitlab-issues
操作步骤
- 版本确认
- docker-compose部署
- 数据迁移
- 配置修改
- 访问测试
版本
## 查看版本
# 文件
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
10.3.3
# 命令
gitlab-rake gitlab:env:info
## 查看配置
gitlab-ctl show-config
docker-compose
-
yaml文件
# /data/docker/gitlab/docker-compose.yml web: image: 'gitlab/gitlab-ce:10.3.3-ce.0' container_name: gitlab restart: always hostname: '10.11.10.17' # user: root environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://gitlab.abc.com' ports: - '8081:80' - '443:443' - '22:22' volumes: - '/data/gitlab/config:/etc/gitlab' - '/data/gitlab/logs:/var/log/gitlab' - '/data/gitlab/data:/var/opt/gitlab'
-
启动
cd /data/docker/gitlab # 启动 sudo docker-compose up -d # 进入容器 sudo docker exec -it gitlab /bin/bash
数据
-
备份
# 备份产生目录 /var/opt/gitlab/backups/ gitlab-rake gitlab:backup:create # 容器备份 sudo docker exec -t gitlab gitlab-rake gitlab:backup:create
-
迁移
### 配置文件说明 # 原本: /etc/gitlab/gitlab.rb # 容器: /data/gitlab/config/gitlab.rb # 授权备份文件 scp 1586766848_2020_04_13_10.3.3_gitlab_backup.tar root@10.0.0.2:/var/opt/gitlab/backups/ chown 777 /var/opt/gitlab/backups/1586766848_2020_04_13_10.3.3_gitlab_backup.tar # 加载备份路径 默认 /var/opt/gitlab/backups vim /data/gitlab/config/gitlab.rb gitlab_rails['backup_path'] = "/var/opt/gitlab/backups" gitlab_rails['backup_archive_permissions'] = 0644 gitlab_rails['backup_keep_time'] = 864000 # 重载配置 docker exec -t gitlab gitlab-ctl reconfigure # 停止数据库进程 docker exec -t gitlab gitlab-ctl status docker exec -t gitlab gitlab-ctl stop unicorn docker exec -t gitlab gitlab-ctl stop sidekiq docker exec -t gitlab gitlab-ctl status # 恢复备份文件 (输入两次yes) docker exec -t gitlab gitlab-rake gitlab:backup:restore BACKUP=1586766848_2020_04_13_10.3.3 # 重启与检测 docker exec -t gitlab gitlab-ctl restart docker exec -t gitlab gitlab-rake gitlab:check SANITIZE=true
配置
(tips: 可直接用原来的gitlab.rb替换到新的gitlab.rb)
-
LDAP
# vim /data/gitlab/config/gitlab.rb gitlab_rails['ldap_enabled'] = true gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' main: label: 'LDAP' host: 'l.auth.com' port: 389 uid: 'sAMAccountName' bind_dn: 'xxx' password: 'xxx' encryption: 'plain' # "start_tls" or "simple_tls" or "plain" verify_certificates: true active_directory: true allow_username_or_email_login: true block_auto_created_users: false base: 'xxx' user_filter: '' EOS
-
Email
gitlab_rails['gitlab_email_from'] = 'gitlab@xx.com' gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.exmail.qq.com" gitlab_rails['smtp_port'] = 25 gitlab_rails['smtp_user_name'] = "xx@xx.com" gitlab_rails['smtp_password'] = "xxx" gitlab_rails['smtp_domain'] = "xx.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true
-
重载配置
# 重载配置 gitlab-ctl reconfigure # 检查ldap是否生效 gitlab-rake gitlab:ldap:check
访问测试
-
host设置
10.11.10.17 gitlab.abc.com
-
浏览器访问
网友评论