Closed emilebourquin closed 4 weeks ago
Hey @emilebourquin!
What version of Laravel are you running?
Something like this would come from laravel itself, and not from our images:
ERROR Command "schedule:work " is not defined. Did you mean one of these?
⇂ queue:work
⇂ schedule:clear-cache
⇂ schedule:interrupt
⇂ schedule:list
⇂ schedule:run
⇂ schedule:test
⇂ schedule:work
Hi Jay, I'm using the latest version of Laravel, framework 11.24.0
I do notice that:
php artisan queue:work
also throws the same error, but
php artisan queue:work --tries=3
does not.
Sorry I read that on my mobile quickly and missed one of the most important paragraphs 😆
I wonder if it has something to do with this file:
Let me look into this and see if I can replicate it. I am working on refactoring that script soon anyways.
schedule:work
in an entrypoint scriptI'm not 100% sure of your use case, but just a heads up that you're not getting the best benefits of Docker by running schedule:work
as an entrypoint script. This basically makes the schedule:work
command unmonitored by an orchestrator and it could potentially fail and you wouldn't know about it.
It's best to run a separate container and pass php artisan queue:work
as a COMMAND. This will ensure Docker monitors it.
Thanks Jay. Agreed on running it as a Command. I'm actually trying to get schduled task/queue containers running alongside my app on AWS Fargate, but I was getting some sort of "command not found" error when I was trying to run it as the entry Command.
I'll go back down that road, since it's the proper way to do it. Put this on the back burner, or dump it, as you see fit.
Thanks for your help and for all of your hard work on the images.
You bet, thanks for bringing it to our attention!
You might have to set your command/entrypoint to be this:
php /var/www/html/artisan schedule:work
If the orchestrator doesn't respect the workdir
set in the images, then you need to explicitly tell it where /var/www/html/artisan
is located.
Hope this helps!
Many things are getting improved in v3.4, specifically:
I have everything being prepared on this branch, which will eventually be promoted to "beta".
Check out the docs preview site too. I am starting to assemble the much easier approach to running these advanced Laravel services now that we don't have to worry about S6 getting in the way.
Closing this for now since I think this will be dramatically easier in the next release.
Thanks for reporting this Emile!
Steps To Reproduce
Using this 99-scheduled.sh entrypoint script:
and this Dockerfile:
I get this error immediately on startup:
I have triple-checked that there is no space, newline, etc. after the schedule:work. I even put a basic echo "Hello" on the next line, and the extra space was still added after schedule:work
When I echo the two lines into the file, it works without issue:
I realize this may not be a serversideup issue, but I'm not sure what to make of it.
Outcome
I expected the
php artisan schedule:work
command to work when I use the entrypoint file.Instead, I get ERROR Command "schedule:work " is not defined.
Affected Docker Images
serversideup/php:8.3-cli
Anything else?
No response