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

Chapter 22 When Things Go Wrong: A Troubleshooting Playbook

4 blocks · pp. 99–101 in the paperback

Step 1: Is It the Network, or Is It the Service?

# p. 99

Run Terminal, on another machine at home
# Can you reach the host at all?
ping homeserver.local

# Is DNS resolving correctly? (Chapter 10)
nslookup nextcloud.yourdomain.com

# Can you reach it directly by IP, bypassing DNS and the reverse
# proxy?
curl -k https://192.168.x.x:PORT

Step 2: Is the Reverse Proxy the Break?

# p. 100

Run Terminal, on the server
# Check the proxy's own logs
docker logs npm --tail 50

# Check certificate validity and expiry
echo | openssl s_client -connect nextcloud.yourdomain.com:443 \
  2>/dev/null | openssl x509 -noout -dates

Step 3: Is the Container Actually Running?

# p. 100

Run Terminal, on the server
docker ps -a | grep <service-name>

# If it's not 'Up', check why it stopped
docker logs <service-name> --tail 100

# Resource exhaustion is a common silent cause
docker stats --no-stream
df -h
free -h

Step 4: Did Something Change?

# p. 101

Run Terminal, in the service's folder
# What images are actually running vs. what's pinned in compose?
docker compose images

# When did the host last reboot?
uptime -s

# Recent changes to a service's compose/env files
ls -la --time-style=full-iso /opt/stacks/<service-name>/

Reproduced exactly from Be Your Own Cloud, Chapter 22. 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.