精华内容
参与话题
问答
  • gitlab部署

    2018-10-30 18:38:21
    gitlab部署 //关闭防火墙和selinux [root@hxdserver ~]# [root@hxdserver ~]# systemctl stop firewalld.service [root@hxdserver ~]# setenforce 0 setenforce: SELinux is disabled //安装...
    常用的版本控制工具:
    • gitlab
    • subversion

    gitlab部署

    //关闭防火墙和selinux
    [root@hxdserver ~]# 
    [root@hxdserver ~]# systemctl stop firewalld.service 
    [root@hxdserver ~]# setenforce 0
    setenforce: SELinux is disabled
    //安装依赖包
    [root@hxdserver ~]# yum -y install epel-release git
    [root@hxdserver ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
    //启动postfix服务并设置开机自启
    [root@hxdserver ~]# systemctl restart postfix 
    [root@hxdserver ~]# systemctl enable postfix
    //下载gitlab的rpm包
    [root@hxdserver ~]# cd /usr/src/
    [root@hxdserver src]#  wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
    [root@hxdserver src]# ls
    debug  gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm  kernels
    [root@hxdserver src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm 
    警告:gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:gitlab-ce-11.2.1-ce.0.el7        ################################# [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
    //修改配置文件
    [root@hxdserver ~]# vim /etc/gitlab/gitlab.rb
    external_url 'http://192.168.225.128' //修改此行
    //重载配置文件并重启gitlab
    [root@hxdserver ~]# gitlab-ctl reconfigure
    //过程省略
    [root@hxdserver ~]# gitlab-ctl restart
    ok: run: alertmanager: (pid 5194) 0s
    ok: run: gitaly: (pid 5202) 0s
    ok: run: gitlab-monitor: (pid 5209) 0s
    ok: run: gitlab-workhorse: (pid 5215) 0s
    ok: run: logrotate: (pid 5219) 0s
    ok: run: nginx: (pid 5223) 0s
    ok: run: node-exporter: (pid 5233) 0s
    ok: run: postgres-exporter: (pid 5239) 0s
    ok: run: postgresql: (pid 5246) 0s
    ok: run: prometheus: (pid 5252) 0s
    ok: run: redis: (pid 5268) 0s
    ok: run: redis-exporter: (pid 5273) 0s
    ok: run: sidekiq: (pid 5280) 1s
    ok: run: unicorn: (pid 5290) 0s
    //查看当前的gitlab版本
    [root@hxdserver ~]# head -1 /opt/gitlab/version-manifest.txt
    gitlab-ce 11.2.1
    //设置管理员密码
    [root@hxdserver ~]# gitlab-rails console production
    -------------------------------------------------------------------------------------
     GitLab:       11.2.1 (2d6c1c6)
     GitLab Shell: 8.1.1
     postgresql:   9.6.8
    -------------------------------------------------------------------------------------
    
    Loading production environment (Rails 4.2.10)
    irb(main):001:0> 
    irb(main):002:0* user = User.where(id: 1).first   //id为1的是超级管理员
    => #<User id:1 @root>
    irb(main):003:0> user.password = 'hxd123456.'
    => "hxd123456."        //密码必须至少8个字符
    irb(main):004:0> user.save!     //保存修改,若无问题将返回true
    Enqueued ActionMailer::DeliveryJob (Job ID: 396f9037-b177-4a9c-9531-fe80839a819f) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
    => true
    irb(main):005:0> exit    //退出
    
    
    

    在浏览器访问192.168.225.128
    在这里插入图片描述
    登录进去后在这里插入图片描述

    展开全文
  • gitlab 部署

    2019-06-02 08:46:39
    实验环境: 1.1.1.2 RHEL7 1、安装一些必要软件 # yum install curl policycoreutils openssh-server openssh-clients postfix -y # systemctl start postfix.service ...2、gitlab安装 下载最新版本:h...
    • 温馨提示:
      建议虚拟机Disk至少为20G,cpu至少两个,memory至少为2048,否则会编译超级慢,且会被卡死,体验极差!我一开始没有注意这点,导致实验卡得根本没办法进行!

    实验环境:

    1.1.1.2		RHEL7
    

    1、安装一些必要软件

    # yum install curl policycoreutils openssh-server openssh-clients postfix  -y
    # systemctl start postfix.service
    # systemctl enable postfix.service
    

    2、gitlab安装

    下载最新版本:https://packages.gitlab.com/gitlab/gitlab-ce/

    # ls
    gitlab-ce-11.9.9-ce.0.el7.x86_64.rpm
    # yum install gitlab-ce-11.9.9-ce.0.el7.x86_64.rpm -y
    # vim /etc/gitlab/gitlab.r
    external_url 'http://1.1.1.2'		#改为自己的IP
    # gitlab-ctl reconfigure		    #初始化
    

    在这里插入图片描述

    3、gitlab常用命令

    gitlab-ctl start               # 启动所有 gitlab 组件;
    gitlab-ctl stop                # 停止所有 gitlab 组件;
    gitlab-ctl restart             # 重启所有 gitlab 组件;
    gitlab-ctl status              # 查看服务状态;
    gitlab-ctl reconfigure         # 启动服务;
    vim /etc/gitlab/gitlab.rb      # 修改默认的配置文件;
    gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
    gitlab-ctl tail                # 查看日志;
    

    4、浏览器访问

    设置root用户密码
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    增加用户,如下图,其他默认即可
    在这里插入图片描述
    可以看到刚创建的用户
    在这里插入图片描述
    创建工程

    在这里插入图片描述

    展开全文
  • GItLab 部署

    2018-08-21 14:06:20
    一、git、github、gitlab的区别 Git是版本控制系统,Github是在线的基于Git的代码托管服务。GitHub是2008年由Ruby on Rails编写而成。GitHub同时提供付费账户和免费账户。这两种账户都可以创建公开的代码仓库,只有...

    一、git、github、gitlab的区别

    Git是版本控制系统,Github是在线的基于Git的代码托管服务。
    GitHub是2008年由Ruby on Rails编写而成。GitHub同时提供付费账户和免费账户。这两种账户都可以创建公开的代码仓库,只有付费账户可以创建私有的代码仓库。
    Gitlab解决了这个问题, 可以在上面创建免费的私人repo。

    二、gitlab server搭建过程

    [root@gitlab ~]#  yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python
    
    //10.x以后开始依赖policycoreutils-python
    [root@gitlab ~]#  systemctl start postfix
    [root@gitlab ~]# systemctl enable postfix

    gitlab的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

    安装gitlab:

    [root@gitlab ~]# rpm -ivh  gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm
    warning: gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:gitlab-ce-11.1.4-ce.0.el7        ################################# [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

    gitlab的配置文件 /etc/gitlab/gitlab.rb, 编辑如下:

    [root@gitlab ~]# vim /etc/gitlab/gitlab.rb 
    [root@gitlab ~]# grep "^external_url" /etc/gitlab/gitlab.rb
    external_url 'http://192.168.174.131'   绑定监听的域名或IP
    [root@gitlab ~]#  grep "'listen_port" /etc/gitlab/gitlab.rb 
    nginx['listen_port'] = 8000   可以修改登陆端口没有端口占用可以不改 
    [root@gitlab ~]# 

    使用gitlab-ctl reconfigure 自动配置,并安装数据库,初始化信息,时间较长,如下:

    [root@gitlab ~]#  gitlab-ctl reconfigure
                                        ······

    使用gitlab-ctl start 启动gitlab服务,如下所示:

    [root@gitlab ~]# gitlab-ctl start
    ok: run: alertmanager: (pid 13983) 171s
    ok: run: gitaly: (pid 13914) 190s
    ok: run: gitlab-monitor: (pid 13945) 180s
    ok: run: gitlab-workhorse: (pid 13897) 193s
    ok: run: logrotate: (pid 12757) 1081s
    ok: run: nginx: (pid 12712) 1092s
    ok: run: node-exporter: (pid 12929) 1024s
    ok: run: postgres-exporter: (pid 14004) 172s
    ok: run: postgresql: (pid 12193) 1459s
    ok: run: prometheus: (pid 13959) 177s
    ok: run: redis: (pid 12064) 1481s
    ok: run: redis-exporter: (pid 13108) 951s
    ok: run: sidekiq: (pid 12597) 1105s
    ok: run: unicorn: (pid 12530) 1116s
    [root@gitlab ~]# lsof -i:8000
    COMMAND  PID       USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    nginx   3188       root    7u  IPv4  27028      0t0  TCP *:irdmi (LISTEN)
    nginx   3189 gitlab-www    7u  IPv4  27028      0t0  TCP *:irdmi (LISTEN)
    nginx   3190 gitlab-www    7u  IPv4  27028      0t0  TCP *:irdmi (LISTEN)
    nginx   3191 gitlab-www    7u  IPv4  27028      0t0  TCP *:irdmi (LISTEN)
    nginx   3192 gitlab-www    7u  IPv4  27028      0t0  TCP *:irdmi (LISTEN)
    

    修改配置文件,添加smtp邮件功能

    [root@gitlab ~]# vim /etc/gitlab/gitlab.rb
    [root@gitlab ~]# grep -P "^[^#].*smtp_|user_email|gitlab_email" /etc/gitlab/gitlab.rb
    gitlab_rails['gitlab_email_enabled'] = true
    gitlab_rails['gitlab_email_from'] = 'shenzhuang@aliyun.com'
    gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
    gitlab_rails['gitlab_email_reply_to'] = 'shenzhuang@aliyun.com'
    gitlab_rails['gitlab_email_subject_suffix'] = '[gitlab]'
    gitlab_rails['smtp_enable'] = true
    gitlab_rails['smtp_address'] = "smtp.aliyun.com"
    gitlab_rails['smtp_port'] = 465
    gitlab_rails['smtp_user_name'] = "shenzhuang@aliyun.com"
    gitlab_rails['smtp_password'] = "STMP授权码"
    gitlab_rails['smtp_domain'] = "smtp.aliyun.com"
    gitlab_rails['smtp_authentication'] = "login"
    gitlab_rails['smtp_enable_starttls_auto'] = true
    gitlab_rails['smtp_tls'] = true
    user['git_user_email'] = "shenzhuang@aliyun.com"
    
    [root@gitlab ~]# gitlab-ctl reconfigure
                                        ······
    
    [root@gitlab ~]# gitlab-ctl stop
    ok: down: alertmanager: 0s, normally up
    ok: down: gitaly: 1s, normally up
    ok: down: gitlab-monitor: 0s, normally up
    ok: down: gitlab-workhorse: 1s, normally up
    ok: down: logrotate: 0s, normally up
    ok: down: nginx: 1s, normally up
    ok: down: node-exporter: 0s, normally up
    ok: down: postgres-exporter: 0s, normally up
    ok: down: postgresql: 0s, normally up
    ok: down: prometheus: 0s, normally up
    ok: down: redis: 1s, normally up
    ok: down: redis-exporter: 0s, normally up
    ok: down: sidekiq: 0s, normally up
    ok: down: unicorn: 0s, normally up
    
    [root@gitlab ~]# gitlab-ctl start
    ok: run: alertmanager: (pid 12757) 1s
    ok: run: gitaly: (pid 12759) 0s
    ok: run: gitlab-monitor: (pid 12784) 1s
    ok: run: gitlab-workhorse: (pid 12788) 0s
    ok: run: logrotate: (pid 12797) 0s
    ok: run: nginx: (pid 12814) 0s
    ok: run: node-exporter: (pid 12823) 0s
    ok: run: postgres-exporter: (pid 12830) 1s
    ok: run: postgresql: (pid 12837) 0s
    ok: run: prometheus: (pid 12845) 1s
    ok: run: redis: (pid 12859) 0s
    ok: run: redis-exporter: (pid 12865) 1s
    ok: run: sidekiq: (pid 12877) 0s
    ok: run: unicorn: (pid 12885) 1s

    使用gitlab-rails console命令进行发送邮件测试,如下所示:

    [root@gitlab ~]# gitlab-rails console
    -------------------------------------------------------------------------------------
     GitLab:       11.1.4 (63daf37)
     GitLab Shell: 7.1.4
     postgresql:   9.6.8
    -------------------------------------------------------------------------------------
    Loading production environment (Rails 4.2.10)
    irb(main):001:0> Notify.test_email('shenzhuangzhuang@890media.com', 'Message Subject', 'Message Body').deliver_now
    
    Notify#test_email: processed outbound mail in 616.6ms
    
    Sent mail to shenzhuangzhuang@890media.com (1584.9ms)
    Date: Tue, 21 Aug 2018 09:59:10 +0800
    From: Gitlab <shenzhuang@aliyun.com>
    Reply-To: Gitlab <shenzhuang@aliyun.com>
    To: shenzhuangzhuang@890media.com
    Message-ID: <5b7b71ee509b8_1acd3ff08d2daf8874395@gitlab_3.mail>
    Subject: Message Subject
    Mime-Version: 1.0
    Content-Type: text/html;
     charset=UTF-8
    Content-Transfer-Encoding: 7bit
    Auto-Submitted: auto-generated
    X-Auto-Response-Suppress: All
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <html><body><p>Message Body</p></body></html>
    
    => #<Mail::Message:70302184275580, Multipart: false, Headers: <Date: Tue, 21 Aug 2018 09:59:10 +0800>, <From: Gitlab <shenzhuang@aliyun.com>>, <Reply-To: Gitlab <shenzhuang@aliyun.com>>, <To: shenzhuangzhuang@890media.com>, <Message-ID: <5b7b71ee509b8_1acd3ff08d2daf8874395@gitlab_3.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
    irb(main):002:0> exit
    [root@gitlab ~]# 

    三、gitlab的使用在浏览器中输入 http://192.168.174.131:8000 ,然后 change password: ,并使用root用户登录 即可 (后续动作根据提示操作,要开放端口)

    GItLab 部署

    登陆:

    GItLab 部署

    创建 group,组名为date:

    GItLab 部署
    GItLab 部署

    去掉用户的自动注册功能:

    admin are -> settings -> Sign-up Restrictions 去掉钩钩,然后拉到最下面保存,重新登录
    GItLab 部署

    创建用户liqing如下所示,下拉保存:

    GItLab 部署
    同样的方法,再创建libai 、luban 用户。用户添加完毕后,

    将用户添加到组中,并指定liqing为本组的owner:

    GItLab 部署

    同样的方法将用户libai、luban也添加到组中,并指定他们为Developer:

    GItLab 部署

    使用liqing用户的身份与密码登录到gitlab界面中,并创建Project ,如下所示:

    密码重置邮件,如果找不到网页,请注意端口我这边端口8000需要访问添加8000端口。
    GItLab 部署
    liqing用户的身份登陆
    GItLab 部署

    指定项目的存储路径和项目名称,如下所示

    GItLab 部署
    GItLab 部署
    先创建一个文件,newfile

    为项目创建分支,dev

    GItLab 部署
    GItLab 部署

    在 client 上添加所创的用户:

    [root@gitlab ~]# useradd liqing
    [root@gitlab ~]# useradd libai
    [root@gitlab ~]# useradd luban
    [root@gitlab ~]# su - liqing
    [liqing@gitlab ]$ ssh-keygen -C 注册使用的邮箱@890media.com
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/liqing/.ssh/id_rsa): 
    Created directory '/home/liqing/.ssh'.
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /home/liqing/.ssh/id_rsa.
    Your public key has been saved in /home/liqing/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:867FHnQ3nI24E9djXBJmCKBBD9E5jcsYmJYwUHEhRoQ 
    The key's randomart image is:
    +---[RSA 2048]----+
    |.*Xoo*=o.=.. .+  |
    |E. += .== . .o . |
    |   .  .+.o    . .|
    |      . o    o.*.|
    |        S . + B+o|
    |         = . =...|
    |          = o    |
    |         + . .   |
    |        ..o      |
    +----[SHA256]-----+
    [liqing@gitlab ~]$ cat .ssh/id_rsa.pub 
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFHHXUXiKBZT3e3UaeMwVyBoVcu1MavRca4fl91ZynQHI5U2w/QhcdO694OHGjUU5eZ5WbtZLsHD2MDlT4wo475h3HUTtGQ8q6+AHFvZvh9kyPs3dN/LG5ETfBC58T0tanr4FdhcfSNP5ZtRXIFpBbvHJjHaMvj7Y0BUMR9RD9RwKdD0c+P+60//rWMZnfZuB4iNAEJaODEVJUvuvcglzcI/1qhNeLAKIeVLIkObfsA35dd2Iw/yAm547KSxfov6tANh0Es9PkrgApH6G24PHD0lI7RhS5ixkwfv/KBFrMuYZ9VriYk+8xN5V7oXwmdVCyb0kHGGipCneWB4ugCt/R  邮箱地址@890media.com

    将liqing的公钥复制到gitlab中: 使用liqing用户的身份与密码登录到gitlab界面中,然后在ssh-key中添加 相关的key ,如下所示:

    GItLab 部署

    为liqing用户配置git ,如下所示:

    [liqing@gitlab ~]$ git config --global user.email "邮箱@890media.com"
    [liqing@gitlab ~]$ git config --global user.name "liqing"
    [liqing@gitlab ~]$ git clone git@192.168.174.131:date/cahthall.git
    正克隆到 'cahthall'...
    The authenticity of host '192.168.174.131 (192.168.174.131)' can't be established.
    ECDSA key fingerprint is SHA256:58irR7pXLQYPeqtrpL0d6kBwlBlF5zmBVcD5yTU+baE.
    ECDSA key fingerprint is MD5:ce:d9:0d:3a:e7:a3:a1:17:6a:94:dc:65:bc:1a:42:19.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.174.131' (ECDSA) to the list of known hosts.
    remote: Counting objects: 3, done.
    remote: Total 3 (delta 0), reused 0 (delta 0)
    接收对象中: 100% (3/3), done.
    [liqing@gitlab ~]$ ls
    cahthall
    [liqing@gitlab ~]$ cd cahthall/
    [liqing@gitlab cahthall]$ ls
    ret
    [liqing@gitlab cahthall]$ 

    创建一下新文件,添加内容,并提交到master分支:

    [liqing@gitlab cahthall]$ vim test.sh
    [liqing@gitlab cahthall]$ cat test.sh 
    #!/bin/bash
    echo "gitlab test"
    [liqing@gitlab cahthall]$ git add .
    [liqing@gitlab cahthall]$ git commit -m '201808211101'
    [master 879e985] 201808211101
     1 file changed, 2 insertions(+)
     create mode 100644 test.sh
    [liqing@gitlab cahthall]$ git push -u origin master
    Counting objects: 4, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 303 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To git@192.168.174.131:date/cahthall.git
       b20ff4f..879e985  master -> master
    分支 master 设置为跟踪来自 origin 的远程分支 master。

    使用luban用户登录,并clone 项目,如下所示:

    [root@gitlab ~]# su - luban
    [luban@gitlab ~]$ ssh-keygen -C 邮箱@aliyun.com
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/luban/.ssh/id_rsa): 
    Created directory '/home/lubani/.ssh'.
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /home/lubani/.ssh/id_rsa.
    Your public key has been saved in /home/luban/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:D8w2iEnhnUwKw2HcrpG2agyvX5U69L58UN6DCF++0lI 
    The key's randomart image is:
    +---[RSA 2048]----+
    | o=o. .          |
    | .o+.* .         |
    |   o+ +          |
    |  +.oo =o        |
    | . ++o+*So       |
    |. o. ++.E+o      |
    |oo  + .+ ...     |
    |.o.. +o +        |
    |oo.   +=         |
    +----[SHA256]-----+
    [luban@gitlab ~]$ cat .ssh/id_rsa.pub 
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQeyj3qVK37eXw95DmlVSc4Ix6TJ0N8ya0aJIq3q0c+F7sewxTygrqxaUBLD9q48WsEEQPebC7xJuIDG+hGcwHg4Mtv2aWSjJl+ZknW5xh/DogtH9Qr1q3wUoPRA3wCIG/Al9ggEW+nL3CiyBCgQh6JZ7SUMs4xfVMI/ogOnUMxS2uVKXow5SZS2yOtwALlguwG6hbRNX9fHgD2IC7tjU0UxaXLc/AvjxoRhca+Fg7exzoh1nSr9WfVfsdf/Sx3LFD9iW1xH881ladXKLM8wcn6fw81DYk5kOiGwUVybxrEv4IyRc0iHYhJDvmuwPfE2MqtBzeR3/M3vFEjIwG0Hgz 邮箱@aliyun.com

    同样需要使用luban用户登录gitlab web 界面,并添加相应的ssh-key。然后设置git ,并clone项目:

    GItLab 部署

    [luban@gitlab ~]$ git config --global user.email "shenzhuang@aliyun.com"
    [luban@gitlab ~]$ git config --global user.name "luban"
    [luban@gitlab ~]$ git clone git@192.168.174.131:date/cahthall.git
    正克隆到 'cahthall'...
    The authenticity of host '192.168.174.131 (192.168.174.131)' can't be established.
    ECDSA key fingerprint is SHA256:58irR7pXLQYPeqtrpL0d6kBwlBlF5zmBVcD5yTU+baE.
    ECDSA key fingerprint is MD5:ce:d9:0d:3a:e7:a3:a1:17:6a:94:dc:65:bc:1a:42:19.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.174.131' (ECDSA) to the list of known hosts.
    remote: Counting objects: 6, done.
    remote: Compressing objects: 100% (3/3), done.
    remote: Total 6 (delta 0), reused 0 (delta 0)
    接收对象中: 100% (6/6), done.

    切换到dev分支,修改文件内容,并将新code提交到dev分支(Developer角色默认并没有提交master的权限):

    [luban@gitlab ~]$ ls
    cahthall
    [luban@gitlab ~]$ cd cahthall/
    [luban@gitlab cahthall]$ ls
    ret  test.sh
    [luban@gitlab cahthall]$ cat test.sh 
    #!/bin/bash
    echo "gitlab test"
    [luban@gitlab cahthall]$ git checkout dev 
    分支 dev 设置为跟踪来自 origin 的远程分支 dev。
    切换到一个新分支 'dev'
    [luban@gitlab cahthall]$ ls
    ret  test.sh
    [luban@gitlab cahthall]$ vim test.sh   
    [luban@gitlab cahthall]$ git add .
    [luban@gitlab cahthall]$ git commit -m '201808211350'
    [dev e1ad4c1] 201808211350
     1 file changed, 1 insertion(+)
    [luban@gitlab cahthall]$ git push -u origin dev 
    Counting objects: 5, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 303 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    remote: 
    remote: To create a merge request for dev, visit:
    remote:   http://192.168.174.131/date/cahthall/merge_requests/new?merge_request%5Bsource_branch%5D=dev
    remote: 
    To git@192.168.174.131:date/cahthall.git
       879e985..e1ad4c1  dev -> dev
    分支 dev 设置为跟踪来自 origin 的远程分支 dev。
    [luban@gitlab cahthall]$ 
    [luban@gitlab cahthall]$ git checkout master
    切换到分支 'master'
    [luban@gitlab cahthall]$ git branch
      dev
    * master
    [luban@gitlab cahthall]$ 

    使用luban 用户登录gitlab web,在界面中 创建一个合并请求:

    GItLab 部署
    GItLab 部署

    然后使用liqing用户登录 gitlab web ,找到“合并请求” ,然后将dev分支合并到master分支,如下所示:

    GItLab 部署
    暂时结束!

    转载于:https://blog.51cto.com/13767724/2162397

    展开全文
  • GitLab部署

    2019-03-07 09:32:00
    一、Gitlab安装 官网: https://about.gitlab.com/downloads 下载地址:(选择相应的版本进行下载) https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ 本次文档的安装环境与版本: centos7.5...

    一、Gitlab安装

    官网:

    https://about.gitlab.com/downloads

    下载地址:(选择相应的版本进行下载)

    https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

    本次文档的安装环境与版本:

    centos7.5 64位,内存2G+      ; 安装版本:gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm

     

    安装插件:

    sudo sed -ri 's/^SELINUX=.*$/SELINUX=disabled/g' /etc/selinux/configrm -rf /var/run/yum.pid
    sudo sed -ri 's/^SELINUX=.*$/SELINUX=disabled/g' /etc/selinux/configyum -y install epel.release
    sudo yum install curl policycoreutils openssh-server openssh-clients
    sudo systemctl enable sshd
    sudo systemctl start sshd
    sudo yum install postfix
    sudo systemctl enable postfix
    sudo systemctl start postfix
    sudo firewall-cmd --permanent --add-service=http
    sudo systemctl reload firewalld
    sudo setenforce 0
    sudo sed -ri 's/^SELINUX=.*$/SELINUX=disabled/g' /etc/selinux/config

    安装gitlab:

    rpm -ivh gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm

    修改配置文件:

    vim /etc/gitlab/gitlab.rb

    http://{{ip}}      #此处改为本机的IP或者域名

    默认用户

    root

    5iveL!fe

    修改完后生效命令:gitlab-ctl reconfigure

    查看状态:gitlab-ctl status

    二、Gitlab配置

     

    Gitlab组件介绍:

     

    nginx:静态Web服务器

     

    gitlab-shell:用于处理Git命令和修改authorized keys列表

     

    gitlab-workhorse:轻量级的反向代理服务器

     

    logrotate:日志文件管理工具

     

    postgresql:数据库

     

    redis:缓存数据库

     

    sidekiq:用于在后台执行队列任务(异步执行)

     

    unicornGitLab Rails应用是托管在这个服务器上面的

     

    三、常用命令:

    gitlab-ctl status

    gitlab-ctl start

    gitlab-ctl stop

    gitlab-ctl restart

    gitlab-ctl tail nginx

    /var/opt/gitlab/git-data/repositories/root:库默认存储目录

    /opt/gitlab 应用代码和相应的依赖程序

    /var/opt/gitlabgitlab-ctl reconfigure命令编译后的应用数据和配置文件,不需要人为修改配置

    /etc/gitlab 配置文件目录

    /var/log/gitlab:此目录下存放了gitlab各个组件产生的日志

    /var/opt/gitlab/backups/:备份文件生成的目录

     

    更改配置文件需要进行以下操作:

     

    需要以下操作

     

    1gitlab-ctl reconfigure                  重置配置文件

     

    2gitlab-ctl show-config                   验证配置文件

     

    3gitlab-ctl restart                           重启gitlab服务

     

    四、Gitlab备份管理

     

    配置文件中加入

     

    #gitlab_rails['backup_path'] = '/data/backup/gitlab'    #更改备份目录

     

    gitlab_rails['backup_path'] =' /data/backups/gitlab/backups'

     

    #gitlab_rails['backup_keep_time'] = 604800              #备份文件保留7天

     

    gitlab_rails['backup_keep_time'] = 6048000              #备份文件保留70天

     

    如果自定义备份目录需要赋予git权限

     

    mkdir  /data/backups/gitlab/backups
    chown -R git.git / /data/backups/gitlab/backups

     

    定时任务Crontab中加入

     

    0 2 * * * /usr/bin/gitlab-rake gitlab:backup:create

     

    策略建议:本地保留三到七天,在异地备份永久保存

     

    附:gitlab-rake gitlab:backup:create RAILS_ENV=production

     

    gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1524129806_2018_04_19

    五、Gitlab备份恢复

    恢复时,先停掉服务,以免双写导致数据错误

    gitlab-ctl stop unicorn
    gitlab-ctl stop sidekiq

    恢复时,选择的版本就是备份是产生的Linux时间戳

    gitlab-rake gitlab:backup:restore BACKUP=1550599209

    date -d @1550599209

    附:

    备份迁移时的问题:https://blog.csdn.net/longfeicool4321/article/details/85251552

    六、Gitlab邮件配置

    gitlab_rails['time_zone'] = 'Asia/Shanghai'

    gitlab_rails['gitlab_email_enabled'] = true

    gitlab_rails['gitlab_email_from'] = 'dulingyu52@126.com'

    gitlab_rails['gitlab_email_display_name'] = 'gitlab'

    gitlab_rails['smtp_enable'] = true

    gitlab_rails['smtp_address'] = "smtp.126.com"

    gitlab_rails['smtp_port'] = 25

    gitlab_rails['smtp_user_name'] = "dulingyu"

    gitlab_rails['smtp_password'] = "user_password"

    gitlab_rails['smtp_domain'] = "126.com"

    gitlab_rails['smtp_authentication'] = "login

    七、检查服务日志信息

    # 检查redis的日志

    sudo gitlab-ctl tail redis

    # 检查postgresql的日志

    sudo gitlab-ctl tail postgresql

    # 检查gitlab-workhorse的日志

    sudo gitlab-ctl tail gitlab-workhorse

    # 检查logrotate的日志

    sudo gitlab-ctl tail logrotate

    # 检查nginx的日志

    sudo gitlab-ctl tail nginx

    # 检查sidekiq的日志

    sudo gitlab-ctl tail sidekiq

    # 检查unicorn的日志

    sudo gitlab-ctl tail unicorn

    八、Gitlab管理员密码重置

    使用rails工具打开终端

    sudo gitlab-rails console production

    查询用户的email,用户名,密码等信息,id:1 表示root账号,id:2 表示创建的第二个账号,依次类推

    user = User.where(id: 1).first

    重新设置密码

    user.password = '新密码'
    user.password_confirmation = '新密码'

    保存密码

    user.save!

    完整的操作ruby脚本

    user = User.where(id: 1).first
    user.password = '新密码'
    user.password_confirmation = '新密码'
    user.save!

    然后使用重置过的密码重新登录

     

    转载于:https://www.cnblogs.com/ling-yu-amen/p/10487550.html

    展开全文
  • GitLab 部署

    2014-04-08 15:35:00
    为什么80%的码农都做不了架构师?>>> ...
  • GITlab部署

    2019-10-04 16:14:38
    [gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packages.gitlab.com/gpg.key 依赖安装 yu...
  • Gitlab部署

    2020-07-19 21:41:20
    Gitlab 是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的 Git 项目仓库,可通过Web 界面进行访问公开的或者私人的项目。 官方网站:https://about.gitlab.com gitlab yum包下载 安装gitlab [root@...
  • gitlab部署安装

    2020-04-30 11:04:57
    基于centos 7.0 gitlab部署,本人亲自测试,并用于研发生产中,请不会的小伙伴们,下载安装。
  • jenkins结合gitlab部署vue项目,vue版本3,node 环境14.15.1,jdk1.8,windows环境,内容包括操作录屏和操作文档
  • gitlab 部署 管理

    千次阅读 2018-07-20 22:56:18
    目录 gitlab基本介绍 安装前的准备 gitlab安装 gitlab管理 gitlab基本介绍 GitLab概述: ...Ruby on Rails 是一个可以使你开发、部署、维护 web 应用程序变得简单的框架。 GitLab拥有与Git...
  • docker gitlab部署

    2019-02-14 10:32:27
    docker gitlab部署 GITLAB_HOME=pwd/data/gitlab docker run -d –hostname gitlab –publish 8443:443 --publish 80:80 --publish 2222:22 –name gitlab –restart always –volume $GITLAB_HOME/config:/etc...

空空如也

1 2 3 4 5 ... 20
收藏数 4,808
精华内容 1,923
关键字:

gitlab部署