koel / docker

A minimal docker image for the koel music streaming server.
https://hub.docker.com/r/phanan/koel/
MIT License
178 stars 54 forks source link

storage/framework/cache folder permissions messed out after koel:sync #113

Closed DaWy closed 2 years ago

DaWy commented 2 years ago

I was today discovering Koel, so I did go throught the Docker way, as I am running a personal home server with docker setup:

image

The first run went all okay. But after doing the koel:sync, somethings weird happens: I cannot login again to Koel. Reading the logs inside storage/logs/laravel.log I can see this after a login try:

image

So i just checked out this dir, and I can se that almost everything inside the folder "/var/www/html/storage/framework/cache/data" is owned by root, but the folder itself is owned by www-data.

image

So i changed the content of this dir back to www-data owner, and now I can login without issues!

So I suspect something is wrong with the php artisan commands beeing run as user root inside the container and makes all of this folders unreadable by Koel, leaving with this permission issue and then unable to login.

So by now the fix remain on just changing the permissions on this folder after running the koel:sync command. But I think we should find a more "definitive" approach to this.

DaWy commented 2 years ago

Ok, so the problem is comming from running the command inside the container using bash as root user.

Running the koel:sync command from outside the container using docker exec works as expected. So a change in the main README.md should be done to preventing users to run the php artisan commands inside the container as root user.

Hyzual commented 2 years ago

Indeed, running koel:sync as root will create index folders owned by root. Thanks for posting the follow-up with the resolution. I'm not sure exactly what needs to change, feel free to open a pull request with the changes to the README, I'll review it and merge it.

Hyzual commented 2 years ago

I ran into this issue while working on the image. I added --user www-data in all docker exec command examples in the README.