# 🚀 ntfy Quick Reference Guide

## 📱 Access Points

- **Web UI**: https://ntfy.vish.gg or http://atlantis.vish.local:8081
- **Topic**: `homelab-alerts`
- **Portainer**: http://atlantis.vish.local:10000

## 🔧 Quick Modifications

### Change Notification Topic

1. **For Monitoring Alerts**:
   ```bash
   # Edit: hosts/vms/homelab-vm/alerting.yaml (line 69)
   NTFY_TOPIC = os.environ.get('NTFY_TOPIC', 'NEW-TOPIC-NAME')
   ```

2. **For Git Events**:
   ```bash
   # Edit: hosts/vms/homelab-vm/ntfy.yaml (line 33)
   - NTFY_TOPIC="REDACTED_NTFY_TOPIC"
   ```

3. **Apply via Portainer**: Stack → Update (GitOps auto-pulls)

### Add New Alert Rules

```yaml
# Add to monitoring.yaml prometheus_config:
rule_files:
  - "/etc/prometheus/alert-rules.yml"

alerting:
  alertmanagers:
    - static_configs:
        - targets: ["alertmanager:9093"]
```

### Test Notifications

```bash
# Direct test
curl -H "Title: Test" -d "Hello!" https://ntfy.vish.gg/REDACTED_NTFY_TOPIC

# Alert bridge test
curl -X POST http://atlantis.vish.local:5001/alert \
  -H "Content-Type: application/json" \
  -d '{"alerts":[{"status":"firing","labels":{"alertname":"Test","severity":"warning"},"annotations":{"summary":"Test alert"}}]}'
```

## 🏗️ Current Setup

| Service | Port | Purpose |
|---------|------|---------|
| ntfy Server | 8081 | Main notification server |
| Alertmanager | 9093 | Alert routing |
| ntfy-bridge | 5001 | Alert formatting |
| signal-bridge | 5000 | Signal forwarding |
| gitea-bridge | 8095 | Git notifications |

## 📊 Container Status

```bash
# Check via Portainer API
curl -s -H "X-API-Key: "REDACTED_API_KEY" \
  "http://atlantis.vish.local:10000/api/endpoints/443399/docker/containers/json" | \
  jq '.[] | select(.Names[0] | contains("ntfy") or contains("alert")) | {Names: .Names, State: .State}'
```

## 🔍 Troubleshooting

- **iOS not working**: Check `upstream-base-url: "https://ntfy.sh"` in server config
- **No alerts**: Check Prometheus targets at http://atlantis.vish.local:9090/targets
- **Bridge issues**: Check health endpoints: `/health` on ports 5000, 5001

## 📁 Key Files

- **ntfy Config**: `hosts/vms/homelab-vm/ntfy.yaml`
- **Alerting Config**: `hosts/vms/homelab-vm/alerting.yaml`
- **Monitoring Config**: `hosts/vms/homelab-vm/monitoring.yaml`
- **Test Script**: `scripts/test-ntfy-notifications.sh`

---

*For detailed information, see: [ntfy-notification-system.md](ntfy-notification-system.md)*