Self-hosted monitoring for homelabs: host and container metrics and uptime checks from all your machines in one dashboard, with an optional AI agent that diagnoses incidents and suggests fixes.
Python ai-agentsaiopsdashboarddockerfastapihomelabincident-managementllmmonitoringopenaireactroot-cause-analysisself-hosteduptime-monitoring
chore(config): list every setting in example.env, pass SMTP to the backend
karloks200523e9ce52173f
diff --git a/.claude/skills/security-audit/references/checklist-infra.md b/.claude/skills/security-audit/references/checklist-infra.mdindex f646351..f1f102b 100644--- a/.claude/skills/security-audit/references/checklist-infra.md+++ b/.claude/skills/security-audit/references/checklist-infra.md@@ -2,7 +2,7 @@Čitaj `docker/*` (Dockerfile-ove, `nginx*.conf`, `Caddyfile`, `postgres/init/*.sql`),`compose.yml`, `docker-compose.server.yml`, `collector-compose.yml`, `example.env`,-`.env.example`, `.dockerignore`, `.gitignore`, `.github/workflows/*.yml`, `requirements*.txt`,+`.dockerignore`, `.gitignore`, `.github/workflows/*.yml`, `requirements*.txt`,`src/frontend/package.json` + lockfile.## 1. Dockerfile-ovi@@ -108,8 +108,8 @@ Ovo je opskrbni lanac slika koje hostovi pokreću s root-ekvivalentnim pristupom- [ ] `.gitignore` pokriva `.env`, `*.db`, `*.sqlite`, ključeve, `venv`, `node_modules`.`git ls-files | grep -Ei '\.env$|\.db$|\.sqlite|\.pem$|\.key$|id_rsa|secret|credential'`:- što je **pod gitom**? (`dev.db` je ranije bio.) `.env` i `.env.example` obje postoje:- provjeri da `.env.example` nema stvarne vrijednosti.+ što je **pod gitom**? (`dev.db` je ranije bio.) `.env` i `example.env` obje postoje:+ provjeri da `example.env` nema stvarne vrijednosti.- [ ] **Povijest:** `git log --all --diff-filter=A --name-only | grep -Ei '\.env|\.db|key|secret'`i pretraga uzoraka tajni (`git log -p --all -S'SECRET' -S'PASSWORD' -S'TOKEN'` narazumnom opsegu). Tajna koja je ikad bila u povijesti smatra se kompromitiranom čak idiff --git a/.env.example b/.env.exampledeleted file mode 100644index a41ee6a..0000000--- a/.env.example+++ /dev/null@@ -1,29 +0,0 @@-# Copy to .env, set POSTGRES_PASSWORD and REDIS_PASSWORD, then run: docker compose up -d --build-POSTGRES_PASSWORD=replace-with-a-long-random-password-# Redis holds the login sessions, so it has a password too. Letters and digits only: openssl rand -hex 24-REDIS_PASSWORD=replace-with-another-long-random-password-# Optional: required only if you use the Gemini chat feature.-GEMINI_API_KEY=-AGENT_MODEL=models/gemini-3.5-flash--# Allow anyone to create an account. When false, only the first account can be-# created (false is the default, in every compose file).-# ALLOW_REGISTRATION=false--# Optional: receives JSON alerts for critical daily-checkup findings.-# ADMIN_ALERT_WEBHOOK_URL=https://your-alert-endpoint.example/health--# Servers join by clicking Add on the dashboard; no collector settings needed.-# Optional: an enrollment key (Connect a server → Advanced) skips that approval.-# INFRADECK_ENROLL_KEY=-# Optional: override the name shown on the dashboard (defaults to the hostname).-INFRADECK_SERVER_NAME=--# --- Hosting on a remote server ----# Public HTTPS: point DOMAIN's DNS at the server, open ports 80/443, then run-# docker compose --profile https up -d --build-# DOMAIN=infradeck.example.com-# SESSION_COOKIE_SECURE=true-# Keep the plain-HTTP dashboard port off the internet when Caddy is in front:-# FRONTEND_BIND=127.0.0.1-# FRONTEND_PORT=5173diff --git a/README.md b/README.mdindex f819050..cfadfe3 100644--- a/README.md+++ b/README.md@@ -119,7 +119,7 @@ stack splits them as described above.Requirements: Docker with Compose v2.```bash-cp .env.example .env # then set POSTGRES_PASSWORD and REDIS_PASSWORD (openssl rand -hex 24)+cp example.env .env # then set POSTGRES_PASSWORD and REDIS_PASSWORD (openssl rand -hex 24)docker compose up -d --build```diff --git a/compose.yml b/compose.ymlindex 2758d29..e0d7f0d 100644--- a/compose.yml+++ b/compose.yml@@ -53,6 +53,20 @@ services:SESSION_COOKIE_SECURE: ${SESSION_COOKIE_SECURE:-false}ALLOW_REGISTRATION: ${ALLOW_REGISTRATION:-false}CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:5173}+ SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-86400}+ SESSION_COOKIE_NAME: ${SESSION_COOKIE_NAME:-homie_session}+ LOGIN_RATE_LIMIT: ${LOGIN_RATE_LIMIT:-5}+ LOGIN_RATE_WINDOW_SECONDS: ${LOGIN_RATE_WINDOW_SECONDS:-60}+ REGISTER_RATE_LIMIT: ${REGISTER_RATE_LIMIT:-3}+ REGISTER_RATE_WINDOW_SECONDS: ${REGISTER_RATE_WINDOW_SECONDS:-3600}+ ADMIN_ALERT_WEBHOOK_URL: ${ADMIN_ALERT_WEBHOOK_URL:-}+ # Email notifications (Account → Notifications). Off unless SMTP_HOST and SMTP_FROM are set.+ SMTP_HOST: ${SMTP_HOST:-}+ SMTP_PORT: ${SMTP_PORT:-587}+ SMTP_STARTTLS: ${SMTP_STARTTLS:-true}+ SMTP_USER: ${SMTP_USER:-}+ SMTP_PASSWORD: ${SMTP_PASSWORD:-}+ SMTP_FROM: ${SMTP_FROM:-}# Key that encrypts stored secrets such as two-factor secrets (generate: docker compose run --rm backend python -m src.backend.secrets_box).SECRETS_KEY: ${SECRETS_KEY:-}# Limits on what collectors can do. A check-in must come at least this share of the check interval after thediff --git a/docker-compose.server.yml b/docker-compose.server.ymlindex f6203f5..7de7a5b 100644--- a/docker-compose.server.yml+++ b/docker-compose.server.yml@@ -66,6 +66,13 @@ services:REGISTER_RATE_LIMIT: ${REGISTER_RATE_LIMIT:-3}REGISTER_RATE_WINDOW_SECONDS: ${REGISTER_RATE_WINDOW_SECONDS:-3600}ADMIN_ALERT_WEBHOOK_URL: ${ADMIN_ALERT_WEBHOOK_URL:-}+ # Email notifications (Account → Notifications). Off unless SMTP_HOST and SMTP_FROM are set.+ SMTP_HOST: ${SMTP_HOST:-}+ SMTP_PORT: ${SMTP_PORT:-587}+ SMTP_STARTTLS: ${SMTP_STARTTLS:-true}+ SMTP_USER: ${SMTP_USER:-}+ SMTP_PASSWORD: ${SMTP_PASSWORD:-}+ SMTP_FROM: ${SMTP_FROM:-}# Limits on what collectors can do. A check-in must come at least this share of the check interval after the# previous one (0 switches it off); the install holds at most MAX_SERVERS; /docs is off unless enabled.INGEST_MIN_SPACING_RATIO: ${INGEST_MIN_SPACING_RATIO:-0.25}diff --git a/docs/configuration.md b/docs/configuration.mdindex 8a0885e..b711d05 100644--- a/docs/configuration.md+++ b/docs/configuration.md@@ -4,15 +4,20 @@## Stack (`.env` next to the Compose file)+Every setting below is listed, with no values, in [`example.env`](../example.env): copy it to `.env` and fill in what you need. An empty value means the default shown here.+| Variable | Default | Description ||---|---|---|| `POSTGRES_PASSWORD` | *(required)* | PostgreSQL password. |+| `POSTGRES_DB` / `POSTGRES_USER` | `infradeck` / `infradeck` | Name of the database and its user. Installs from before the rename can keep `homelab` (see [SETUP_DATABASES.md](../SETUP_DATABASES.md)). || `REDIS_PASSWORD` | *(required)* | Redis password. Redis holds the login sessions, so nothing that can merely reach it may use it. Use letters and digits only (`openssl rand -hex 24`) because it is put into a URL. || `GEMINI_API_KEY` | empty | Enables the Homie chat assistant. || `AGENT_MODEL` | `models/gemini-3.5-flash` | Gemini model for the assistant. || `ADMIN_ALERT_WEBHOOK_URL` | empty | Receives JSON alerts for critical `daily_checkup` findings. || `SESSION_COOKIE_SECURE` | `false` (dev), `true` (server file) | Send the login cookie over HTTPS only. |-| `SESSION_TTL_SECONDS` | `86400` | Session lifetime. |+| `SESSION_TTL_SECONDS` | `86400` | Session lifetime without *Remember me*. |+| `SESSION_COOKIE_NAME` | `homie_session` | Name of the sign-in cookie. Change it only if it clashes with another app on the same domain. |+| `SMTP_HOST` / `SMTP_PORT` / `SMTP_STARTTLS` / `SMTP_USER` / `SMTP_PASSWORD` / `SMTP_FROM` | empty / `587` / `true` / empty / empty / empty | Email for incident notifications. Email is off unless `SMTP_HOST` and `SMTP_FROM` are set. || `ALLOW_REGISTRATION` | `false` | Let anyone create an account. When `false` (the default), only the first account can be created. Turning it on prints a security warning at every start. || `MAX_SERVERS` | `200` | The most servers the install holds, however they are added (enrollment key, approval or by hand). || `INGEST_MIN_SPACING_RATIO` | `0.25` | A check-in must arrive at least this share of the server's check interval (and never sooner than 5 seconds) after the previous one, or it is refused with 429. `0` switches the limit off. |diff --git a/example.env b/example.envindex 644aabf..7b4f8e3 100644--- a/example.env+++ b/example.env@@ -1,193 +1,262 @@-# Environment for docker-compose.server.yml (production / self-hosting behind Traefik).-# Copy to .env next to the compose file and fill in the values:+# Every setting Infradeck reads from .env, with no values filled in.+# Copy it next to the compose file and fill in what you need:# cp example.env .env-# Every variable the compose file reads is listed here. Values shown for-# optional settings are the defaults; you can delete any line you don't change.+#+# Lines marked REQUIRED must have a value or the stack refuses to start. Every other line can stay+# empty: an empty value means the default written in its comment. Never commit your filled-in .env.+#+# Which compose file reads a setting:+# both compose.yml (laptop / development) and docker-compose.server.yml (server behind Traefik)+# server docker-compose.server.yml only+# dev compose.yml only+# Remote machines added with "Connect a server" need none of this; see the last sections.-# Strongly recommended: makes a plain `docker compose ...` use the production compose file.-# Without it Compose picks compose.yml (the development stack) and would replace your server-# containers with ones that have no Traefik labels and open registration.-COMPOSE_FILE=docker-compose.server.yml+# =============================================================================+# Which compose file to use+# =============================================================================++# On a server set this to: docker-compose.server.yml+# Then a plain `docker compose ...` uses the server file. Left empty, Compose picks compose.yml (the+# development stack) and would replace your server containers with ones that have no Traefik labels.+COMPOSE_FILE=# =============================================================================# Required# =============================================================================-# Password for the bundled Postgres database. The stack refuses to start-# without it. Use a long random string, e.g. the output of: openssl rand -hex 32-POSTGRES_PASSWORD=<long-random-password>+# REQUIRED (both). Password for the bundled PostgreSQL database. Use a long random string:+# openssl rand -hex 32+POSTGRES_PASSWORD=-# Password for Redis, which holds the login sessions. The stack refuses to start without it. Letters and digits-# only, so it fits in a URL: openssl rand -hex 24-REDIS_PASSWORD=<long-random-password>+# REQUIRED (both). Password for Redis, which holds the sign-in sessions and rate-limit counters.+# Letters and digits only, because it is put into a URL:+# openssl rand -hex 24+REDIS_PASSWORD=-# The domain the dashboard is served on (no https://, no slash). Used for the Traefik router-# and as the default for CORS_ORIGINS below.-DASHBOARD_DOMAIN=<your-domain>+# REQUIRED (server). The domain the dashboard is served on, without https:// and without a slash,+# for example infradeck.example.com. Used for the Traefik router and the default CORS_ORIGINS.+DASHBOARD_DOMAIN=-# Your Traefik setup. Defaults shown; set them to match your Traefik's static configuration-# (entryPoints / certificatesResolvers) and the Docker network it is attached to-# (docker network ls, or: docker inspect <traefik-container> --format '{{json .NetworkSettings.Networks}}').-TRAEFIK_ENTRYPOINT=websecure-TRAEFIK_CERT_RESOLVER=letsencrypt-TRAEFIK_NETWORK=traefik_default-# Name of this dashboard's Traefik router and service; only change it if it clashes with another one.-TRAEFIK_ROUTER=infradeck+# =============================================================================+# Database+# =============================================================================-# URL(s) the dashboard is opened from, comma-separated, if it differs from https://<DASHBOARD_DOMAIN>-# (for example a second address). Browser requests from other origins are rejected. Include-# https:// and no trailing slash. Leave commented to use the default.-# CORS_ORIGINS=https://<your-domain>+# (both) Name of the database and of its user. Default: infradeck+# Installs from before the rename to Infradeck can set both to homelab instead of renaming the+# database; see SETUP_DATABASES.md.+POSTGRES_DB=+POSTGRES_USER=# =============================================================================-# Secrets at rest (needed for two-factor sign-in)+# Two-factor sign-in# =============================================================================-# Key that encrypts secrets the app must read back, such as two-factor secrets. Without it two-factor-# can't be set up and is not enforced. Keep it out of backups of the database. Generate one with:+# (both) Key that encrypts secrets the app must read back, such as two-factor secrets and notification+# addresses. Without it two-factor sign-in can't be set up and is not enforced. Keep it out of database+# backups. Generate one with:# docker compose run --rm backend python -m src.backend.secrets_box-# To rotate, put the new key first and keep the old one after a comma: SECRETS_KEY=<new>,<old>+# To rotate, put the new key first and keep the old one after a comma: <new>,<old>SECRETS_KEY=# =============================================================================-# AI chat (optional)+# Traefik (server)# =============================================================================-# Google Gemini API key for the chat assistant. Leave empty to disable chat;-# monitoring works without it. Get one at https://aistudio.google.com/apikey-GEMINI_API_KEY=<your-gemini-api-key>+# (server) Names from your Traefik setup: the HTTPS entrypoint and certificate resolver from Traefik's+# static configuration (entryPoints / certificatesResolvers), and the Docker network Traefik is on+# (docker network ls, or: docker inspect <traefik-container> --format '{{json .NetworkSettings.Networks}}').+# Defaults: websecure, letsencrypt, traefik_default+TRAEFIK_ENTRYPOINT=+TRAEFIK_CERT_RESOLVER=+TRAEFIK_NETWORK=-# Gemini model used by the chat assistant.-AGENT_MODEL=models/gemini-3.5-flash+# (server) Name of this dashboard's Traefik router and service. Change it only if it clashes with+# another one. Default: infradeck+TRAEFIK_ROUTER=# =============================================================================-# Accounts and login sessions+# HTTPS without Traefik (dev, optional Caddy profile)# =============================================================================-# When false, only the first account can register; after that, sign-up is-# closed. Set to true to let anyone who can reach the site create an account.-# Only the exact value "true" enables it.-ALLOW_REGISTRATION=false--# Send the login cookie over HTTPS only. Keep true when served through Traefik-# over HTTPS; set to false only if you use the dashboard over plain HTTP,-# otherwise you won't be able to stay logged in.-SESSION_COOKIE_SECURE=true--# How long a login lasts, in seconds (86400 = 24 hours).-SESSION_TTL_SECONDS=86400--# Name of the login cookie. Change it only if it clashes with another app on-# the same domain.-SESSION_COOKIE_NAME=homie_session+# (dev) Domain for `docker compose --profile https up -d`. Its DNS must point at this machine and+# ports 80 and 443 must be open. Default: localhost+DOMAIN=# =============================================================================-# Limits (the defaults suit most installs)+# Accounts and sign-in# =============================================================================-# The most servers this install will hold, however they are added.-# MAX_SERVERS=200+# (both) Let anyone who can reach the dashboard create an account. Only the exact value "true" turns it on.+# Default: false (only the first account can be created)+ALLOW_REGISTRATION=-# A check-in must arrive at least this share of the server's check interval after the previous one;-# faster ones are refused (429). 0 switches the limit off.-# INGEST_MIN_SPACING_RATIO=0.25+# (both) Setup token for the very first account, which becomes the admin. Leave empty and the backend+# makes one up and prints it in its log until the first account exists:+# docker compose logs backend | grep 'setup token'+ADMIN_BOOTSTRAP_TOKEN=-# Serves the interactive API documentation at /api/docs. Leave off on a public install.-# ENABLE_API_DOCS=false+# (both) Send the sign-in cookie over HTTPS only. Must be true when the dashboard is served over HTTPS,+# and false when you open it over plain HTTP, or you can't stay signed in.+# Default: false (dev), true (server)+SESSION_COOKIE_SECURE=-# Enrollments with the enrollment key per address per hour (twice that per key). Raise it only if many collectors-# reach the dashboard from one address, for example behind NAT.-# ENROLL_RATE_LIMIT=30+# (both) How long a sign-in lasts without "Remember me", in seconds. Default: 86400 (24 hours)+SESSION_TTL_SECONDS=-# Setup token for the very first account (the one that becomes the admin).-# Leave it commented: the backend then makes one up and prints it in its log-# ("docker compose logs backend | grep 'setup token'") until the first account exists.-# ADMIN_BOOTSTRAP_TOKEN=+# (both) Name of the sign-in cookie. Change it only if it clashes with another app on the same domain.+# Default: homie_session+SESSION_COOKIE_NAME=-# How long the token created by "Connect a server" stays valid, in seconds.-# JOIN_TOKEN_TTL_SECONDS=900+# (both) Address(es) the dashboard is opened from, comma-separated, with https:// and no trailing slash.+# Requests from other origins are refused.+# Default: http://localhost:5173 (dev), https://<DASHBOARD_DOMAIN> (server)+CORS_ORIGINS=# =============================================================================# Rate limits (brute-force protection)# =============================================================================-# Failed login attempts allowed per window, counted separately per IP address-# and per email. A successful login resets the count. Over the limit, logins-# get "429 Too many attempts" until the window ends.-LOGIN_RATE_LIMIT=5-LOGIN_RATE_WINDOW_SECONDS=60+# (both) Failed sign-in attempts allowed per window, counted per IP address and per email.+# Defaults: 5 attempts per 60 seconds+LOGIN_RATE_LIMIT=+LOGIN_RATE_WINDOW_SECONDS=-# Registration attempts allowed per IP address per window (3600 = 1 hour).-REGISTER_RATE_LIMIT=3-REGISTER_RATE_WINDOW_SECONDS=3600+# (both) Registration attempts allowed per IP address per window.+# Defaults: 3 attempts per 3600 seconds+REGISTER_RATE_LIMIT=+REGISTER_RATE_WINDOW_SECONDS=# =============================================================================-# Alerts (optional)+# Limits on collectors# =============================================================================-# URL that receives a JSON POST when a health check finds a critical problem.-# Leave empty to disable. Example: https://your-alert-endpoint.example/health-ADMIN_ALERT_WEBHOOK_URL=+# (both) The most servers this install holds, however they are added. Default: 200+MAX_SERVERS=++# (both) A check-in must arrive at least this share of the server's check interval after the previous+# one; faster ones are refused. 0 switches the limit off. Default: 0.25+INGEST_MIN_SPACING_RATIO=++# (both) Enrollments with the enrollment key per address per hour (twice that per key). Raise it if many+# collectors reach the dashboard from one address, for example behind NAT. Default: 30+ENROLL_RATE_LIMIT=++# (both) How long a token from "Connect a server" stays valid, in seconds. Default: 900+JOIN_TOKEN_TTL_SECONDS=++# =============================================================================+# Connecting remote servers+# =============================================================================++# (server) Where the collector gate is published. Bind it to your VPN address only (for OpenVPN the+# server's tun address, e.g. 10.8.0.1): Docker's published ports bypass ufw and similar firewalls.+# Defaults: 127.0.0.1 and 8081+COLLECTOR_BIND=+COLLECTOR_PORT=++# (both) The address "Connect a server" tells new machines to report to, e.g. http://10.8.0.1:8081/api+COLLECTOR_PUBLIC_URL=++# (both) Images remote machines install, pinned by digest. Push a version tag (git tag v0.1.0 &&+# git push origin v0.1.0); the "Publish images" workflow prints these lines in its summary. The GHCR+# packages must be public so machines can pull them without credentials. "Connect a server" needs both.+COLLECTOR_IMAGE=+DOCKER_PROXY_IMAGE=# =============================================================================-# Local collector (monitors the machine running this stack)+# Collector on this machine (monitors the machine running the stack)# =============================================================================-# New machines appear under "New servers detected" on the dashboard and must-# be approved. Set an enrollment key (dashboard: Connect a server -> Advanced)-# to have this machine approved automatically. Leave empty to approve by hand.+# (both) Enrollment key (dashboard: Connect a server → Advanced) that approves this machine+# automatically. Empty: it appears under "New servers detected" and you click Add.INFRADECK_ENROLL_KEY=-# Name shown on the dashboard for this machine. Empty = use its hostname.+# (both) Name shown on the dashboard for this machine. Default: its hostnameINFRADECK_SERVER_NAME=-# How often the collector sends metrics, in seconds. Minimum 15.-INFRADECK_CHECK_INTERVAL_SECONDS=60+# (server) How often the collector reports at first, in seconds (minimum 15); the dashboard setting+# replaces it once the server is added. Default: 60+INFRADECK_CHECK_INTERVAL_SECONDS=-# Unique ID of this machine. Empty = read /etc/machine-id from the host.-# Set it only if several machines share the same machine-id (e.g. cloned VMs)-# and would otherwise show up as one server.+# (server) Unique ID of this machine. Default: /etc/machine-id of the host.+# Set it only if several machines share one machine-id (cloned VMs) and show up as one server.INFRADECK_MACHINE_ID=+# (both) Optional internet check, off when empty: comma-separated host:port targets (at most 5) this+# collector tries to reach. It only opens a TCP connection and looks the name up. Example: 1.1.1.1:443,9.9.9.9:443+INFRADECK_CONNECTIVITY_TARGETS=+# =============================================================================-# Dashboard (frontend)+# Ports and the dashboard# =============================================================================-# Address and port where the dashboard is served over plain HTTP on the host.-# 127.0.0.1 keeps it reachable only from this machine (Traefik still reaches it-# over the Docker network). Use 0.0.0.0 for direct LAN/VPN access.-FRONTEND_BIND=127.0.0.1-FRONTEND_PORT=5173+# (both) Address and port of the dashboard's plain-HTTP port on this machine. 127.0.0.1 keeps it+# reachable only from here (Traefik still reaches it over the Docker network); 0.0.0.0 allows LAN/VPN.+# Defaults: 0.0.0.0 (dev), 127.0.0.1 (server); port 5173+FRONTEND_BIND=+FRONTEND_PORT=-# Optional internet-reachability check run by the collector, off when empty. Comma-separated-# host:port targets (hostnames or IPv4, at most 5); it only opens a TCP connection and looks the name-# up, sending nothing. Set per collector, never from the dashboard. Example: 1.1.1.1:443,9.9.9.9:443-INFRADECK_CONNECTIVITY_TARGETS=+# (dev) Host port, on 127.0.0.1, where the backend is published for debugging. Default: 8060+BACKEND_PORT=-# --- Connecting remote servers over a VPN (docker-compose.server.yml) ----# Collectors never use the public address. They report to the collector gate, which you-# publish on your VPN address only (for OpenVPN, the server's tun address, e.g. 10.8.0.1).-# Docker's published ports bypass ufw and similar firewalls, so bind to the VPN address-# instead of 0.0.0.0 and relying on a firewall rule.-COLLECTOR_BIND=127.0.0.1-COLLECTOR_PORT=8081-# What the "Connect a server" panel tells new machines to use, e.g. http://10.8.0.1:8081/api-COLLECTOR_PUBLIC_URL=-# Images remote hosts install, pinned by digest. Push a version tag (git tag v0.1.0 &&-# git push origin v0.1.0); the "Publish images" workflow prints these lines in its summary.-# The GHCR packages must be public for hosts to pull them without credentials.-COLLECTOR_IMAGE=-DOCKER_PROXY_IMAGE=+# (server) How often live graphs refresh, in seconds (minimum 1). Built into the frontend image, so+# rebuild after changing it: docker compose up -d --build frontend. Default: 3+LIVE_GRAPH_REFRESH_INTERVAL_SECONDS=++# =============================================================================+# Notifications (optional)+# =============================================================================++# (both) Email for incident notifications (Account → Notifications). Email is off unless SMTP_HOST+# and SMTP_FROM are set. Defaults: port 587, STARTTLS true+SMTP_HOST=+SMTP_PORT=+SMTP_STARTTLS=+SMTP_USER=+SMTP_PASSWORD=+SMTP_FROM=++# (both) URL that receives a JSON POST when the daily health check finds a critical problem.+ADMIN_ALERT_WEBHOOK_URL=++# =============================================================================+# AI assistant (optional)+# =============================================================================++# (both) Google Gemini API key for the Homie assistant. Empty: chat is off, monitoring works without it.+# Get one at https://aistudio.google.com/apikey+GEMINI_API_KEY=++# (both) Gemini model the assistant uses. Default: models/gemini-3.5-flash+AGENT_MODEL=++# =============================================================================+# Optional, rarely needed+# =============================================================================++# (both) Serve the interactive API documentation at /api/docs. Leave off on a public install.+# Default: false+ENABLE_API_DOCS=++# =============================================================================+# Collector-only install (collector-compose.yml on a machine without the dashboard)+# =============================================================================++# REQUIRED for collector-compose.yml. The dashboard's API address, e.g. http://10.8.0.1:8081/api+INFRADECK_API_URL=-# How often live graphs refresh, in seconds (minimum 1). This is baked in when-# the image is built, so rebuild after changing it:-# docker compose up -d --build frontend-LIVE_GRAPH_REFRESH_INTERVAL_SECONDS=3+# Image to run instead of building one locally. Default: infradeck-collector:latest+INFRADECK_COLLECTOR_IMAGE=# =============================================================================-# Not configurable here+# Running the backend without Docker (development only)# =============================================================================-# The code also reads DATABASE_URL, REDIS_URL, INFRADECK_API_URL, PROMPTS_DIR,-# DOCKER_SOCKET_PATH, HOST_PROC, HOST_ROOT, INFRADECK_STATE_DIR and-# VITE_API_BASE_URL. The compose file sets these to match its own containers,-# volumes and ports, so setting them in .env has no effect.+# The compose files set these to match their own containers, so inside Docker they are ignored.+# Set them only when you run the backend straight from Python (see docs/development.md).++# Default: postgresql+psycopg://infradeck:infradeck_dev@localhost:5432/infradeck+DATABASE_URL=+# Default: redis://localhost:6379/0+REDIS_URL=+# Folder with the assistant's prompt files. Default: src/agent+PROMPTS_DIR=diff --git a/src/backend/config.py b/src/backend/config.pyindex a66c5f7..5d3816d 100644--- a/src/backend/config.py+++ b/src/backend/config.py@@ -1,10 +1,14 @@import osfrom pathlib import Path-from dotenv import load_dotenv+from dotenv import dotenv_valuesBASE_DIR = Path(__file__).resolve().parents[2]-load_dotenv(BASE_DIR / ".env")+# example.env lists every setting with an empty value; an empty line means "use the default", as it does in+# the compose files, so only lines with a value are loaded. Variables already set in the environment win.+for _name, _value in dotenv_values(BASE_DIR / ".env").items():+ if _value:+ os.environ.setdefault(_name, _value)# Shown in the sidebar and compared with what each collector reports.APP_VERSION = "0.9.2"