version: "3.7"
########################### NETWORKS
# There is no need to create any networks outside this docker-compose file.
# You may customize the network subnets (192.168.90.0/24 and 91.0/24) below as you please.
# Docker Compose version 3.5 or higher required to define networks this way.
networks:
  gl_proxy:
    name: gl_proxy
    driver: bridge
    ipam:
      config:
        - subnet: $GL_PROXY_SUBNET
  default:
    driver: bridge
  gl_socket_proxy:
    name: gl_socket_proxy
    driver: bridge
    ipam:
      config:
        - subnet: $GL_SOCKET_PROXY_SUBNET

########################### SECRETS
#secrets:
#  htpasswd:
#    file: $SECRETSDIR/htpasswd
#  authelia_jwt_secret:
#    file: $SECRETSDIR/authelia_jwt_secret
#  authelia_session_secret:
#    file: $SECRETSDIR/authelia_session_secret
#  authelia_storage_mysql_password:
#    file: $DOCKERDIR/secrets/authelia_storage_mysql_password
#  authelia_notifier_smtp_password:
#    file: $DOCKERDIR/secrets/authelia_notifier_smtp_password
#  authelia_duo_api_secret_key:
#    file: $DOCKERDIR/secrets/authelia_duo_api_secret_key
########################### SERVICES
services:
  # Heimdall - Unified Frontend Alternative
  yourls:
    container_name: gl-yourls
    image: yourls:latest
    restart: unless-stopped
    networks:
      gl_proxy:
        ipv4_address: $YOURLS_IP
    security_opt:
      - no-new-privileges:true
    # ports:
    #   - "$HEIMDALL_PORT:80"
    volumes:
      - $DOCKERDIR/appdata/yourls:/config
    environment:
      - YOURLS_DB_HOST=$DB_HOST:$DB_PORT
      - YOURLS_DB_NAME=GL_Yourls
      - YOURLS_DB_USER=yourls
      - YOURLS_DB_PASS=yourls
      - YOURLS_SITE=https://yourls.$DOMAINNAME0
      - YOURLS_USER=gurulandia
      - YOURLS_PASS=Gurul4nd144dm
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.yourls-rtr.entrypoints=https"
      - "traefik.http.routers.yourls-rtr.rule=(Host(`yourls.$DOMAINNAME0`) && PathPrefix(`/admin`))"
      #- "traefik.http.routers.yourls-rtr.rule=HostHeader(`yourls.$DOMAINNAME0`)"
      ## Middlewares
      - "traefik.http.routers.yourls-rtr.middlewares=chain-authelia@file"
      #- "traefik.http.middlewares.yourls-add-admin.addprefix.prefix=/admin"
      #- "traefik.http.routers.yourls-rtr.middlewares=yourls-add-admin@docker"
      ## HTTP Services
      - "traefik.http.routers.yourls-rtr.service=yourls-svc"
      - "traefik.http.services.yourls-svc.loadbalancer.server.port=80"
