Open ForestEckhardt opened 4 months ago
I'm investigating the flaky tests
It's not a flake - the issue is when we run Laravel/Symfony apps on the Jammy stack, the run image workspace is not writeable and that's where the frameworks want to drop logs and other storage info. we'll need to find a way around this
@till I was wondering if you could advise me with a Laravel-related issue we're having. I've been debugging for a few days, but I can't get this to work. With the Jammy stacks, the /workspace
(app dir) isn't writeable at run-time. As a result, our Laravel apps fail at run-time with The exception occurred while attempting to log: The stream or file "/workspace/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
.
I've tried quite a few different mechanisms to update the app, so that the storage_path goes to /tmp
instead of the app dir with no luck. I'm wondering if you have any insights that might help me?
Hey 👋
Last time I tried this, I had to set LOG_CHANNEL=stderr
and that was all.
Not sure if this is still possible in the current version.
@till I'll look into that. Thank you!!!!!
@sophiewigmore https://laravel.com/docs/11.x/logging#available-channel-drivers < if it's 11.x, I am not exactly sure if there's a simple way to handle this. May require a custom config with some code like in the following gist:
https://gist.github.com/yohangdev/1195fa4add05309d6d54c80380fbf10d
@till thanks for the tips. I've had no luck so far. It seems that setting LOG_CHANNEL=stderr
solves the issues with the logger, but then other parts still write to the app dir, like storage/framework/sessions
and other caches. Maybe my best recourse is to update the app to Laravel 11. I could also go the route of updating all configs to write to /tmp
everywhere. I'd just hate to give that advice to someone wanting to use the buildpack, so I wanted to find an elegant solution
@sophiewigmore Definitely update.
I think the buildpack could (or should) create a config (e.g. something obvious like buildback.php) and configure everything as needed.
Maybe in addition provide BP_PHP_LARAVEL_
to tweak or turn it off?
We also had to supply an APP_KEY
(random secret). Not sure if this is still in 11.x.
Everything seems to get more complex.
@sophiewigmore did you get anywhere with this? I recently updated our symfony example to the latest (7.x) and it required a few things but overall worked. Haven't looked at Laravel yet though, but there's Laravel Sail which I wanted to try and learn what it does.
Checklist