Be Your Own Cloud code · PART 4 — MAKING IT RESILIENT

Chapter 21 Monitoring and Alerts: Knowing Before It's a Crisis

2 blocks · pp. 96–97 in the paperback

Setting Up a Real Notification Channel

# p. 96

File /opt/stacks/ntfy/docker-compose.yml
services:
  ntfy:
    image: binwiederhier/ntfy:v2.28.0
    container_name: ntfy
    command: serve
    restart: unless-stopped
    environment:
      # your server's address
      - NTFY_BASE_URL=http://192.168.1.50:8380
      # iPhone only -- see below
      - NTFY_UPSTREAM_BASE_URL=https://ntfy.sh
    volumes:
      - ./data:/var/cache/ntfy
    ports:
      - '8380:80'

Watching Restic, Not Just Guessing

# p. 97

Add to /opt/scripts/backup.sh

Append to the end of the script.

# Add as the last line of /opt/scripts/backup.sh from Chapter 18.
# set -euo pipefail means this line is only reached if every step
# above succeeded.
curl -fsS -m 10 --retry 3 \
  'https://your-uptime-kuma-url/api/push/YOUR_PUSH_TOKEN?status=up&msg=OK'

Reproduced exactly from Be Your Own Cloud, Chapter 21. The book explains what each line does and what to do when it doesn't work. About the book

Something here not working as the book describes? Tell the author.