gitlab

GITLAB版本控制

简介

针对项目开发中的代码,配置文件,说明文档统一管理,是软件管理的核心思想之一。

各版本不允许覆盖。

开发基线:

  • master(经过测试的没问题的基础代码)

  • 20210512(新功能1)

  • 20210513(新功能2)

发布-->发版-->上线(分支)

回滚、回退(防止上线时出问题,保证服务正常进行相当于虚拟机快照)

部署环境:

  • 开发环境
  • 测试环境
  • 预部署环境/准生产环境
  • 生产环境(用户使用)

上线流程:

gitlab部署

注意:必须为纯净环境

[root@localhost ~]# systemctl disable --now firewalld
[root@localhost ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
[root@localhost ~]# setenforce 0
[root@localhost ~]# yum -y install epel-release git
//安装依赖包
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python-utils.noarch

//设置邮箱服务开机自启
[root@localhost ~]# systemctl enable --now  postfix.service

//下载并安装gitlab安装包
[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm
[root@localhost ~]# rpm -ivh gitlab-ce-13.9.7-ce.0.el8.x86_64.rpm

//修改配置文件
[root@localhost ~]# vim /etc/gitlab/gitlab.rb 
...
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http://192.168.44.128' #修改为gitlab仓库为本机ip或域名

//重编译并重启
[root@localhost ~]# gitlab-ctl reconfigure
[root@localhost ~]# gitlab-ctl restart

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

//进入生产环境进行用户添加
[root@localhost ~]# 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 = 'csl1234!' #设置密码
=> "csl1234!"
irb(main):003:0> user.password_confirmation = 'csl1234!' #二次确认
=> "csl1234!"
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网页界面

在网页上输入本机IP

用户登录

添加用户

添加组

添加项目

 

posted @ 2021-05-12 18:03  人妖用菊花  阅读(93)  评论(0编辑  收藏  举报