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