热门标签 | HotTags
当前位置:  开发笔记 > 开发工具 > 正文

版本控制gitlab部署和网页管理

  版本控制介绍版本控制是指对软件开发过程中各种程序代码、配置文件及说明文档等文件变更的管理,是软件配置管理的核心思想之一。版本控制最主要的功能就是追踪文件的变更。它将

 

 


版本控制介绍

版本控制是指对软件开发过程中各种程序代码、配置文件及说明文档等文件变更的管理,是软件配置管理的核心思想之一。

版本控制最主要的功能就是追踪文件的变更。它将什么时候、什么人更改了文件的什么内容等信息忠实地了记录下来。每一次文件的改变,文件的版本号都将增加。除了记录版本变更外,版本控制的另一个重要功能是并行开发。软件开发往往是多人协同作业,版本控制可以有效地解决版本的同步以及不同开发者之间的开发通信问题,提高协同开发的效率。并行开发中最常见的不同版本软件的错误(Bug)修正问题也可以通过版本控制中分支与合并的方法有效地解决。
具体来说,在每一项开发任务中,都需要首先设定开发基线,确定各个配置项的开发初始版本,在开发过程中,开发人员基于开发基线的版本,开发出所需的目标版本。当发生需求变更时,通过对变更的评估,确定变更的影响范围,对被影响的配置项的版本进行修改,根据变更的性质使配置项的版本树继续延伸或产生新的分支,形成新的目标版本,而对于不受变更影响的配置项则不应发产生变动。同时,应能够将变更所产生的对版本的影响进行记录和跟踪。必要时还可以回退到以前的版本。例如当开发需求或需求变更被取消时,就需要有能力将版本回退到开发基线版本。在曾经出现过的季度升级包拆包和重新组包的过程中,其实就是将部分配置项的版本回退到开发基线,将对应不同需求的不同分支重新组合归并,形成新的升级包版本。
版本控制是软件配置管理的核心功能。所有置于配置库中的元素都应自动予以版本的标识,并保证版本命名的唯一性。版本在生成过程中,自动依照设定的使用模型自动分支、演进。除了系统自动记录的版本信息以外,为了配合软件开发流程的各个阶段。还需要定义、收集一些元数据来记录版本的辅助信息和规范开发流程,并为今后对软件过程的度量做好准备。当然如果选用的工具支持,这些辅助数据将能直接统计出过程数据,从而方便软件过程改进活动的进行。对于配置库中的各个基线控制项,应该根据其基线的位置和状态来设置相应的访问权限。一般来说,对于基线版本之前的各个版本都应处于被锁定的状态,如需要对它们进行变更,则应按照变更控制的流程来进行操作。

常用的版本控制工具:




    • gitlab

    • subversion


 

 

 

 

 

 

 


配置yum源

[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo [root@localhost ~]# 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
[root@localhost
~]# sed -i 's#$releasever#8#g' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost
~]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
[root@localhost ~]# sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@localhost
~]# yum clean all && yum makecache

 

 


安装git和依赖包

[root@localhost ~]# yum -y install epel-release git
[root@localhost
~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
[root@localhost
~]# yum -y install postfix python3-policycoreutils
//启动postfix服务并设置开机自启
[root@localhost ~]# systemctl enable --now postfix.service
Created symlink
/etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.

 


 

//下载gitlabrpm包
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm
//安装gitlab
[root@localhost src]# rpm -ivh /root/gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm
warning:
/root/gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
policycoreutils
-python-utils is needed by gitlab-ce-13.9.7-ce.0.el8.x86_64
[root@localhost src]#
yum install -y policycoreutils-python-utils
Last metadata expiration check:
0:05:57 ago on Wed 12 May 2021 11:40:11 PM CST.
Dependencies resolved.
=================================================================================================================
Package Architecture Version Repository Size
=================================================================================================================
Installing:
policycoreutils
-python-utils noarch 2.9-9.el8 BaseOS 251 k
Transaction Summary
=================================================================================================================
Install
1 Package
Total download size:
251 k
Installed size:
137 k
Downloading Packages:
policycoreutils
-python-utils-2.9-9.el8.noarch.rpm 900 kB/s | 251 kB 00:00
-----------------------------------------------------------------------------------------------------------------
Total
338 kB/s | 251 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing :
1/1
Installing : policycoreutils
-python-utils-2.9-9.el8.noarch 1/1
Running scriptlet: policycoreutils
-python-utils-2.9-9.el8.noarch 1/1
Verifying : policycoreutils
-python-utils-2.9-9.el8.noarch 1/1
Installed:
policycoreutils
-python-utils-2.9-9.el8.noarch
Complete
!
[root@localhost src]# rpm
-ivh /root/gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm
warning:
/root/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@localhost src]# vim /etc/gitlab/gitlab.rb
external_url
'http://192.168.170.134' //将此处改为安装gitlab服务器的IP地址
//重载配置文件并重启gitlab
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost
~]# gitlab-ctl restart
ok: run: alertmanager: (pid
8413) 0s
ok: run: gitaly: (pid
8426) 0s
ok: run: gitlab
-exporter: (pid 8447) 0s
ok: run: gitlab
-workhorse: (pid 8450) 0s
ok: run: grafana: (pid
8457) 1s
ok: run: logrotate: (pid
8467) 0s
ok: run: nginx: (pid
8473) 1s
ok: run: node
-exporter: (pid 8482) 0s
ok: run: postgres
-exporter: (pid 8489) 1s
ok: run: postgresql: (pid
8500) 0s
ok: run: prometheus: (pid
8503) 0s
ok: run: puma: (pid
8521) 0s
ok: run: redis: (pid
8526) 1s
ok: run: redis
-exporter: (pid 8608) 0s
ok: run: sidekiq: (pid
8614) 0s
//查看当前的gitlab版本
[root@localhost src]# head -1 /opt/gitlab/version-manifest.txt
gitlab
-ce 13.9.7

 

 

 


Gitlab网页

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


破解管理员密码

[root@localhost src]# 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 //id为1的是超级管理员
=> #id:1 @root>
irb(main):
002:0> user.password = 'mei123123' //密码必须至少8个字符
=> "mei123123"
irb(main):
003:0> user.password_cOnfirmation= 'mei123123'
=> "mei123123"
irb(main):
004:0> user.save! //保存修改,若无问题将返回true
Enqueued ActionMailer::MailDeliveryJob (Job ID: 113db47a-3048-4819-976f-eabf2736c6ab) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#0x00007fb617861350 @uri=#//gitlab/User/1>>]}
=> true
irb(main):
005:0> exit //退出

 

 

 

 

 

 

 

 

 


gitlab网页简单操作

创建组

 

 

 

 

 

 

 

 

 

 

 

 

 

 


创建用户

 

 

 

 

 

 

 

 


用创建的账户登录

 

 

 

 

 

 

 

 

 

 

 


创建项目

 

 

 

 

 


部署环境:



  • 开发环境

  • 测试环境

  • 预部署环境/准生产环境

  • 生产环境(用户使用)


上线流程:

紧急变更,向CTO说明情况,由CTO来决定要不要发



  • 开发代码(开发人员)———— 打回 ————|



  • 测试(测试人员) ———— 有问题 ————|



  • 发布(运维人员) ——> 预部署环境



  • 测试(测试人员)



  • 发邮件申请发布(开发人员)



​ 邮件发给开发Leader、抄送给运维团队



  • 填写变更单



  • 开发Leader审批



  • 评估影响范围(运维人员)



  • 向运维Leader汇报(运维人员)



  • 与开发Leader协商(运维Leader)



  • 发布(运维人员) ——> 生产环境



  • 测试(测试人员) ———— 出问题就回滚(运维人员) ————|



 


原文链接:https://www.cnblogs.com/meijianbiao/p/14760712.html



推荐阅读
author-avatar
nnbji
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有