- 根因:开机时 docker 恢复容器绑定 192.168.55.15:5432/8081 失败(EADDRNOTAVAIL,IP 尚未可绑)→ timescaledb/pgweb 启动失败且不重试,停摆 3h15m;pg-backup 开机备份失败 → unhealthy - 处置:docker compose up -d --force-recreate(三容器回 database_default、端口发布、备份恢复、pgweb 恢复);用户重启 HA Core 后写入管道恢复 - 防复发:新增开机自愈 systemd oneshot pgdb-compose.service(enabled),源码 compose/pgdb/pgdb-compose.service
compose/ — repo-owned Compose declarations
Non-secret Compose sources for the Docker hosts. Secrets are never in these
files: every secret is a ${VAR} reference resolved from the server-local
.env (docker compose reads .env from the project directory automatically).
Source-of-truth matrix
| Project | Host | Compose source | Mechanism |
|---|---|---|---|
vaultwarden |
us2 (/opt/vaultwarden) |
compose/vaultwarden/compose.yml |
static file + compose-deploy.yml |
pdns |
hk2 (/opt/pdns) |
compose/pdns/compose.yml |
static file + compose-deploy.yml |
pgdb |
pgdb (/opt/database, 无 ansible) |
compose/pgdb/compose.yml |
static file(手动部署:scp → docker compose config -q → up -d;服务器文件名 docker-compose.yml) |
soft-serve |
us2 (/opt/soft-serve) |
compose/soft-serve/compose.yml (+ Dockerfile.backup, scripts/) |
static file(参考镜像, 未接入 compose-deploy; 服务器文件为准) |
adguardhome |
dns.windy.lan (/opt/adguardhome) |
— (待从 LAN 提取) | static file (pending) |
unifi |
ubnt (/home/windy/unifi-9) |
— (待从 LAN 提取) | static file (pending) |
wireguard |
us4 (/opt/wireguard) |
ansible/templates/wireguard-compose.yml.j2 |
role-rendered (inventory vars) |
rustdesk |
hk2 (/opt/rustdesk) |
ansible/roles/rustdesk/templates/compose.yml.j2 |
role-rendered (inventory vars) |
mailcow |
mx2 (/opt/mail) |
— (mailcow update generator owns it) | excluded by design |
Mechanism rule: static compose/<project>/compose.yml for declarations that
do not vary per host; role-rendered j2 for declarations driven by inventory
vars (image pins, relay host). One mechanism per project; do not duplicate a
project in both.
Deploying a static project
cd ansible
# Read-only diff + validation against the server .env (no writes)
ansible-playbook playbooks/compose-deploy.yml --limit vaultwarden --check --diff
# Apply: stage repo file → validate `docker compose config -q` → backup current
# file → promote → `docker compose up -d` (gated)
ansible-playbook playbooks/compose-deploy.yml --limit vaultwarden \
-e '{"compose_deploy_confirm": true}'
See ../runbooks/ansible-operations.md.
Adding a project
- Sanitize the live compose so every secret is
${VAR}from.env(prefer${VAR:?missing VAR}for required keys). - Commit
compose/<project>/compose.yml+.env.example(key names only). - Add
compose_repo_project(+compose_remote_fileif notcompose.yml) to the host inansible/inventory/hosts.yml, and allowlist the project inansible/roles/compose_deploy/defaults/main.yml. - Verify with
--check --diff(zero diff) then a gated apply.