目录
一、实验
1.环境
2.OpenEuler 部署 drone 持续集成平台
二、问题
1.drone登录失败
一、实验
1.环境
(1)主机
表1 主机
系统 | 架构 | 版本 | IP | 备注 |
Linux | openEuler | 22.03 LTS SP2 | 192.168.204.145(动态) 192.168.204.141(静态) 192.168.204.142(静态) | |
MySQL | 8.0.36 | 数据库 | ||
gogs | 0.13.0 | 代码仓库 | ||
docker | 25.0.3 | |||
drone | 2.6.0 | 持续集成平台 | ||
drone-runner-docker | 1.4.0 |
(2)查看系统版本
[root@localhost ~]# cat /etc/os-release
(3) 查看网络ip
[root@localhost ~]# ip addr
(4) 查看MySQL版本
[root@localhost ~]# mysql -V
(5) 查看docker版本
[root@localhost ~]# docker -v
(6)查看gogs的仓库
2.OpenEuler 部署 drone 持续集成平台
(1)官网
1)官网
https://www.drone.io/
2)文档
https://docs.drone.io/server/provider/gogs/
(2)拉取Drone-server镜像
搜索
[root@localhost ~]# docker search drone/drone
NAME DESCRIPTION STARS OFFICIAL
drone/drone Drone is a Continuous Integration platform b… 384
drone/drone-runner-docker 39
drone/drone-exec 7
drone/drone-runner-kube 4
drone/drone-runner-ssh 4
drone/drone-blocker 0
drone/drone-wall 0
drone/drone-convert-starlark 0
drone/drone-runner-nomad 0
drone/drone-manage 0
drone/drone-jsonnet 0
drone/drone-runner-digitalocean 0
drone/drone-runner-aws 1
drone/drone-admit-members 0
drone/drone-build 2
drone/drone-runner-macstadium 0
drone/drone-desktop-docker-extension 1
拉取
[root@localhost ~]# docker pull drone/drone:2.6.0
(3)安装Drone-server容器
docker run -itd \
--env=DRONE_AGENTS_ENABLED=true \
--env=DRONE_GOGS_SERVER=http://192.168.204.141:3000 \
--env=DRONE_SERVER_PROTO=http \
--env=DRONE_SERVER_HOST=192.168.204.141:20080 \
--env=DRONE_USER_CREATE=username:administrator,admin:true \
--env=DRONE_RPC_SECRET=123456 \
--name=drone-server \
--restart=always \
-p 20080:80 \
-v /home/drone/server/data:/data \
drone/drone:2.6.0
(4)拉取Drone-runner-docker镜像
[root@localhost ~]# docker pull drone/drone-runner-docker:1.4.0
(5)安装Drone-runner-docker
docker run -itd \
--env=DRONE_RPC_PROTO=http \
--env=DRONE_RPC_HOST=192.168.204.141:20080 \
--env=DRONE_RPC_SECRET=123456 \
--env=DRONE_RUNNER_CAPACITY=2 \
--env=DRONE_RUNNER_NAME=drone-runner-line \
--name=drone-runner \
--restart=always \
-p 23000:3000 \
-v /var/run/docker.sock:/var/run/docker.sock \
drone/drone-runner-docker:1.4.0
(6)查看日志
[root@localhost ~]# docker logs -f drone-runner
INFO[0000] starting the server addr=":3000"
INFO[0000] successfully pinged the remote server
INFO[0000] polling the remote server arch=amd64 capacity=2 endpoint="http://192.168.204.141:20080" kind=pipeline os=linux type=docker
(7)查看进程
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
965e6c8a8575 drone/drone-runner-docker:1.4.0 "/bin/drone-runner-d…" 18 minutes ago Up 18 minutes 0.0.0.0:23000->3000/tcp, :::23000->3000/tcp drone-runner
80714f28b755 drone/drone:2.6.0 "/bin/drone-server" 18 minutes ago Up 18 minutes 443/tcp, 0.0.0.0:20080->80/tcp, :::20080->80/tcp drone-server
(8)登录Drone
http://localhost:20080
输入账户密码
填写基本信息
(9)进入系统
可以看到gogs的仓库
(10)激活仓库
点击 ACTIVE REPOSITORY
打开Trusted
保存
二、问题
1.drone登录失败
(1)报错
(2)原因分析
docker创建容器时指定的gogs地址有误。
(3)解决方法
修改docker创建容器时指定的gogs地址。
修改前:
……
--env=DRONE_GOGS_SERVER=http://localhost:3000 \
……
修改后:
……
--env=DRONE_GOGS_SERVER=http://192.168.204.141:3000 \
……
成功: