Replies: 1 comment
-
Also this makes it hard to process #42018 But for the cron handling, it is possible to do it but the developer must setup the correct output when registering the schedule (which is annoying). For better DX I've made a solution that would add it automatically - you can reuse part of the code from larastrict.com service provider Use the docker process as an output -> https://github.com/wrk-flow/larastrict/blob/61f6781e9656080f4964e4ea192b0b649b085c04/src/Docker/Config/docker.php |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
This was already discussed and requested in this issue: laravel/ideas#126
But I don't understand why it was never implemented, at least as an option available.
At this time, it's pretty much a standard to containerize your application and following that approach, it's expected that the application running, output the results in the stdout/stderr channels.
However, Laravel scheduler, designed to avoid having to create several cron jobs and keeping everything neat and tidy, fails to consider anything else beside writing the output to files or triggering an email on error.
While the former is definitely not compatible with the stateless approach to modern development and the latter could be fine, having to option to have the output sent directly to stdout and stderr would allow deployments on container-based solutions to monitor and eventually automatically repair errored applications, whilst also notifying via email or leaving to the monitoring solution the configuration about what to notify about.
Currently, running a scheduler in a docker container with:
cron job:
* * * * * cd /var/www/html/app && /usr/local/bin/php artisan schedule:run >> /proc/$(cat /var/run/crond.pid)/fd/1 2>&1
Return this kind of output when monitoring cron:
So, I assume, something is allowed to be passed back, specifically the line
Running scheduled command: '/usr/local/bin/php' 'artisan' inspire > '/dev/null' 2>&1
. If that's passed back in the stdout, so it can every other output for the scheduled jobs.Maybe we could have an option, disabled by default, to allow dropping the
/dev/null
from that command and start from there?Edit: to clarify, I'm not a laravel developer, I know how to work on php enough to work on laravel, but i'm taking care of the deployments/infrastructure of the company I work for. So please, bear with me if I don't really get where you are going with explanations :)
Beta Was this translation helpful? Give feedback.
All reactions