Handle consumer exit status in compose.yaml

Updated the `messenger:consume` command in `compose.yaml` to run as the `PHP_FPM_USER` and added error handling to stop the container if the consumer exits with a non-zero status.
This commit is contained in:
2025-09-10 18:41:44 +02:00
parent 1d67d5e14e
commit 7805b074f0

View File

@@ -53,7 +53,12 @@ services:
sleep 3 && bin/console cache:clear &&
while ! [ -f /tmp/kill_me ];
do
php -d memory_limit=2G bin/console messenger:consume priority async --limit=20 --time-limit=600 -v;
su -s /bin/bash -c 'php -d memory_limit=2G bin/console messenger:consume priority async --limit=20 --time-limit=600 -v' "$PHP_FPM_USER";
rc=$?;
if [ $rc -ne 0 ]; then
echo "Consumer exited with status $rc. Stopping container.";
exit $rc;
fi
done;
pre_stop:
- command: