docker-Gitlab、GitLab Runner安装
以下操作均在CentOs下操作
1、Gitlab install
① 启动gitlab
docker run --detach \
--hostname 115.30.149.35 \
--publish 8888:8888 --publish 24:22 \
--name gitlab \
--restart always \
--volume /data/docker/gitlab/config:/etc/gitlab \
--volume /data/docker/gitlab/logs:/var/log/gitlab \
--volume /data/docker/gitlab/data:/var/opt/gitlab \
--privileged=true \
gitlab/gitlab-ce:latest
--hostname 当前服务器的域名
--publish 24:22 SSH访问端口 默认22:22
--publish 8888:8888 http访问的端口 默认是80:80
--publish 443:443 https访问的端口
--privileged=true 授权
--volume 三个卷挂载gitlab的数据,需要提前创建好
443是https端口 80默认是http端口 根据官网文档,更改端口需要更改对应的配置文件。所在的配置信息存放在
/etc/gitlab/gitlab.rb。映射在主机的/data/docker/gitlab/config。
② 配置GitLab
由于我们没用使用默认的暴露端口,因此需要修改 /data/docker/gitlab/config/gitlab.rb。
Ⅰ、修改external_url
:
# For HTTP external_url "http://115.30.149.35:8888"
or
For HTTPS (notice the https)
external_url "http://115.30.149.35:8888"
Ⅱ、修改gitlab_shell_ssh_port
:
itlab_rails['gitlab_shell_ssh_port'] = 24
更多配置信息可以参考官方文档。
③ 重启gitlab
docker restart gitlab
④ 访问gitlab
浏览器输入 http://115.30.149.35:8888
官方建议4G内存,启动gitlab很吃CPU。
1核2G gitlab启动服务器卡死。解决方案:
https://yq.aliyun.com/articles/52098
2、Gitlab Runner Install
①安装gitlab-runnner rpm包
在这里选择适合你系统的gitlab runner包https://gitlab-runner-downloads.s3.amazonaws.com/latest/index.html
curl -LJO https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64.rpm
②安装rpm 包
rpm -i gitlab-runner_amd64.rpm
③注册Runner
Ⅰ、Run the following command
gitlab-runner register
Ⅱ、Enter your GitLab instance URL:(GitLab实例地址,上面GitLab的地址)
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
http://115.30.149.35:8888
Ⅲ、Enter the token you obtained to register the Runner(输入注册Runner的token):
Please enter the gitlab-ci token for this runner
hUCad4cXYPEKTt
token所在地方:
1、登入GitLabhttp://115.30.149.35:8888
2、点击工具刀
3、Overview->Runners
红色框里面即为token。
Ⅳ、Enter a description for the Runner, you can change this later in GitLab’s UI(添加Runner描述):
Please enter the gitlab-ci description for this runner
my-runner
Ⅴ、Add a Tag
Please enter the gitlab-ci tags for this runner (comma separated):
Ⅵ、Enter the Runner executor:
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
shell
④刷新GitLab页面
可看到注册的Runner。
3、提交项目到gitlab
1、创建一个项目
2、按照提示将我们的项目提交到gitlab上(Push an existing folder)
git remote add origin http://115.30.149.35:8888/root/miniserver-userapi.git
关闭VS
git push 的提示要输入gitlab的用户名和密码
编写以下.gitlab-ci.yml文件(需要放在整个项目的根目录)
提交 在具体的project 的CICD下即可看到项目在跑
4、问题集合
问题一、
docker gitlab 的用户组没有加入docker
usermod -aG docker gitlab-runner
sudo service docker restart
问题二、某次CI失败后再启动
fatal: git fetch-pack: expected shallow list
fatal: The remote end hung up unexpectedly
原因是git版本太老不持之新API,需要升级一下git:
#安装源
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
#安装git
yum install git
#更新git
yum update git
参考资料:
Gitlab:https://docs.gitlab.com/omnibus/docker/
GitLab Runner:https://docs.gitlab.com/runner/install/linux-manually.html
docker-Gitlab、GitLab Runner安装的更多相关文章
- Docker搭建自己的Gitlab CI Runner
转载自:https://cloud.tencent.com/developer/article/1010595 1.Gitlab CI介绍 CI:持续集成,我们通常使用CI来做一些自动化工作,比如程序 ...
- Docker安装GitLab与Runner(网关),常规设置,自动化用到k8s+token
[转]图文详解k8s自动化持续集成之GitLab CI/CD Windows里面使用Debian命令行工具完成 和Docker网络相关的命令 查看某一个容器的网络 docker inspect 容器I ...
- docker搭建gitlab,设置邮件提醒,并运行runner
接着http://www.cnblogs.com/wsy1030/p/8431837.html 在另一台机子运行gitlab: docker run --name='gitlab' -d -p 222 ...
- 在 Kubernetes 上安装 Gitlab CI Runner Gitlab CI 基本概念以及 Runner 的安装
简介 从 Gitlab 8.0 开始,Gitlab CI 就已经集成在 Gitlab 中,我们只要在项目中添加一个.gitlab-ci.yml文件,然后添加一个Runner,即可进行持续集成.在介绍 ...
- 3.在 Kubernetes 上安装 Gitlab CI Runner
结合文章:1. 在 Kubernetes 上安装 Gitlab ,地址:https://www.cnblogs.com/sanduzxcvbnm/p/13852854.html 总结: 结合开头的文章 ...
- 利用docker compose启动gitlab及runner
添加docker compose配置文件 新建文件docker-compose.yml,输入如下内容: gitlab: image: 'gitlab/gitlab-ce:latest' contain ...
- [转] Gitlab 8.x runner安装与配置
[From]http://muchstudy.com/2018/07/13/Gitlab-8-x-runner%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE ...
- Gitlab CI持续集成 - GitLab Runner 安装与注册
GitLab Runner安装 需要添加gitlab官方库: # For Debian/Ubuntu/Mint curl -L https://packages.gitlab.com/install/ ...
- Linux下GitLab的快速安装以及备份
源码安装 GitLab 步骤繁琐:需要安装依赖包,Mysql,Redis,Postfix,Ruby,Nginx……安装完毕还得一个个手动配置这些软件,容易出错 一.安装 在Ubuntu 14上 修改/ ...
随机推荐
- Java 学习笔记(15)——反射
Java中的类文件最终会被编译为.class 文件,也就是Java字节码.这个字节码中会存储Java 类的相关信息.在JVM执行这些代码时首先根据 java 命令中指定的类名找到.class 文件然后 ...
- 防火墙TCP的单向控制
网络拓扑: 如上图所示,防火墙分为external/internal/dmz三个安全zone,其中10.133.1.100/32为dmz区的一台squid缓存服务器,10.158.1.10/32,10 ...
- Vsual Studio 2010可用的sqlite驱动程序(实体数据模型使用)
背景 昨天一个旧的项目(.net framework 4 + EF4 +sqlite + edmx db first),数据库结构有变更,要更新实体edmx模型 先是到官网下载最新的驱动,结果不能更新 ...
- Linux下搭建实现HttpRunnerManager的异步执行、定时任务及任务监控
前言 在之前搭建的HttpRunnerManager接口测试平台,我们还有一些功能没有实现,比如异步执行.定时任务.任务监控等,要完成异步执行,需要搭建 RabbitMQ 等环境,今天我们就来实现这些 ...
- 关于KMP的一点思考
关于KMP的一点思考 KMP的\(next\)数组的性质很精妙,有必要开一个坑学习一下 Part 1 啥是next \(next[i]\)表示对于\(pre_i\)这个字符串,这个抠出来的字符串本身后 ...
- 洛谷$P5366\ [SNOI2017]$遗失的答案 数论+$dp$
正解:数论$dp$ 解题报告: 传送门$QwQ$ 考虑先质因数分解.所以$G$就相当于所有系数取$min$,$L$就相当于所有系数取$max$ 这时候考虑,因为数据范围是$1e8$,$1e8$内最多有 ...
- 洛谷$P$3301 $[SDOI2013]$方程 $exLucas$+容斥
正解:$exLucas$+容斥 解题报告: 传送门! 在做了一定的容斥的题之后再看到这种题自然而然就应该想到容斥,,,? 没错这题确实就是容斥,和这题有点儿像 注意下的是这里的大于和小于条件处理方式不 ...
- 「UVA1328」Period 解题报告
English题面 题意: 给你一个长度为n的字符串,依次取字符串前i个(前缀),如果前缀由k(k>0)个相同真子串构成,那么输出i和k 直到n为0结束,每组数据后要有一行空白 思路: KMP+ ...
- 「算法竞赛进阶指南」0x01 最短Hamilton路径 解题报告
题目在这里啊题目在这里~ Hamilton路径:将所有点都遍历刚好一次的路径 思路: 数据范围比较小(1~20),所以我们可以考虑暴力中的枚举 数组f[i][j] i的二进制表示选取了哪些点 j表示 ...
- DNS服务器红帽5.4搭建图文教程!!!
DNS服务器 挂载光盘 mount 查看光盘所在位置 mount -t iso9660 设备目录 /mnt 表示挂载 软件包安装 所有软件包都在Server目录下 rpm -ivh /mnt/Serv ...