# documentation: https://docs.ntfy.sh/
# slogan: ntfy is a simple HTTP-based pub-sub notification service. It allows you to send notifications to your phone or desktop via scripts from any computer, and/or using a REST API.
# tags: ntfy, notification, push notification, pub-sub, notify
# logo: svgs/ntfy.svg
# port: 80

services:
  ntfy:
    image: binwiederhier/ntfy
    command:
      - serve
    environment:
      - SERVICE_FQDN_NTFY_80
      - NTFY_BASE_URL=${SERVICE_FQDN_NTFY}
      - TZ=${TZ:-UTC}
      - NTFY_CACHE_FILE=/var/cache/ntfy/cache.db
      - NTFY_AUTH_FILE=/var/lib/ntfy/auth.db
      - NTFY_UPSTREAM_BASE_URL=${UPSTREAM_BASE_URL:-https://ntfy.sh}
      - NTFY_ENABLE_SIGNUP=${NTFY_ENABLE_SIGNUP:-true} 
      - NTFY_ENABLE_LOGIN=${NTFY_ENABLE_LOGIN:-true}
      - NTFY_CACHE_DURATION=${NTFY_CACHE_DURATION:-24h}
      - NTFY_ATTACHMENT_TOTAL_SIZE_LIMIT=${NTFY_ATTACHMENT_TOTAL_SIZE_LIMIT:-1G} 
      - NTFY_ATTACHMENT_FILE_SIZE_LIMIT=${NTFY_ATTACHMENT_FILE_SIZE_LIMIT:-10M}
      - NTFY_ATTACHMENT_EXPIRY_DURATION=${NTFY_ATTACHMENT_EXPIRY_DURATION:-24h}
      - NTFY_SMTP_SENDER_ADDR=${NTFY_SMTP_SENDER_ADDR:-smtp.your-domain.de} 
      - NTFY_SMTP_SENDER_USER=${NTFY_SMTP_SENDER_USER:-no-reply@de}
      - NTFY_SMTP_SENDER_PASS=${NTFY_SMTP_SENDER_PASS:-password}
      - NTFY_SMTP_SENDER_FROM=${NTFY_SMTP_SENDER_FROM:-no-reply@de}
      - NTFY_KEEPALIVE_INTERVAL=${NTFY_KEEPALIVE_INTERVAL:-5m}
      - NTFY_MANAGER_INTERVAL=${NTFY_MANAGER_INTERVAL:-5m}
      - NTFY_VISITOR_MESSAGE_DAILY_LIMIT=${NTFY_VISITOR_MESSAGE_DAILY_LIMIT:-100}  
      - NTFY_VISITOR_ATTACHMENT_DAILY_BANDWIDTH_LIMIT=${NTFY_VISITOR_ATTACHMENT_DAILY_BANDWIDTH_LIMIT:-1G}
      - NTFY_UPSTREAM_ACCESS_TOKEN=${UPSTREAM_ACCESS_TOKEN}
      - NTFY_AUTH_DEFAULT_ACCESS=${NTFY_AUTH_DEFAULT_ACCESS:-read-write}
      - NTFY_WEB_PUSH_PUBLIC_KEY=${NTFY_WEB_PUSH_PUBLIC_KEY}
      - NTFY_WEB_PUSH_PRIVATE_KEY=${NTFY_WEB_PUSH_PRIVATE_KEY}
      - NTFY_WEB_PUSH_EMAIL_ADDRESS=${NTFY_WEB_PUSH_EMAIL_ADDRESS}
    volumes:
      - ntfy-cache:/var/cache/ntfy
      - ntfy-db:/var/lib/ntfy/
    healthcheck:
      test: ["CMD-SHELL", "wget -q --tries=1 http://localhost:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1"]
      interval: 60s
      timeout: 10s
      retries: 3
      start_period: 40s
