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

地方生活门户网站建设方案网页平面美工培训

地方生活门户网站建设方案,网页平面美工培训,租车公司网站 模板,城口网站建设背景 GitLab 是一个强大的版本控制系统和协作平台#xff0c;记录一下在实际工作中关于 GitLab 的安装使用记录。 一开始使用 GitLab 时#xff0c;是在 CentOS7 上直接以 rpm 包的方式进行安装#xff0c;仅作为代码托管工具来使用#xff0c;版本#xff1a; 14.10.4 …背景 GitLab 是一个强大的版本控制系统和协作平台记录一下在实际工作中关于 GitLab 的安装使用记录。 一开始使用 GitLab 时是在 CentOS7 上直接以 rpm 包的方式进行安装仅作为代码托管工具来使用版本 14.10.4 。 后续预研 GitLab 的 CI/CD 及流水线时采用 Docker 方式安装版本 16.2.3-jh 引入了 GitLab Runner 版本 16.2.0 。 系统环境 [rootgitlab1 opt]# uname -a Linux gitlab1 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux [rootgitlab1 opt]# cat /proc/version Linux version 3.10.0-1127.el7.x86_64 (mockbuildkbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Mar 31 23:36:51 UTC 2020 [rootgitlab1 opt]# cat /etc/redhat-release CentOS Linux release 7.8.2003 (Core) [rootgitlab2 ~]# docker -v Docker version 20.10.18, build b40c2f6RPM方式安装GitLab 下载地址清华镜像https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ [rootgitlab1 local]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.10.4-ce.0.el7.x86_64.rpm错误: 无法验证 mirrors.tuna.tsinghua.edu.cn 的由 “/CUS/OLets Encrypt/CNR3” 颁发的证书:颁发的证书已经过期。 解决将https修改为http[rootgitlab1 local]# rpm -ivh gitlab-ce-14.10.4-ce.0.el7.x86_64.rpm 警告gitlab-ce-14.10.4-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY 错误依赖检测失败policycoreutils-python 被 gitlab-ce-14.10.4-ce.0.el7.x86_64 需要解决yum install -y curl policycoreutils-python openssh-server[rootgitlab1 local]# rpm -ivh gitlab-ce-14.10.4-ce.0.el7.x86_64.rpm 警告gitlab-ce-14.10.4-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY 准备中... ################################# [100%] 正在升级/安装...1:gitlab-ce-14.10.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 reconfigureFor a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.mdHelp us improve the installation experience, let us know how we did with a 1 minute survey: https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installationomnibusrelease14-10# 编辑配置设置访问地址 [rootgitlab1 local]# vi /etc/gitlab/gitlab.rb external_url http://gitlab1# 重新配置生效 [rootgitlab1 local]# gitlab-ctl reconfigureRunning handlers: Running handlers complete Chef Infra Client finished, 606/1618 resources updated in 05 minutes 34 secondsWarnings: Rehashing of trusted certificates present in /etc/gitlab/trusted-certs failed. If on a FIPS-enabled machine, ensure c_rehash binary is available in $PATH.Notes: Default admin account has been configured with following details: Username: root Password: You didnt opt-in to print initial root password to STDOUT. Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.gitlab Reconfigured!Note: 如何查看版本信息在GitLab后台中查看版本在部署域名/IP后加上help。如果修改了ip或者端口等配置信息每次更改完之后务必记得重新加载配置gitlab-ctl reconfigure。 [rootgitlab1 local]# cat /etc/gitlab/initial_root_password | grep Password 使用浏览器访问配置的地址输入用户名与密码。 GitLab 常用命令 gitlab-ctl start启动gitlabgitlab-ctl stop停止gitlab。gitlab-ctl status查看gitlab状态gitlab-ctl restart重启服务 作为代码仓库 GitLab 使用包括了以下几方面 创建组创建项目添加SSHkey克隆用户注册用户审核加入组 这种方式下如果想使用 CI/CD 功能则需要接着安装 GitLab Runner 不过不建议用这种直接安装的方式来用实际生产更多的是使用 Docker 以及 Kubernetes 分两步安装和注册下载地址https://mirrors.tuna.tsinghua.edu.cn/gitlab-runner/yum/el7/ Note: GitLab Runner注册分两步获取runner token注册GitLab Runner分为共享型、分组型、项目型分别在不同的位置注册分为交互式和非交互式两种方式。 Docker方式安装使用GitLab 新开一台虚拟机使用 Docker 的方式来安装和运行 GitLab 和 GitLab Runner 。 [rootgitlab2 ~]# cd /opt/ [rootgitlab2 opt]# mkdir gitlab [rootgitlab2 opt]# export GITLAB_HOME/opt/gitlab根据官方文档安装运行 GitLab Runner 的命令如下: sudo docker run --detach \--hostname gitlab.example.com \--publish 443:443 --publish 80:80 --publish 22: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 \--shm-size 256m \registry.gitlab.cn/omnibus/gitlab-jh:latest实际执行时简化了参数设置了主机名修改了映射端口号。 docker run -d \-h gitlab2 \-p 80:80 -p 222:22 \--name gitlab \--restart always \-v $GITLAB_HOME/config:/etc/gitlab \-v $GITLAB_HOME/logs:/var/log/gitlab \-v $GITLAB_HOME/data:/var/opt/gitlab \--shm-size 256m \registry.gitlab.cn/omnibus/gitlab-jh:latestNote: 宿主机的端口22修改为222否则报错 Error starting userland proxy: listen tcp4 0.0.0.0:22: bind: address already in use. 访问极狐 GitLab URL 并使用用户名 root 和来自以下命令的密码登录 [rootgitlab2 ~]# docker exec -it gitlab grep Password: /etc/gitlab/initial_root_password Password: zIrC8HPFfuxVmGSyx27nRbgTRwLaoiIhua2edEySMw通过 Docker 来对 GitLab 的服务管理。 docker start gitlab docker stop gitlab docker restart gitlab docker rm gitlabDocker方式安装注册gitlab-runner 安装GitLab Runner 根据 GitLab 的版本指定了 GitLab Runner 的版本。 docker run -d --name gitlab-runner --restart always \-v /opt/gitlab-runner/config:/etc/gitlab-runner \-v /var/run/docker.sock:/var/run/docker.sock \gitlab/gitlab-runner:v16.2.0# 查看安装的GitLab Runner的版本信息 [rootgitlab2 ~]# docker exec -it gitlab-runner gitlab-runner --version Version: 16.2.0 Git revision: 782e15da Git branch: 16-2-stable GO version: go1.20.5 Built: 2023-07-21T22:52:420000 OS/Arch: linux/amd64注册GitLab Runner 接下来创建组创建项目克隆为项目注册一个 Runner 。 Create new group —— Create new project —— git clone http://gitlab2/iot/test.git # 注册为Shell类型的执行器。 docker run --rm -v /opt/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:v16.2.0 \register \--non-interactive \--executor shell \--url http://192.168.44.149 \--registration-token GR1348941NNVnhpcsLqgBbL-1JxPT \--description shell-runner \--tag-list shell,test \--run-untaggedtrue \--lockedfalse \--access-levelnot_protected注册过程中遇到的问题 ERROR: Registering runner… error runnerGR1348941NNVnhpcs statusonly http or https scheme supported 原因是我将 --url 的值写成了主机名得写成 HTTP 地址链接的形式。 ERROR: Registering runner… failed runnerGR1348941NNVnhpcs statuscouldn’t execute POST against http://gitlab2/api/v4/runners: Post “http://gitlab2/api/v4/runners”: dial tcp: lookup gitlab2 on 192.168.44.2:53: no such host 原因是我将 --url 的值写成了主机名在容器中无法通过主机名注册成功然后改成了 IP 地址注册成功以下是注册成功的效果。 [rootgitlab2 ~]# docker run --rm -v /opt/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:v16.2.0 \register \--non-interactive \--executor shell \--url http://192.168.44.149 \--registration-token GR1348941NNVnhpcsLqgBbL-1JxPT \--description shell-runner \--tag-list shell,test \--run-untaggedtrue \--lockedfalse \--access-levelnot_protected Runtime platform archamd64 oslinux pid7 revision782e15da version16.2.0 Running in system-mode. WARNING: Support for registration tokens and runner parameters in the register command has been deprecated in GitLab Runner 15.6 and will be replaced with support for authentication tokens. For more information, see https://gitlab.com/gitlab-org/gitlab/-/issues/380872 Registering runner... succeeded runnerGR1348941NNVnhpcs Runner registered successfully. Feel free to start it, but if its running already the config should be automatically reloaded!Configuration (with the authentication token) was saved in /etc/gitlab-runner/config.toml CI/CD 为了体验下 GitLab Runner 的 CI/CD 功能接下来以一段后端服务构建与部署的配置来模拟实际的流水线过程在创建的项目根目录下新建文件 .gitlab-ci.yml 提交后项目会自动启动流水线的执行。 stages:- build- deploybuild:stage: buildtags:- shellonly:- masterscript:- echo mvn clean- echo mvn packagedeploy:stage: deploytags:- testonly:- masterscript:- echo java -jar x.jarCI/CD 过程中遇到的问题 第一次添加上述配置文件并提交后并没有触发流水线。。 原来在我用的新版 GitLab 中的主分支从 master 改为了 main 修改 .gitlab-ci.yml 中的分支名称即可。 流水线失败Job日志fatal: unable to access ‘http://gitlab2/iot/test.git/’: Could not resolve host: gitlab2 感觉还是因为 Docker 容器无法获取宿主机的主机名进入 gitlab-runner 所在的容器 ping 宿主机 ip 是通的但是主机名不通简单的办法是在 config.toml 文件中添加 clone_url http://192.168.44.149 以 IP 的方式来拉取代码。 # 没有自带ping命令自行安装 root249b6b18ffa8:/# apt update root249b6b18ffa8:/# apt install -y iputils-ping# 修改配置增加clone_url配置跟url并列 [rootgitlab2 ~]# vi /opt/gitlab-runner/config/config.toml clone_url http://192.168.44.149# 重启gitlab-runner所在容器 [rootgitlab2 ~]# docker restart gitlab-runner gitlab-runner改成以上配置后手动启动一个 Pipeline 执行成功。 # 进入容器 [rootgitlab2 ~]# docker exec -it gitlab-runner /bin/bash# 列出所有的runner root249b6b18ffa8:/# gitlab-runner list Runtime platform archamd64 oslinux pid27 revision782e15da version16.2.0 Listing configured runners ConfigFile/etc/gitlab-runner/config.toml shell-runner Executorshell TokenXQEENnyfzyEVs8-2iDB9 URLhttp://192.168.44.149# 查看runner的状态 root249b6b18ffa8:/# gitlab-runner verify Runtime platform archamd64 oslinux pid37 revision782e15da version16.2.0 Running in system-mode. Verifying runner... is alive runnerXQEENnyfNote: CI Lint可以用来校验.gitlab-ci.yml的语法一个流水线包含多个作业每个作业下至少包含一个script。修改服务器的IP之后Docker容器无法从服务器外部访问 # 服务器IP更改之后linux数据包转发配置net.ipv4.ip_forward会变为0即关闭状态。 [rootgitlab2 ~]# sysctl net.ipv4.ip_forward net.ipv4.ip_forward 0# 重启dockerdocker会默认将net.ipv4.ip_forward值临时改为1再次新增或更改IP之后会失效 [rootgitlab2 ~]# systemctl restart docker小总结 以上是安装和使用 GitLab 的过程以及CI/CD初体验 GitLab 是一个功能丰富、易于使用和安全可靠的协作平台可以帮助团队更好地管理和开发项目。 集成的工作流程GitLab 提供了一个集成的工作流程包括代码托管、问题跟踪、持续集成和部署等功能。这使得团队成员可以在同一个平台上协作开发和管理项目。代码托管GitLab 提供了强大的代码托管功能支持 Git 分布式版本控制系统。团队成员可以轻松地共享和管理代码进行版本控制和协作开发。问题跟踪GitLab 提供了问题跟踪功能可以帮助团队成员记录和解决项目中的问题。通过问题跟踪团队成员可以更好地协作和追踪项目进展。持续集成和部署GitLab 提供了强大的持续集成和部署功能可以自动化构建、测试和部署代码。这可以大大提高开发效率和代码质量。安全性GitLab 提供了强大的安全性功能包括访问控制、权限管理和代码审查等。这可以帮助团队保护代码和敏感信息的安全。 Reference https://docs.gitlab.cn/runner/register/ If you have any questions or any bugs are found, please feel free to contact me. Your comments and suggestions are welcome!
http://www.dnsts.com.cn/news/189405.html

相关文章:

  • 信息产业部icp备案中心网站直播小程序源码
  • 企业网站报价方案下载站长工具seo客户端
  • 德宏芒市建设局网站网站建设培训 上海
  • 建设银行手机银行官方网站下载南京个人做网站
  • 公众号建网站如皋市网站建设
  • 系统网站wordpress需要哪些插件
  • 织梦做的网站老是被黑asp.net p2p网站开发
  • 景德镇陶瓷学院校友做网站的网络游戏电脑
  • 网站模板下载 网盘世界杯大数据
  • 网站做导航设计的作用是什么wordpress伪静态 404
  • 万网域名注册官网邮箱优化网站价格
  • 建立企业网站步骤wordpress哔哩哔哩视频播放器
  • 怎么办网站石家庄网站建设外包公司
  • 自己做的网站地址手机怎么打不开网站被k怎么
  • 做网站每个月可以赚多少大连开发区凯旋国际
  • 中国做网站的网站自己做的手机网站怎么加入小程序
  • 怎么建立一个网站让百度搜到乐山网站开发
  • 信阳网站开发随州网站推广哪家专业
  • 东莞专业网站设计专业服务企业网站怎么做连接
  • 廊坊网站建站建设住房和城乡建设部政务服务门户
  • 装修公司做网站推广能接到活吗有没有网页设计专业
  • 网站优化主要工作有那些内容大连百度代理
  • 网站推广策划书模板太原建设北路小学网站
  • 手机网站一般多宽建筑工人找活正规平台
  • 个人网站课程设计报告网页设计教程详细步骤ppt
  • 北京网站设计案例百度竞价广告推广
  • 网站优化关键词价格58同城推广
  • 保定市住房保障和城乡建设局网站六安网站开发
  • 网站收缩引擎入口琼山网站制作
  • 建设银行网站介绍wordpress 如何安装