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"
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.
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.
gordonpn
(Gordon)
April 2, 2020, 3:48am
4
Hey Hugh, do you have updated configuration files by chance you could share with me? I can’t get it working for some reason.
This works for me
#----------------------------------------------------------------#
# Router #
#----------------------------------------------------------------#
services:
traefik:
image: "traefik:v2.2"
container_name: "traefik"
restart: always
command:
#- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.sslresolver.acme.httpchallenge=true"
- "--certificatesresolvers.sslresolver.acme.httpchallenge.entrypoint=web"
#- "--certificatesresolvers.sslresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.sslresolver.acme.email=info@dataxu.io"
- "--certificatesresolvers.sslresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- ./traefik.toml:/etc/traefik/traefik.toml
- ./letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
#----------------------------------------------------------------#
# CI #
#----------------------------------------------------------------#
drone:
image: "drone/drone:1.6.5"
container_name: "drone"
restart: always
depends_on:
- traefik
volumes:
- "/var/lib/drone:/data"
environment:
- DRONE_GITLAB_SERVER=https://gitlab.com
- DRONE_GITLAB_CLIENT_ID=
- DRONE_GITLAB_CLIENT_SECRET=
- DRONE_RPC_SECRET=
- DRONE_SERVER_HOST=
- DRONE_SERVER_PROTO=https
- DRONE_USER_CREATE=username:droneadm,admin:true
labels:
- "traefik.enable=true"
- "traefik.http.routers.ci.rule=Host(`ci.example.io`)"
- "traefik.http.routers.ci.tls=true"
- "traefik.http.routers.ci.tls.certresolver=sslresolver"
drone-runner:
image: "drone/drone-runner-docker:1.2.1"
container_name: "drone-runner"
restart: always
depends_on:
- drone
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:rw"
ports:
- "3000:3000"
environment:
- DRONE_RPC_PROTO=https
- DRONE_RPC_HOST=ci.example.io
- DRONE_RPC_SECRET=
- DRONE_RUNNER_CAPACITY=2
- DRONE_RUNNER_NAME=${HOSTNAME}