部署
官网文档:https://about.gitlab.com/install/?test=capabilities#centos-8
以下为centos 8平台安装步骤:
#安装依赖,一般服务器openssh-server都已经安装并且启动
sudo dnf install -y curl policycoreutils openssh-server perl
##防火墙开启 80,443端口
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
systemctl reload firewalld
# 添加gitlab repo
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
##如果有外网地址解析,添加变量
EXTERNAL_URL="https://gitlab.example.com"
# 安装
dnf install -y gitlab-ee
##基础信息
配置文件 /etc/gitlab/gitlab.rb
安装目录/opt/gitlab /var/opt/gitlab
备份还原
官方参考https://docs.gitlab.com/ee/raketasks/backup_restore.html
备份
gitlab-rake gitlab:backup:create #备份,默认位置/var/opt/gitlab/backups
gitlab-backup create ##GitLab 12.2 起使用这个命令
##备份配置文件
/etc/gitlab/gitlab-secrets.json
/etc/gitlab/gitlab.rb
##可以运行如下命令备份配置文件,
##配置文件会保存在/etc/gitlab/config_backup/,
gitlab-ctl backup-etc
还原
还原前
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq
# Verify
sudo gitlab-ctl status
gitlab-rake gitlab:backup:restore #还原,恢复的gitlab要和备份的版本完全相同
以上是12.1以前的版本。之后的是gitlab-backup create ;gitlab-backup restore
恢复后
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true
重置root 密码
gitlab-ctl start 保证gitlab处于启动状态,&保证redis处于启动状态
gitlab-ctl start #保证gitlab处于启动状态,&保证redis处于启动状态
gitlab-rails console production
irb(main):001:0>user = User.where(id: 1).first #定位到gitlab 数据库中Users表中的一个用户,通常就是管理员用户admin@local.host
irb(main):002:0> user.password=12345678 #重置管理员密码为12345678
irb(main):003:0> user.password_confirmation=12345678 #确认管理员密码为12345678
irb(main):004:0> user.save! #保存更改信息
用户权限
Guest:可以创建issue、发表评论,不能读写版本库
Reporter:可以克隆代码,不能提交,可以赋予测试、产品经理此权限
Developer:可以克隆代码、开发、提交、push,可以赋予开发人员此权限
MainMaster:可以创建项目、添加tag、保护分支、添加项目成员、编辑项目,一般GitLab管理员或者CTO才有此权限