# ntfy - Push notifications
# Port: 8081 - ntfy server
# Port: 8095 - Gitea webhook bridge
# Simple pub-sub notification service with Gitea integration

version: "3.9"
services:
  ntfy:
    image: binwiederhier/ntfy
    container_name: NTFY
    command:
      - serve
    environment:
      - TZ=America/Los_Angeles
    volumes:
      - /home/homelab/docker/ntfy:/var/cache/ntfy:rw
      - /home/homelab/docker/ntfy/config:/etc/ntfy:rw
    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
    ports:
      - 8081:80  # Exposing on port 8081
    restart: on-failure:5

  gitea-ntfy-bridge:
    image: python:3.12-alpine
    container_name: gitea-ntfy-bridge
    environment:
      - NTFY_URL=https://ntfy.vish.gg
      - NTFY_TOPIC="REDACTED_NTFY_TOPIC"
      - TZ=America/Los_Angeles
      - PYTHONUNBUFFERED=1
    ports:
      - "8095:8095"
    volumes:
      - /home/homelab/docker/gitea-ntfy-bridge:/app:ro
    command: ["python", "-u", "/app/bridge.py"]
    restart: unless-stopped
    depends_on:
      - ntfy
