gitea + drone ci

29/05/2020

gitea manages git repos
drone allows to execute tasks automatically on each git push

Add this in composer :

    gitea:
        image: gitea/gitea:latest
        container_name: gitea
        restart: always
        volumes:
            - ./gitea:/data
        ports:
            - "10022:22"
        labels:
            - traefik.enable=true
            - traefik.http.routers.gitea.rule=Host(`gitea.${DOMAIN}`)
            - traefik.http.services.gitea.loadbalancer.server.port=3000
            - traefik.http.routers.gitea.tls.certresolver=le
            - traefik.http.routers.gitea.entrypoints=websecure
            - traefik.http.routers.gitea.middlewares=securityheaders
            - backup.driver=rsync

    drone:
        image: drone/drone:1
        restart: always
        container_name: drone
        volumes:
            - /var/lib/drone:/data
        environment:
            - "DRONE_GITEA_SERVER=https://gitea.${DOMAIN}"
            # create an app in gitea
            - "DRONE_GITEA_CLIENT_ID=xxxxxxxxxxxx"
            - "DRONE_GITEA_CLIENT_SECRET=xxxxxxxxxxxx"
            - "DRONE_GIT_ALWAYS_AUTH=true"
            - "DRONE_RPC_SECRET=${PASSWORD}"
            - "DRONE_SERVER_HOST=drone.${DOMAIN}"
            - "DRONE_SERVER_PROTO=https"
            # this url will be called on each drone event : can be used to deploy or monitor
            - DRONE_WEBHOOK_ENDPOINT=http://172.17.0.1:1234
            - DRONE_WEBHOOK_SECRET=${PASSWORD}
        labels:
            - traefik.enable=true
            - traefik.http.routers.drone.rule=Host(`drone.${DOMAIN}`)
            - traefik.http.services.drone.loadbalancer.server.port=80
            - traefik.http.routers.drone.tls.certresolver=le
            - traefik.http.routers.drone.entrypoints=websecure
            - traefik.http.routers.drone.middlewares=securityheaders

    dronerunner:
        image: drone/drone-runner-docker:1
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
        environment:
            - "DRONE_RPC_PROTO=https"
            - "DRONE_RPC_HOST=drone.${DOMAIN}"
            - "DRONE_RPC_SECRET=${PASSWORD}"
            - "DRONE_RUNNER_CAPACITY=2"
            - "DRONE_RUNNER_NAME=dronerunner"
        restart: always
        container_name: dronerunner

Raccourcis