[Unit] Description=ntfy - Simple HTTP-based pub-sub notification service Documentation=https://docs.ntfy.sh/ After=network.target RequiresMountsFor=/var/lib/virtiofs/data # Only start if ntfy has been configured ConditionPathExists=/etc/quadlets/ntfy/server.yml # Start/stop this unit when the target is started/stopped PartOf=ntfy.target [Container] ContainerName=ntfy Image=ntfy.image AutoUpdate=registry # Network configuration Network=host # No need for root privileges User=10027 Group=10000 # Command Exec=serve # Volume mounts Volume=/etc/quadlets/ntfy/server.yml:/etc/ntfy/server.yml:ro,z Volume=/var/lib/virtiofs/data/ntfy:/var/cache/ntfy:Z # Health check HealthCmd=wget -q --tries=1 http://localhost:8080/v1/health -O - | grep -Eo '"healthy"\s*:\s*true' || exit 1 HealthInterval=60s HealthTimeout=10s HealthStartPeriod=40s HealthRetries=3 [Service] Restart=always RestartSec=10 TimeoutStartSec=120 TimeoutStopSec=30 # Wait for PostgreSQL to be ready on localhost ExecStartPre=/bin/sh -c 'exec 2>/dev/null; for try in $(seq 0 12); do if ! /bin/true 5<> /dev/tcp/127.0.0.1/5432; then echo "Waiting for PostgreSQL to be available..."; sleep 5; else exit 0; fi; done; exit 1' [Install] WantedBy=ntfy.target