Reputation: 24116
I use Laravel Horizon to process jobs in my Laravel application with the help of Supervisor. The whole setup runs on docker in ECS. On the host node of ECS (managed by Fargate) I have datadog agents running on it, which will grab the stdout/stderr of the container and put it into datadog (so I can access the logs centrally).
What I noticed is that I am not getting any logs out of the jobs that is processing. Even simple print("test");
in the job code does not go to the stdout.
Here's my setup:
Dockerfile
FROM alpine:3.11
RUN apk add \
--no-cache \
--update \
...snipped...
py-pip \
&& pip install supervisor \
&& pip install supervisor-stdout
WORKDIR /app
...snipped...
The service definition for this in yaml looks like this:
version: '2'
services:
my-app-horizon:
container_name: my-app-horizon
image: ${DOCKER_IMAGE}
mem_limit: 1024M
command: "supervisord -c /etc/supervisor/conf.d/horizon.conf"
...snipped...
And here's the content of my horizon.conf
:
[supervisord]
nodaemon=true
[program:horizon]
priority = 100
process_name=%(program_name)s
command=php /app/artisan horizon
autostart=true
autorestart=true
user=apache
stopwaitsecs=3600
stdout_events_enabled=true
stderr_events_enabled=true
[eventlistener:stdout]
priority = 1
command = supervisor_stdout
buffer_size = 100
events = PROCESS_LOG
result_handler = supervisor_stdout:event_handler
Any idea what I might be missing? What can't I get logs out of the jobs processed by horizon in docker via supervisor?
Upvotes: 0
Views: 5100
Reputation: 24116
A colleaque of mine informed me that, since we're using docker, we can by-pass supervisor and just run the horizon artisan command directly as the entrypoint of the container.
So, I removed all things related to supervisor and my service yaml is simplified to the following and the logs are coming into datadog:
version: '2'
services:
my-app-horizon:
container_name: my-app-horizon
image: ${DOCKER_IMAGE}
mem_limit: 1024M
command: "/app/artisan horizon"
...snipped...
Upvotes: 2