码迷,mamicode.com
首页 > 其他好文 > 详细

drone +gitlab使用

时间:2020-09-17 19:26:43      阅读:26      评论:0      收藏:0      [点我收藏+]

标签:network   show   cert   tar   doc   png   com   service   closed   

部署gitlab

 

 

部署drone

技术图片
# ip:xxxxxxxx ci-build
### docker-compose.yml
#测试成功,附带mysql
version: "2.1"

services:

  drone-server:
    image: drone/drone:1
    ports:
      - 443:443
      - 80:80
    volumes:
      - /var/lib/drone:/data
    restart: always
    depends_on:
      - mysql
    environment:
      - DRONE_DATABASE_DATASOURCE=/var/lib/drone/drone.sqlite
      - DRONE_DATABASE_DRIVER=sqlite3
      - DRONE_DATABASE_DRIVER=mysql
      - DRONE_DATABASE_DATASOURCE=root:root@tcp(ci_mysql:3306)/drone?parseTime=true
      - DRONE_AGENTS_ENABLED=true
      - DRONE_LOGS_DEBUG=true
      - DRONE_GIT_ALWAYS_AUTH=false
      - DRONE_GITLAB_SERVER=http://192.168.10.54:8083/ # gitlab服务器地址
      - DRONE_GITLAB_CLIENT_ID=ea11d55c67c47043d409d90a14fce1043f82231b45809b30a3f5bc0cee711bf7  # application ID
      - DRONE_GITLAB_CLIENT_SECRET=b4846990c58ffb5ce494e697a1c09225edf3025c5275ee527b32157a0e1b2e83 # Secret
      - DRONE_RPC_SECRET=e349d16fa70e27bdd1043c1ec3d83478 # 为server和agent设置一个统一识别码 随便输,但必须前后一致
      - DRONE_USER_CREATE=username:root,admin:true # 为drone的settings添加Trued username是gitlab用户名 admin默认为true
      - DRONE_RUNNER_CAPACITY=3
      - DRONE_SERVER_HOST=192.168.10.202  # drone服务器地址
      - DRONE_SERVER_PROTO=http
      - DRONE_TLS_AUTOCERT=false
    networks:
      - ci_net


  drone-agent:
    image: drone/drone-runner-docker:1
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:rw
    environment:
      - DRONE_RPC_PROTO=http
      - DRONE_RPC_HOST=192.168.10.202 # 服务器地址
      - DRONE_RPC_SECRET=e349d16fa70e27bdd1043c1ec3d83478
      - DRONE_RUNNER_CAPACITY=3
      - DRONE_RUNNER_NAME=ip # runner名字 默认为服务器ip
      - DRONE_LOGS_TRACE=true
    networks:
      - ci_net

  mysql:
    restart: always
    image: mysql:5.7.16
    container_name: ci_mysql
    command: --default-authentication-plugin=mysql_native_password #这行代码解决无法访问的问题
    volumes:
      - ./mydir:/mydir
      - ./datadir:/var/lib/mysql
      - ./conf/my.cnf:/etc/my.cnf
      #      数据库还原目录 可将需要还原的sql文件放在这里
      - /docker/mysql/source:/docker-entrypoint-initdb.d
    environment:
      - "MYSQL_ROOT_PASSWORD=root"
      - "MYSQL_DATABASE=drone"
      - "TZ=Asia/Shanghai"
    networks:
      - ci_net
    ports:
      - 3307:3306

networks:
  ci_net:
    driver: bridge
View Code

 

互联

1.允许本地访问

技术图片

 2.配置访问令牌(确保令牌的账户可以访问自动部署项目)

技术图片

 

drone +gitlab使用

标签:network   show   cert   tar   doc   png   com   service   closed   

原文地址:https://www.cnblogs.com/huay/p/13637304.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!