[Unit] Description=PostgreSQL Database Server Documentation=https://www.postgresql.org/ After=network.target # Only start if Odoo has been configured ConditionPathExists=/etc/containers/systemd/odoo/odoo-config.env # Start/stop this unit when the target is started/stopped PartOf=odoo.target [Container] ContainerName=odoo-db Image=docker.io/library/postgres:17-alpine # Network configuration Network=host # Environment variables from config EnvironmentFile=/etc/containers/systemd/odoo/odoo-db.env # Volume mounts Volume=/var/lib/postgresql/data-odoo:/var/lib/postgresql/data:Z # Health check HealthCmd=pg_isready -U odoo -d postgres -p 5433 HealthInterval=30s HealthTimeout=10s HealthStartPeriod=60s HealthRetries=3 [Service] Restart=always RestartSec=10 TimeoutStartSec=120 TimeoutStopSec=30 # Skaffold filesystem + fix permissions ExecStartPre=install -m 0700 -o 70 -g 70 -d /var/lib/postgresql/data-odoo [Install] WantedBy=odoo.target