services:
  ntfy:
    image: binwiederhier/ntfy
    container_name: ntfy
    restart: unless-stopped
    command:
      - serve
    environment:
      TZ: America/Chicago
      NTFY_BASE_URL: ${NTFY_URL}
      #NTFY_LOG_LEVEL: debug
      NTFY_BEHIND_PROXY: true
      NTFY_ENABLE_SIGNUP: false
    user: 1001:1001
    volumes:
      - /srv/docker/utilities/ntfy/cache:/var/cache/ntfy
      - /srv/docker/utilities/ntfy/config:/etc/ntfy
      - /srv/docker/utilities/ntfy/db:/var/lib/ntfy/
      - /srv/docker/utilities/ntfy/lib:/var/lib/ntfy/
      - /srv/docker/utilities/ntfy/log:/var/log
    ports:
      - 8880:80
    healthcheck:                                       # Optional: Health check to ensure ntfy is running properly.
        test: ["CMD-SHELL", "wget -q --tries=1 http://localhost:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1"]
        interval: 60s                                  # Runs the health check every 60 seconds.
        timeout: 10s                                   # Timeout for the health check is 10 seconds.
        retries: 3                                     # If the health check fails, retries 3 times.
    networks:
      - proxy-net
networks:
  proxy-net:
    external: true