当前位置: 首页 > news >正文

罗湖区住房和建设局网站官网太原seo团队

罗湖区住房和建设局网站官网,太原seo团队,南宁建设工程造价信息网,html超链接K8S GitLab Jenkins自动化发布项目实践(一)发布流程设计安装Docker服务部署Harbor作为镜像仓库部署GitLab作为代码仓库常用Git命令发布流程设计 #mermaid-svg-pe9VmFytb9GmqMvG {font-family:"trebuchet ms",verdana,arial,sans-serif;font-…

K8S + GitLab + Jenkins自动化发布项目实践(一)

  • 发布流程设计
  • 安装Docker服务
  • 部署Harbor作为镜像仓库
  • 部署GitLab作为代码仓库
    • 常用Git命令

发布流程设计

Jenkins
Git
docker pull
docker pull
docker push
docker build
Unit Testing
git checkout
git commit
测试工程师
管理员
互联网用户
容器镜像
Harbor
测试环境
生产环境
kubectl API
Load Balance

由于之前部署的k8s集群已经升级到v1.24(容器运行时已经修改为containerd),这里我们单独准备一台服务器用于部署Harbor和GitLab。需要安装docker服务。

安装Docker服务

systemctl stop firewalld
systemctl disable firewalld
sed -i 's/enforcing/disabled/' /etc/selinux/config# 安装docker
yum install -y wget
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
yum -y install docker-ce-18.06.1.ce-3.el7
systemctl enable docker && systemctl start docker
docker --version

配置国内容器镜像仓库:

cat > /etc/docker/daemon.json << EOF
{"registry-mirrors": ["https://b9pmyelo.mirror.aliyuncs.com","http://hub-mirror.c.163.com/"],"insecure-registries": ["https://b9pmyelo.mirror.aliyuncs.com"],"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF# 重启docker服务
systemctl restart docker

部署Harbor作为镜像仓库

本小节我们使用docker-compose来部署Harbor作为镜像仓库。

⛵️Harbor离线安装包下载地址:https://github.com/goharbor/harbor/releases
⛵️Harbor部署配置:https://goharbor.io/docs/2.7.0/install-config/
⛵️docker-compose安装包下载:https://github.com/docker/compose/releases/

准备工作:

mkdir /opt/harbor && cd /opt/harbor
mv /root/harbor-offline-installer-v2.5.6.tgz /opt/harbor
tar zxvf harbor-offline-installer-v2.5.6.tgz
cd harbor
cp harbor.yml.tmpl harbor.yml 
vi harbor.yml
# -配置hostname为指定IP或者FQDN
# -配置admin用户密码harbor_admin_password
# -先注释https相关配置(生产环境不推荐)# 安装docker-compose
cp /root/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose version

部署本地Harbor:

# 部署Harbor
cd /opt/harbor/harbor
./prepare   # 会生成一个docker-compose.yml
./install.sh  # 启动Harbor
docker-compose up -d
# 停止Harbor
docker-compose down -v

部署完检查:

# 需要在docker-compose.yml文件同级目录下执行
[root@harborgit harbor]# docker-compose psName                     Command                       State                          Ports
-----------------------------------------------------------------------------------------------------------------
harbor-core         /harbor/entrypoint.sh            Up (health: starting)
harbor-db           /docker-entrypoint.sh 96 13      Up (health: starting)
harbor-jobservice   /harbor/entrypoint.sh            Up (health: starting)
harbor-log          /bin/sh -c /usr/local/bin/ ...   Up (health: starting)   127.0.0.1:1514->10514/tcp
harbor-portal       nginx -g daemon off;             Up (health: starting)
nginx               nginx -g daemon off;             Up (health: starting)   0.0.0.0:80->8080/tcp,:::80->8080/tcp
redis               redis-server /etc/redis.conf     Up (health: starting)
registry            /home/harbor/entrypoint.sh       Up (health: starting)
registryctl         /home/harbor/start.sh            Up (health: starting)

部署完成后,可以直接浏览器访问上面配置的hostname打开Harbor前端页面,使用admin用户登录。

在这里插入图片描述

部署GitLab作为代码仓库

⭐️官方地址:https://about.gitlab.com/install/#official-linux-package

使用docker部署GitLab:

mkdir /opt/gitlab
echo 'export GITLAB_HOME=/opt/gitlab' >> /root/.bash_profile
source /root/.bash_profile# 容器部署giltab(镜像名称放到最后)
docker run --detach --hostname gitlab.demo.com \--publish 443:443 --publish 88:80 --publish 2222:22 \--name gitlab --restart always \--volume $GITLAB_HOME/config:/etc/gitlab \--volume $GITLAB_HOME/logs:/var/log/gitlab \--volume $GITLAB_HOME/data:/var/opt/gitlab \gitlab/gitlab-ce

取决于镜像拉取的速度,部署完成大概需要3到5分钟。检查部署状态:

[root@harborgit harbor]# docker ps
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS                    PORTS                                                            NAMES
c0795ec3b34e        gitlab/gitlab-ce                     "/assets/wrapper"        5 minutes ago       Up 5 minutes (healthy)    0.0.0.0:443->443/tcp, 0.0.0.0:2222->22/tcp, 0.0.0.0:88->80/tcp   gitlab
3fa9ce8ec05d        goharbor/nginx-photon:v2.5.6         "nginx -g 'daemon of…"   14 minutes ago      Up 14 minutes (healthy)   0.0.0.0:80->8080/tcp                                             nginx
07f156592a2f        goharbor/harbor-jobservice:v2.5.6    "/harbor/entrypoint.…"   14 minutes ago      Up 14 minutes (healthy)                                                                    harbor-jobservice
3cfdec233a2c        goharbor/harbor-core:v2.5.6          "/harbor/entrypoint.…"   14 minutes ago      Up 14 minutes (healthy)                                                                    harbor-core
b3ae94a48b85        goharbor/harbor-registryctl:v2.5.6   "/home/harbor/start.…"   15 minutes ago      Up 14 minutes (healthy)                                                                    registryctl
00e7fc671a26        goharbor/registry-photon:v2.5.6      "/home/harbor/entryp…"   15 minutes ago      Up 14 minutes (healthy)                                                                    registry
b84e56987d36        goharbor/harbor-db:v2.5.6            "/docker-entrypoint.…"   15 minutes ago      Up 14 minutes (healthy)                                                                    harbor-db
faf6f9d624cb        goharbor/redis-photon:v2.5.6         "redis-server /etc/r…"   15 minutes ago      Up 14 minutes (healthy)                                                                    redis
f913b1c4c27c        goharbor/harbor-portal:v2.5.6        "nginx -g 'daemon of…"   15 minutes ago      Up 14 minutes (healthy)                                                                    harbor-portal
f964a7a7492a        goharbor/harbor-log:v2.5.6           "/bin/sh -c /usr/loc…"   15 minutes ago      Up 15 minutes (healthy)   127.0.0.1:1514->10514/tcp                                        harbor-log

部署完成后(容器状态为healthy),访问地址http://IP:88即可打开GitLab前端页面。初次登录需要设置root管理员用户密码。

获取管理员用户初始密码:

docker logs <gitlab容器ID> | grep initial_root_password
cat /opt/gitlab/config/initial_root_password

在这里插入图片描述

常用Git命令

# git全局设置
git config --global user.name "admin"
git config --global user.email "admin@example.com"# 创建一个新仓库
git clone git@gitlab.demos.com:root/java_demo.git
cd java_demo
touch README.md
git commit -m "add README"
git push -u origin master# 推送现有文件夹
cd existing_folder
git init
git remote add origin git@gitlab.demos.com:root/java_demo.git
git add .
git commit -m "Initial commit"
git push -u origin master# 推送现有Git仓库
cd existing_repo
git remote rename origin old-origin
git remote add origin git@gitlab.demos.com:root/java_demo.git
git push -u origin --all
git push -u origin --tags
http://www.ds6.com.cn/news/71459.html

相关文章:

  • 高端网站建设创新百度极速版app下载
  • 什么网站可以做微传单百度热搜榜排名今日第一
  • 镇江建工建设集团网站百度推广电话客服
  • 如何做文化传播公司网站软件开发公司排行榜
  • 公司网站域名实名认证怎么做外贸营销推广
  • dw做网站怎么写弹出客服邮箱南京广告宣传公司seo
  • 带孩子做网站aso优化方案
  • 北京东站深圳百度百科
  • 做服装设计兼职的网站天津关键词优化网排名
  • 建一个公司网站要多少钱竞彩足球最新比赛
  • 上海市建设工程合同备案网站百度数据中心
  • 公司网站开发怎么收费手机怎么在百度上发布信息
  • 2023半夜免费b站推广成都seo技术经理
  • 佛山自定义网站建设自媒体是如何赚钱的
  • 成都电子商务网站建设公司中央刚刚宣布大消息
  • 软件外包公司能去吗有没有免费的seo网站
  • 公司网站发展规划书外链工具软件
  • 小江网站建设公司营销网络是什么意思
  • 如何做视频播放网站沧州网站建设推广
  • 深圳网站建设工作室第三波疫情将全面大爆发
  • 怎么给网站有一字做标记长沙做搜索引擎的公司
  • 个人电子简历模板seo投放是什么意思
  • 娄底网站建设百度移动seo首选帝搜软件
  • 全网营销推广联系方式成都seo排名
  • 建网站不花钱免费适合推广的app有哪些
  • 做网站能创业吗2021最近比较火的营销事件
  • 网站建设方案书备案seo优化方向
  • 网站建设在哪个软件下做今日头条荆州新闻
  • 进入江苏省住房和城乡建设厅网站谷歌浏览器 安卓下载2023版官网
  • 网站推广站点建设与策划7月新闻大事件30条