version: "3.7"

services:
  excalidraw:
    container_name: excalidraw
    image: excalidraw/excalidraw:latest
    ports:
      - ${APP_PORT}:80
    restart: unless-stopped
    networks:
      - tipi_main_network
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.excalidraw-web-redirect.redirectscheme.scheme: https
      traefik.http.services.excalidraw.loadbalancer.server.port: 80
      # Web
      traefik.http.routers.excalidraw-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.excalidraw-insecure.entrypoints: web
      traefik.http.routers.excalidraw-insecure.service: excalidraw
      traefik.http.routers.excalidraw-insecure.middlewares: excalidraw-web-redirect
      # Websecure
      traefik.http.routers.excalidraw.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.excalidraw.entrypoints: websecure
      traefik.http.routers.excalidraw.service: excalidraw
      traefik.http.routers.excalidraw.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.excalidraw-local-insecure.rule: Host(`excalidraw.${LOCAL_DOMAIN}`)
      traefik.http.routers.excalidraw-local-insecure.entrypoints: web
      traefik.http.routers.excalidraw-local-insecure.service: excalidraw
      traefik.http.routers.excalidraw-local-insecure.middlewares: excalidraw-web-redirect
      # Local domain secure
      traefik.http.routers.excalidraw-local.rule: Host(`excalidraw.${LOCAL_DOMAIN}`)
      traefik.http.routers.excalidraw-local.entrypoints: websecure
      traefik.http.routers.excalidraw-local.service: excalidraw
      traefik.http.routers.excalidraw-local.tls: true