- 版本控制流程
- gitlab部署
- gitlab管理
- 项目开发编码前从当前主干建立一条开发分支,供项目开发人员使用;
- 开发结束,提交测试的时候,从当前主干建立一条测试分支,将开发分支合并到测试分支上,供测试人员进行测试。这样开发人员对开发分支的修改不会影响测试环境;
- 候我们定时将开发分支的修改合并到测试环境中。
- 回归测试的时候,从当前主干建议一条发布分支,将测试分支合并到该发布分支上,在发布分支上进行回归测试。
- 发布前,将发布分支合并到当前主干。
发布、版本、上线的流程:生产环境
运营人员 开发人员 提交变更单 测试人员 有问题:修复BUG 运维人员 评估 汇报(邮件) CTO(首席技术总监)gitlab部署
//关闭防火墙
[root@localhost ~]# systemctl disable --now firewalld.service
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# sed -ri 's/^(SELINUX=).*/1disabled/g' /etc/selinux/config
[root@localhost ~]# setenforce 0
//配置yum源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
[root@localhost ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-base.repo
//配置epel与git
[root@localhost ~]# yum -y install epel-release git wget vim
//安装依赖包
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python-utils
//启动postfix服务并设置开机自启
[root@localhost ~]# systemctl enable --now postfix.service
[root@localhost ~]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
//下载gitlab的rpm包
下载gitlab的rpm包
[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-13.12.3-ce.0.el8.x86_64.rpm/download.rpm
//安装gitlab
[root@localhost src]# rpm -ivh gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm
警告:gitlab-ce-14.3.2-ce.0.el8.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID f27eab47: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
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 ~]# sed -i "s#^external_url 'http://gitlab.example.com'#external_url 'http://192.168.129.134'#g" /etc/gitlab/gitlab.rb
//重新读取配置文件
[root@localhost ~]# gitlab-ctl reconfigure
//重启gitlab
[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 84225) 1s
ok: run: gitaly: (pid 84292) 0s
ok: run: gitlab-exporter: (pid 84330) 0s
ok: run: gitlab-workhorse: (pid 84337) 0s
ok: run: grafana: (pid 84355) 1s
ok: run: logrotate: (pid 84421) 0s
ok: run: nginx: (pid 84447) 0s
ok: run: node-exporter: (pid 84453) 1s
ok: run: postgres-exporter: (pid 84513) 0s
ok: run: postgresql: (pid 84571) 0s
ok: run: prometheus: (pid 84597) 0s
ok: run: puma: (pid 84748) 0s
ok: run: redis: (pid 84773) 1s
ok: run: redis-exporter: (pid 84814) 0s
ok: run: sidekiq: (pid 84959) 1s
[root@localhost ~]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 1024 127.0.0.1:9229 0.0.0.0:*
LISTEN 0 128 127.0.0.1:9168 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:8080 0.0.0.0:*
LISTEN 0 511 0.0.0.0:80 0.0.0.0:*
LISTEN 0 128 127.0.0.1:8082 0.0.0.0:*
LISTEN 0 128 127.0.0.1:9236 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:3000 0.0.0.0:*
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 511 0.0.0.0:8060 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9121 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9090 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9187 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9093 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9100 0.0.0.0:*
LISTEN 0 128 [::1]:9168 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
LISTEN 0 1024 *:9094 *:*
//查看当前的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的是超级管理员
=> #
irb(main):002:0> user.password = 'redhat123!' #密码必须至少8个字符
=> "redhat123!"
irb(main):003:0> user.password_confirmation = 'redhat123!'
=> "redhat123!"
irb(main):004:0> user.save! #保存修改,若无问题将返回true
Enqueued ActionMailer::MailDeliveryJob (Job ID: 1724027a-df77-4ad0-9cda-1ca3542f6379) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#>]}
=> true
irb(main):005:0> exit #退出
gitlab管理



