[supervisord]
nodaemon=true
# Run the whole stack as the non-root www-data user (security hardening).
# nginx listens on 8080 (non-privileged) so root is not needed to bind the port.
user=www-data
logfile=/dev/stdout
logfile_maxbytes=0
pidfile=/tmp/supervisord.pid

[unix_http_server]
file=/tmp/supervisor.sock

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

[program:php-fpm]
command=php-fpm -F
autorestart=true
priority=10
# Forward SIGTERM (graceful) and give workers time to finish in-flight requests.
stopsignal=TERM
stopwaitsecs=15
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:nginx]
command=nginx -g 'daemon off;'
autorestart=true
priority=20
stopsignal=QUIT
stopwaitsecs=15
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

# Message consumers. On Coolify these were separate compose services; Liara has
# no docker-compose, so they run here inside the single Docker app. --time-limit
# makes each consumer exit cleanly every hour; autorestart brings it back (guards
# against memory growth / stale DB+Redis connections). Mirrors the compose commands.
[program:worker-async]
command=php bin/console messenger:consume async --time-limit=3600 --memory-limit=128M
autorestart=true
priority=30
# messenger handles SIGTERM gracefully — finish the in-flight message, then exit.
stopsignal=TERM
stopwaitsecs=30
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:worker-scheduler]
command=php bin/console messenger:consume scheduler_default --time-limit=3600 --memory-limit=128M
autorestart=true
priority=30
stopsignal=TERM
stopwaitsecs=30
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
