版本控制GitLab

版本控制GitLab

GitLab基本介绍

GitLab是利用Ruby on Rails一个开源的版本管理系统,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目

与Github类似,GitLab能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。团队成员可以利用内置的简单聊天程序(Wall)进行交流。

它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。

GitLab工作流程

Cp9SLr.png

GitLab部署

//安装git
[root@localhost ~]# yum -y install epel-release git
安装过程略

//安装依赖包
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
安装过程略

//启动postfix服务并设置开机自启
[root@localhost ~]# systemctl enable --now postfix

//下载gitlab的rpm包
[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm
[root@localhost src]# ls
debug  gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm  kernels

//安装gitlab
[root@localhost src]# rpm -ivh gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm 
warning: gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:gitlab-ce-14.3.2-ce.0.el8        ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  
//修改配置文件
[root@localhost ~]# vim /etc/gitlab/gitlab.rb 
。。。。。。
external_url 'http://192.168.100.110'
。。。。。。

//重载配置文件并重启gitlab
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 17156) 1s
ok: run: gitaly: (pid 17165) 0s
ok: run: gitlab-exporter: (pid 17179) 0s
ok: run: gitlab-workhorse: (pid 17182) 1s
ok: run: grafana: (pid 17191) 0s
ok: run: logrotate: (pid 17205) 1s
ok: run: nginx: (pid 17211) 0s
ok: run: node-exporter: (pid 17220) 0s
ok: run: postgres-exporter: (pid 17227) 1s
ok: run: postgresql: (pid 17239) 0s
ok: run: prometheus: (pid 17241) 1s
ok: run: puma: (pid 17300) 1s
ok: run: redis: (pid 17343) 0s
ok: run: redis-exporter: (pid 17349) 0s
ok: run: sidekiq: (pid 17356) 1s

//查看当前的gitlab版本
[root@localhost ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 14.3.2

//破解管理员密码
[root@localhost ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
 GitLab:       14.3.2 (92acfb1b8a9) FOSS
 GitLab Shell: 13.21.1
 PostgreSQL:   12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.3.2)
irb(main):001:0> user = User.where(id: 1).first    //id为1的是超级管理员
=> #<User id:1 @root>
irb(main):002:0> user.password = '12345678'    //密码必须至少8个字符
=> "12345678"
irb(main):003:0> user.password_confirmation = '12345678'
=> "12345678"
irb(main):004:0> user.save!   //保存修改,若无问题将返回true
Enqueued ActionMailer::MailDeliveryJob (Job ID: e087574c-abf4-408d-bf2f-70a1f414e1ba) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f42c75fa760 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):005:0> exit   //退出

GitLab管理

CpjOER.png
CpjWjn.png
Cpjc9z.png

用户

Cpj0b0.png
CpjNIm.png
CpjpGh.png
CpjdkA.png
Cpjw15.png
Cpj7Nq.png
CpjDjr.png
Cpj6ET.png
Cpj8O1.png

Cz5KrR.png
Cz5g1z.png
Cz5klA.png
Cz58On.png
Cz5r65.png

权限

CzBJME.png
CzBm6Y.png

项目

Cz5yJq.png
Cz5juc.png
Cz5hNh.png
Cz5fLm.png

[root@localhost ~]# cd /opt/
[root@localhost opt]# ls
gitlab
[root@localhost opt]# git clone http://192.168.100.110/test_group/myproject.git
Cloning into 'myproject'...
Username for 'http://192.168.100.110': test
Password for 'http://test@192.168.100.110': 
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 207 bytes | 207.00 KiB/s, done.
[root@localhost opt]# ls
gitlab  myproject

运维发布流程

上线、发布、发版的流程(应用于生产环境):
运营人员计划xx年xx月xx日xx点xx时发布一个xx功能,等开发人员开发好了,提变更单,再由开发人员进行测试,若有问题则打回去让开发修复bug,若无问题再由运维人员进行评估,评估后询问领导意见是打回还是发布上线,如果再有问题则让自己领导去和开发的领导去进行交涉,若交涉无结果则由CTO决定是打回还是上线

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值