1. Devops实战篇之——Git/GitLab安装

Devops软件生命周期的第一阶段,代码阶段。

我们需要在这个阶段实现开发部门人员能将写好的代码上传到GitLab上存储,接下来由Jenkins处理,进行代码的构建(maven),进行代码测试(sonarqube),也就是所谓的CI阶段。再由Jenkins处理,进行项目的打包push到测试/生产环境,再告知测试/生产环境进行项目的部署,也就是所谓的CD阶段。

Dev0ps理念:让开发人员可以持续集成,运维人员可以持续交付和持续部署,让整个开发过程自动部署,上线...

  • 开发写完的代码自动集成,自动交付与部署。其本质是自动化。

  • Devops是一套快速、频繁、可靠的软件交付实践。

#整个流程我们准备了三台机器用作模拟生产环境

hostnameip
k8smaster192.168.64.20
k8snode1

192.168.64.21

k8snode2192.168.64.22

#我们现在要做的就是Gitlab的安装部署

#gitlab运行内存推荐4G.(运行需要3G左右) ,需要在机器上安装docker和docker-compose

#首先拉取镜像

docker pull gitlab/gitlab-ce

#随后编写yml,安装gitlab

[root@k8smaster gitlab]# cat docker-compose.yml 
version: "3.1"
services:
  gitlab:
    image: 'gitlab/gitlab-ce'
    container_name: gitlab
    restart: always
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://192.168.64.20:8929'    #这里替换为宿主机地址   
        gitlab_rails['gitlab_shell_ssh_port'] = 2224
    ports:
      - '8929:8929'
      -  '2224:2224'
    volumes:
      - './config:/etc/gitlib'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlb'

[root@k8smaster gitlab]# 
[root@k8smaster gitlab]# pwd
/usr/local/gitlab
#运行即可

docker-compose up -d

#浏览器访问ip:8929

#登录密码在容器内,查看后复制登录即可

[root@k8smaster gitlab]# docker exec -it gitlab bash
root@e91bc8e1e8d0:/# 
root@e91bc8e1e8d0:/# cat /etc/gitlab/initial_root_password 
# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: +O5+gG5B/ShbsDl9j0EUXQNfJ+IjSDieJhjClrLj/3k=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

#到这里就安装好gitlab了。

  • 8
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Doublew_w

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值