gitlab
GITLAB版本控制
简介
针对项目开发中的代码,配置文件,说明文档统一管理,是软件管理的核心思想之一。
各版本不允许覆盖。
开发基线:
-
master(经过测试的没问题的基础代码)
-
20210512(新功能1)
-
20210513(新功能2)
发布-->发版-->上线(分支)
回滚、回退(防止上线时出问题,保证服务正常运行)
部署环境:
- 开发环境
- 测试环境
- 预部署环境/准生产环境
- 生产环境(用户使用)
上线流程:
- 开发代码(开发部 )------------ --打回 <-- :
- 测试稳定性(测试部)-测试环境-->有问题:无问题-->
- 发布(运维) ---------预部署环境<------------------
- 测试(测试部)
* 测试人员邮件向开发人员申请发布
* 邮件发给leader抄送给运维团队
* 填写变更单
* 开发leader审批
* 影响上线后评估范围(运维)
* 向运维leader汇报(运维)
* 运维leader和开发leader协商|
- 发布(运维)-----生产环境<------------
- 测试(测试人员)--持续测试,出问题回滚(运维)
gitlab部署
必须为纯净环境
配置epel源,git
[root@DR ~]# yum -y install epel-release git
//安装依赖包
[root@DR ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python-utils.noarch
//设置邮箱服务开机自启
[root@DR ~]# systemctl enable --now postfix.service
下载gitlab安装包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm
安装rpm包
[root@DR ~]# rpm -ivh gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm
warning: gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:gitlab-ce-13.9.7-ce.0.el8 ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=13-9
修改配置文件
[root@DR ~]# vim /etc/gitlab/gitlab.rb
...
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http://192.168.94.141' #修改为gitlab仓库为本机ip或域名
//重编译并重启
[root@DR ~]# gitlab-ctl reconfigure
[root@DR ~]# gitlab-ctl restart
//查看版本
[root@DR ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 13.9.7
进入生产环境进行用户添加
[root@DR ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 13.9.7 (05f9b5a73c8) FOSS
GitLab Shell: 13.17.0
PostgreSQL: 12.6
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.4)
irb(main):001:0> user = User.where(id: 1).first #设置超级用户
irb(main):002:0> user.password = 'fxx1234!' #设置密码
=> "fxx1234!"
irb(main):003:0> user.password_confirmation = 'fxx1234!' #二次确认
=> "fxx1234!"
irb(main):004:0> user.save! #保持用户
Enqueued ActionMailer::MailDeliveryJob (Job ID: c0688752-9846-4fb4-ba7b-c3853f59ab8d) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f7af7550270 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
gitlab网页界面
相关配置
用户登录
设置界面
用户添加
组添加
创建新项目
git全局配置:写自己已创建的gitlab用户名和密码