version: "3.7"

services:
  gotify:
    image: gotify/server:2.1.7
    container_name: gotify
    restart: unless-stopped
    volumes:
      - "${APP_DATA_DIR}/data:/app/data"
    environment:
      - GOTIFY_DEFAULTUSER_NAME=${GOTIFY_DEFAULTUSER_NAME}
      - GOTIFY_DEFAULTUSER_PASS=${GOTIFY_DEFAULTUSER_PASS}
    ports:
      - ${APP_PORT}:80
    networks:
      - tipi_main_network
    labels:
      traefik.enable: ${APP_EXPOSED}
      # Traefik Redirect to HTTPS
      traefik.http.middlewares.redirect-https.redirectScheme.scheme: https
      traefik.http.middlewares.redirect-https.redirectScheme.permanent: true
      # Traefik Router + Service Configuration
      traefik.http.routers.gotify.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.gotify.entrypoints: websecure
      traefik.http.routers.gotify.tls.certresolver: myresolver
      traefik.http.routers.gotify.middlewares: redirect-https
      traefik.http.routers.gotify.service: gotify
      traefik.http.services.gotify.loadbalancer.passhostheader: true
      traefik.http.services.gotify.loadbalancer.server.port: 80
      traefik.http.services.gotify.loadbalancer.sticky: true
      traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto: http