当前位置:网站首页>[Cloud Native] 4.2 DevOps Lectures

[Cloud Native] 4.2 DevOps Lectures

2022-08-09 23:14:00 Program ape to chase

 哈喽~ 大家好呀,This will introduce it in detail DevOps and what software needs to be installed.

 个人主页:个人主页​​​​​             

 系列专栏:【云原生系列】

与这篇相关的文章:            

【云原生】3.5 RuoYi-Cloud部署实战(下)【云原生】3.5 RuoYi-Cloud部署实战(下)_程序猿追的博客-CSDN博客
 云原生讲解【扩展篇】云原生讲解【扩展篇】_程序猿追的博客-CSDN博客
【云原生】4.1 DevOps基础【云原生】4.1 DevOps基础与实战_程序猿追的博客-CSDN博客

目录

一、DevOps 诞生

二、DevOps 介绍

三、DevOps管理软件生命周期

四、GitLab 与 Maven 安装

1、GitLab 安装

2、Maven 安装

五、Jenkins介绍、安装及配置

1、Jenkins 介绍

2、Jenkins 安装

3、Jenkins 配置


一、DevOps 诞生

软件开发最开始是由两个团队组成:

开发团队从头开始设计和整体系统的构建.需要系统不停的迭代更新.运维团队将开发团队的Code进行测试后部署上线.希望系统稳定安全运行.

这看似两个目标不同的团队需要协同完成一个软件的开发.那么这里就出现了一个问题,Suppose I am developing a software,开发完之后,Handed over to the operation and maintenance team,运维团队向开发团队反馈需要修复的BUG以及一些需要返工的任务.This is what the development team has been waiting for,The developers can't do anything,This undoubtedly delayed the entire software development cycle.为了解决这类问题,诞生出了 DevOps ,It specializes in solving the communication and interaction problems between the development team and the operation and maintenance team.

二、DevOps 介绍

DevOps,字面意思是 Development & Operations 的缩写,The translation is development & 运维(There is a cloud native extension article in front of this article).

虽然字面意思只涉及到了开发团队和运维团队,其实QA测试(扩:QA There are mainly two aspects of work:1.Make improvements in the process 2.Do quality assurance work.)The team is also involved.
Baidu can check it out DevOps 的符号类似于一个无穷大的符号

 

三、DevOps管理软件生命周期

整体的软件开发流程包括:

PLAN:The development team formulates the development plan and development cycle according to the customer's needs and goals(received demand,制定计划)

CODE:根据 PLAN 开始编码过程(For general tools git 或SVN).

BUILD:编码完成后,需要将代码构建并且运行(通过 Maven 或 gradle Build it into a working software).

TEST:成功构建项目后,需要测试代码是否存在 BUG 或错误(手动测试与自动化测试).

DEPLOY:After the code is tested,认定代码已经准备好部署并且交给运维团队(测试无误后 TEST 发到 DEPLOY 上).

OPERATE:运维团队将代码部署到生产环境中(通过 docker 与 k8s 进行部署).

MONITOR:项目部署上线后,需要持续的监控产品(After the deployment is completed, it is monitored by monitoring software).

INTEGRATE:然后将监控阶段收到的反馈发送回PLAN阶段,整体反复的流程就是DevOps的核 心,即持续集成、持续部署.

This is a set of life cycle of software development,But if we have to do it again,我们可以根据 Jenkins 让他继续执行下去,When will the code be tested?When will the code be released to operation and maintenance?Are you deploying to k8s 与docker ?都是我们的 Jenkins来做.

Finally we come to a conclusion——DevOps The emphasis is on how efficient organizational teams collaborate and communicate through automated tools 来完成软件的生命周期管理,从而更快、更频繁地交付更稳定的软件.

The picture above is our easiest one to pass Jenkins 来管理,Then we will implement the function based on this picture.

四、GitLab 与 Maven 安装

1、GitLab 安装

Like what our developers use Git ,这里安装 Git 就不一一列出了,You can install it on Baidu Internet by yourself,我们这里使用 Docker 安装 GitLab.

输入命令

查看 GitLab 镜像

docker search gitlab

获取 GitLab 镜像 

docker pull gitlab/ gitlab-ce: latest

 创建 docker-compose.yml 文件

version: '3.1'
services:
gitlab:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.11.11:8929'
gitlab_rails['gitlab_shell_ssh_port'] = 2224
ports:
- '8929:8929'
- '2224:2224'
volumes:
- './config:/etc/gitlab'
- './logs:/var/log/gitlab'
- './data:/var/opt/gitlab'

 启动容器

docker-compose up -d

The installation time is a bit long,请耐心等待,Then enter the address and port number you set in the browser,就能进入了.

使用默认的用户(root)and view passwords

docker exec -it gitlab cat /etc/gitlab/initial_root_password

Then remember to change the password,Password must be at least length 8 位.

2、Maven 安装

如何安装 JDK Baidu search and install by yourself

 安装 Maven Download the required version from the official website,Enter the command after downloading

tar -zxvf jdk-8u231-Linux-x64.tar.gz -C/usr/local

tar -zxvf apache-maven-3.6.3-bin.tar.gz -C/usr/local

注:中间的 jdk 只是版本号,Remember to change it when typing.设置 Maven 的私服(Alibaba Cloud or Tencent Cloud can be used),追加 JDK 的插件(Baidu can do it)

接下来我们需要安装 Docker,Here you can see previous articles,我是文章

五、Jenkins介绍、安装及配置

1、Jenkins 介绍

Jenkins 是一个开源软件项目,是基于Java开发的一种持续集成工具. Jenkins 应用广泛,大多数互联网公司都采用 Jenkins 配合 GitLab、Docker、K8s 作为实现 DevOps 的核心工具. Jenkins最强大的就在于插件,Jenkins官方提供了大量的插件库,来自动化 CI/CD All kinds of trivial work in the process 能.

Jenkins 就像一个人,After installing the plugin, it's like putting on the gear

 This is the official picture(官方玩梗,最为致命)

2、Jenkins 安装

获取 Jenkins 镜像

docker pull jenkins/jenkins

编写 docker-compose.yml

version: "3.1"
services:
jenkins:
image: jenkins/jenkins
container_name: jenkins
ports:
- 8080:8080
- 50000:50000
volumes:
- ./data/:/var/jenkins_home/

注:首次启动会因为数据卷 data 目录没有权限导致启动失败,设置 data Directory write permission.

我们就可以进行下载了,But the download time can be a bit long,You can configure the domestic download mirror address 

# 修改数据卷中的hudson.model.UpdateCenter.xml文件
<?xml version='1.1' encoding='UTF-8'?>
<sites>
<site>
<id>default</id>
<url>https://updates.jenkins.io/update-center.json</url>
</site>
</sites>
# 将下载地址替换为http://mirror.esuni.jp/jenkins/updates/update-center.json
<?xml version='1.1' encoding='UTF-8'?>
<sites>
<site>
<id>default</id>
<url>http://mirror.esuni.jp/jenkins/updates/update-center.json</url>
</site>
</sites>
# 清华大学的插件源也可以
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

Enter the address in URL、账号与密码,就可以访问了.

Downloading plugins later may fail(很正常)我们可以进入 Jenkins Download internally,后面创建用户

 直接下一步,就可以进入了

 在 Dashboard ——> Plugin Manager Download the plugin that we failed to install,就可以了

 3、Jenkins 配置

由于 Jenkins 需要从 Git 拉取代码、需要本地构建、甚至需要直接发布自定义镜像到 Docker 仓库,所以 Jenkins 需要配置大量内容.

输入命令

mv/usr/local/jdk/ ./

mv/usr/local/maven/ ./

 

然后在 Dashboard ——> Global Tool Configuration 里面 add 一个 JDK 的地址

 同样的 Maven 也是一样的.连接的方式有很多,A username and password can be used(How to configure self-care)

不积跬步无以至千里,趁年轻,使劲拼,给未来的自己一个交代!向着明天更好的自己前进吧!

原网站

版权声明
本文为[Program ape to chase]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/221/202208091942580558.html