Running Drone via Traefik


#1

Hey there - I’ve tried to troubleshoot this with answers in the forums to no avail. Forgive me if this has been answered before. I’m able to access the drone server locally when running the docker-compose file below but not via the internet. I’m also using Cloudflare as a CDN. Any tips on how to resolve a 504 error are much appreciated.

version: "3"

networks:
  web:
    external: true

  traefik:
    image: traefik:latest
    container_name: traefik
    command: --api --docker
    volumes:
      - ${DOCKER_SOCKET}:/var/run/docker.sock:ro
      - "${CONFIG}/traefik/acme.json:/acme.json"
      - "${CONFIG}/traefik/traefik.toml:/etc/traefik/traefik.toml"

    labels:
      - "traefik.enabled=false"
      - "traefik.docker.network=web"
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.frontend.rule=Host:monitor.${DOMAIN}"
      - "traefik.backend=monitor-service"
      - "traefik.port=8080"
    networks:
      - web
    dns:
      - 8.8.8.8
      - 8.8.4.4
    ports:
      - "80:80"
      - "443:443"
      - "8000:8080"
    environment:
      - CF_API_EMAIL=${CF_API_EMAIL}
      - CF_API_KEY=${CF_API_KEY}
    restart: unless-stopped

  drone:
    volumes:
      - "${DOCKER_SOCKET}:/var/run/docker.sock"
      - "${CONFIG}/drone:/data"
    environment:
      - "DRONE_GITHUB_SERVER=https://github.com"
      - "DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID}"
      - "DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_SECRET}"
      - "DRONE_GIT_ALWAYS_AUTH=false"
      - "DRONE_RUNNER_CAPACITY=2"
      - "DRONE_SERVER_HOST=drone.${DOMAIN}"
      - "DRONE_SERVER_PROTO=https"
      - "DRONE_LOGS_DEBUG=true"
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.rule=Host:drone.${DOMAIN}"
      - "traefik.backend=drone-service"
      - "traefik.docker.network=web"
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.port=1080"
    ports:
      - "1080:80"
      # - "1043:443"
    restart: always
    container_name: drone
    image: "drone/drone:1.0.0-rc.5"

#2

Thanks to some good tips about setting up Traefik from this guide on DigitalOcean I’m now seeing a 502 error instead of the 504 error. Whilst I don’t have access yet I think this is progress.

Based on this post the 502 is probably down to my Traefik config and a conflict around TLS or HTTPS redirect.


#3

I’ve been able to resolve this - I’d failed to add the ‘web’ network to the config for drone. Thanks for making great software - it’s making a big difference to my workflow already.