[Unit]
Description=Thermograph docker-compose stack (app + PostgreSQL)
# Docker must be up, and the network online, before compose can pull/interpolate.
After=docker.service network-online.target
Wants=network-online.target
Requires=docker.service

[Service]
# A thin manager for the compose stack: `up -d` starts it and returns, the unit
# stays "active" (RemainAfterExit) so `systemctl restart thermograph` re-runs it.
# Compose owns container ordering and restarts via depends_on + restart policies.
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/thermograph
# POSTGRES_PASSWORD (and the other secrets) are needed at `docker compose`
# interpolation time. The leading `-` makes a missing file non-fatal.
EnvironmentFile=-/etc/thermograph.env
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down

[Install]
WantedBy=multi-user.target
