services:
  wordpress_traxler:
    image: wordpress:latest
    container_name: wordpress_traxler
    restart: unless-stopped
    environment:
      WORDPRESS_DB_HOST: mariadb:3306
      WORDPRESS_DB_USER: ${MYSQL_USER:?MYSQL_USER not set}
      WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD:?MYSQL_PASSWORD not set}
      WORDPRESS_DB_NAME: ${MYSQL_DATABASE:?MYSQL_DATABASE not set}
    volumes:
      - wordpress_traxler:/var/www/html
      - ./php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
    networks:
      - traefik-network
      - mariadb
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik-network"

      # Router Hauptdomain
      - "traefik.http.routers.wp_traxler.rule=Host(`johann.byhaider.dev`)"
      - "traefik.http.routers.wp_traxler.entrypoints=websecure"
      - "traefik.http.routers.wp_traxler.tls=true"
      - "traefik.http.routers.wp_traxler.tls.certresolver=cloudflare"
      - "traefik.http.services.wp_traxler.loadbalancer.server.port=80"

      # Router www → Middleware
      # - "traefik.http.routers.wp_traxler_www.rule=Host(`www.traxler.at`)"
      # - "traefik.http.routers.wp_traxler_www.entrypoints=websecure"
      # - "traefik.http.routers.wp_traxler_www.tls=true"
      # - "traefik.http.routers.wp_traxler_www.tls.certresolver=cloudflare"
      # - "traefik.http.routers.wp_traxler_www.middlewares=wp-redirect-www"

networks:
  traefik-network:
    external: true
  mariadb:
    external: true

volumes:
  wordpress_traxler:
    external: true
