1.准备gitlab
打开settings----> application
在Redirect URI写入:
http://192.168.1.1/login
PS: login必须写的如果不写必然出问题
这些最好都点上
然后记录Application ID和Secret
2.准备droneci的docker
安装docker-compose环境查看这个教程 docker-compose安装教程
准备通信的DRONE_RPC_SECRET
openssl rand -hex 16
准备一下drone 的docker-compose yaml文件
version: '2'
networks:
monitor:
driver: bridge
services:
drone:
image: drone/drone:1
container_name: drone
hostname: drone
restart: always
volumes:
- ./drone:/var/lib/drone
environment:
- DRONE_GITLAB_SERVER=http://{192.168.1.1} #gitlab 地址
- DRONE_GITLAB_CLIENT_ID= Application ID #填写Application ID
- DRONE_GITLAB_CLIENT_SECRET= Secret #填写Secret
- DRONE_RPC_SECRET= #填写刚刚准备的DRONE_RPC_SECRET
- DRONE_SERVER_HOST=192.168.11.1 #droneci的主机地址
- DRONE_SERVER_PROTO=http
- DRONE_USER_CREATE=username:testuser,admin:true #这个必须要加 如果你的drone要挂载必须要写
ports:
- "80:80"
- "443:443"
networks:
- monitor
drone-runner-ssh:
image: drone/drone-runner-ssh
container_name: drone-runner-ssh
hostname: drone-runner-ssh
restart: always
environment:
- DRONE_RPC_PROTO=http
- DRONE_RPC_HOST=192.168.11.1
- DRONE_RPC_SECRET= #填写刚刚准备的DRONE_RPC_SECRET
- DRONE_DEBUG=true
ports:
- "10081:3000"
networks:
- monitor
drone-runner-docker:
image: drone/drone-runner-docker:1
container_name: drone-runner-docker
hostname: drone-runner-docker
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DRONE_RPC_PROTO=http
- DRONE_RPC_HOST=192.168.11.1:80
- DRONE_RPC_SECRET= #填写刚刚准备的DRONE_RPC_SECRET
- DRONE_RUNNER_CAPACITY=2
- DRONE_RUNNER_NAME=node1
- DRONE_DEBUG=true
ports:
- "10082:3000"
networks:
- monitor
3.启动drone
docker-compose -f docker-compose.yaml up -d