version: '3.3'

services:
  authelia:
    image: authelia/authelia
    container_name: authelia
    volumes:
      - ./config:/config
    networks:
      - traefik-proxy
    labels:
      - 'traefik.enable=true'
      - 'traefik.http.routers.authelia.rule=Host(`${URL_AUTH}`)'
      - 'traefik.http.routers.authelia.entrypoints=websecure'
      - 'traefik.http.routers.authelia.tls=true'
      - 'traefik.http.routers.authelia.tls.certresolver=letsencrypt'
      - 'traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://${URL_AUTH}'  # yamllint disable-line rule:line-length
      - 'traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true'
      - 'traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email'  # yamllint disable-line rule:line-length
    expose:
      - 9091
    restart: unless-stopped
    healthcheck:
      disable: true
    environment:
      - TZ=Europe/Paris

  redis:
    image: redis:alpine
    container_name: redis
    volumes:
      - ./redis:/data
    networks:
      - traefik-proxy
    expose:
      - 6379
    restart: unless-stopped
    environment:
      - TZ=Europe/Paris

  secure:
    image: traefik/whoami
    container_name: secure
    networks:
      - traefik-proxy
    labels:
      - 'traefik.enable=true'
      - 'traefik.http.routers.secure.rule=Host(`test.nuage.omvpb.ovh`)'
      - 'traefik.http.routers.secure.entrypoints=websecure'
      - 'traefik.http.routers.secure.tls=true'
      - 'traefik.http.routers.secure.tls.certresolver=letsencrypt'
      - 'traefik.http.routers.secure.middlewares=authelia@docker'
    expose:
      - 80
    restart: unless-stopped

networks:
  traefik-proxy:
    external:
      name: ${NETWORK_TRAEFIK}
