4.4 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a Docker-based home infrastructure stack running 40+ self-hosted services. The primary orchestration file is docker-compose.yaml (2000+ lines). All services are configured via environment variables in .env.
Domain: sebson.space — Traefik handles reverse proxy and Let's Encrypt TLS for all subdomains.
Common Commands
All commands must be run from /home/seba/mydocker.
# Service management
docker compose up -d # Start all services
docker compose down # Stop all services
docker compose ps # List running containers
docker compose logs -f <service> # Follow logs for a service
docker compose restart <service> # Restart a service
# Upgrade a specific service (pull + recreate)
./upgrade-container-by-name.sh <service> # Upgrade service
./upgrade-container-by-name.sh <service> prune # Upgrade + prune old images
# Database backup (dumps all PostgreSQL DBs → Google Drive via rclone)
./backup_db.sh
# Truncate container logs
./truncate_logs.sh <container_name>
torrent-box-with-vpn subproject
cd torrent-box-with-vpn
make start / stop / restart
make update_containers # pull + restart all
make generate_certificate
make backup
Architecture
Reverse Proxy
Traefik (traefik:v3.6.8) is the single entry point for all HTTPS traffic. Services opt-in via Docker labels (traefik.enable=true). Let's Encrypt certs stored in ./traefik/letsencrypt/. Dashboard at traefik.sebson.space.
Networking
- Host network:
homeassistant,esphome,mosquitto,unifi,unifi-db,node-exporter— these need direct host network access for device discovery/mDNS/hardware metrics. - VPN namespace:
qbittorrent,radarr,prowlarrroute all traffic throughgluetun(NordVPN, Germany). These services connect vianetwork_mode: "service:gluetun". - Everything else uses the default bridge network.
Storage Layout
| Mount | Purpose |
|---|---|
/media/seagata16t/ |
16TB — photos, Hikvision recordings, backups |
/media/evo2t/ |
Fast SSD — Frigate clips, caches |
/media/asustor/ |
NAS — qBit downloads, movies |
/media/wd1t/ |
Secondary storage |
Key Service Groups
Home Automation: Home Assistant (stable) → Mosquitto (MQTT) → ESPHome (ESP devices) + Frigate (cameras with AMD GPU radeonsi).
Media: Jellyfin + Immich (PostgreSQL 14 with vectorchord, ML via CLIP/buffalo_l, Redis cache).
Monitoring stack: Prometheus → Grafana + Victoria Metrics (long-term). Logs: Promtail → Loki. Node Exporter, cAdvisor, Ping Exporter, Pushgateway, SmartCTL Exporter.
Databases: postgres18 (PostgreSQL 18) serves homeassistant, bitwarden/vaultwarden, and immich. MongoDB 4.4 serves UniFi controller.
Security: Crowdsec (analyzes Traefik + auth logs), Bitwarden/Vaultwarden (YubiKey 2FA).
Custom Python Services (side-agent/)
A custom container runs three daemons:
snapit.py— Monitors Frigate clips, detects objects, pushes metrics to Pushgatewaycontainer_manager.py— Tracks container versions inside-agent/manifest/container_versions.yaml, automates updatesbackup_scheduler.py— Schedules backup operations
Dependencies: requests, docker, PyYAML, python-dateutil, schedule.
Brana Frontend
Custom nginx-based dashboard built from a local Dockerfile in ./brana/. Static site served at brana.sebson.space.
Key Configuration Files
docker-compose.yaml— Single source of truth for all services.env— All secrets and environment variables (DB passwords, VPN credentials, API keys, static IPsHOST_IP_HA,HOST_IP_ADGUARD)prometheus/prometheus.yml— Scrape targetsloki/loki-config.yaml/promtail/promtail-config.yaml— Log pipelineside-agent/manifest/container_versions.yaml— Tracked container versions for automated updatesfrigate/config— Camera definitions and AI detection config
Environment Conventions
TZ=Europe/PraguePUID=1000,PGID=1000— Used by LinuxServer.io images for file permission alignment- PostgreSQL superuser:
homeassistant(historical default, used across all DBs) - Backup logs:
/home/seba/mydocker/backup.log