networks:
  woodpecker:
    external: false
    enable_ipv6: true

volumes:
  server:
    driver: local

services:
  server:
    image: woodpeckerci/woodpecker-server:v2.8.0
    container_name: woodpecker_server
    environment:
      - WOODPECKER_OPEN=true
      - WOODPECKER_ADMIN=mael
      - WOODPECKER_HOST=https://cicd.gnous.eu
      - WOODPECKER_SERVER_ADDR=:4001
      - WOODPECKER_GRPC_ADDR=:4002
      - WOODPECKER_GRPC_SECURE=true
      - WOODPECKER_GRPC_VERIFY=true

      - WOODPECKER_GITEA=true
      - WOODPECKER_GITEA_URL=https://git.gnous.eu
      - WOODPECKER_GITEA_CLIENT=${WOODPECKER_GITEA_CLIENT}
      - WOODPECKER_GITEA_SECRET=${WOODPECKER_GITEA_SECRET}

      - WOODPECKER_DATABASE_DRIVER=postgres
      - WOODPECKER_DATABASE_DATASOURCE=postgres://woodpecker:${WOODPECKER_DB_PASS}@${MEP_DB_HOST}/woodpecker
    restart: always
    networks:
      - woodpecker
    volumes:
      - server:/var/lib/woodpecker/
    ports:
      - "4001:4001"
      - "4002:4002"
    labels:
      - "traefik.enable=true"
      # web server
      - "traefik.http.services.woodpecker-service-gnous.loadbalancer.server.port=4001"
      - "traefik.http.routers.woodpeckergnous.rule=Host(`cicd.gnous.eu`)"
      - "traefik.http.routers.woodpeckergnous.tls=true"
      - "traefik.http.routers.woodpeckergnous.tls.certresolver=defaultacme"
      - "traefik.http.routers.woodpeckergnous.entrypoints=websecure"
      - "traefik.http.routers.woodpeckergnous.service=woodpecker-service-gnous"
      - "traefik.http.routers.woodpeckergnous.middlewares=proxyHeader@file,proxyError@file"
      #  gRPC service
      - "traefik.http.services.woodpecker-grpc-gnous.loadbalancer.server.port=4002"
      - "traefik.http.services.woodpecker-grpc-gnous.loadbalancer.server.scheme=h2c"
      - "traefik.http.routers.woodpecker-grpc-gnous.rule=Host(`grpc.cicd.gnous.eu`)"
      - "traefik.http.routers.woodpecker-grpc-gnous.tls=true"
      - "traefik.http.routers.woodpecker-grpc-gnous.tls.certresolver=defaultacme"
      - "traefik.http.routers.woodpecker-grpc-gnous.entrypoints=websecure"
      - "traefik.http.routers.woodpecker-grpc-gnous.service=woodpecker-grpc-gnous"
      - "traefik.http.routers.woodpecker-grpc-gnous.middlewares=woodpecker-grpc-redirect@docker"
      - "traefik.http.routers.woodpecker-grpc-gnous.middlewares=proxyHeader@file,proxyError@file"