chilio/laravel-dusk-ci

Failed to open storage/logs/laravel.log: Permission denied

tkoop opened this issue · 3 comments

tkoop commented

I'm using your excellent Docker image in GitLab CI. Thank you!! But I seem to have one problem.

In my Dusk tests, (which are all failing), my screenshots return a Laravel error page that says this:

The stream or file ".../storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied.

But the "storage" and "logs" directories exist with 777 permissions and are owned by www-data.www-data. What more do I need?

I'm using chilio/laravel-dusk-ci:php-8.0

Thank you!

tkoop commented

I think this is because I was also running regular Laravel Feature tests, like this:

php artisan test --env=testing

If I split these (feature tests) into a different GitLab job than the dusk tests, both seem to work.

@tkoop it is difficult to say with the info you provided.
One hint I have is you should not change your env across builds, especially when using cache.
Let me know if this helps, or if you have this problem resolved.

@tkoop the solution is executing their tests with this command: su www-data -s /bin/bash -c "php artisan dusk --colors --debug" .
and give permission 777 the folders storage/ and bootstrap/cache