phpmyadmin / scripts

Various scripts related to project
15 stars 19 forks source link

rm: cannot remove 'libraries/cache/routes.cache.php': Permission denied #26

Closed ibennetch closed 1 year ago

ibennetch commented 4 years ago

Since approximately May 25, the scheduled job on the demo server scripts/demo/bin/pma-demo-update gives this error:

rm: cannot remove 'libraries/cache/routes.cache.php': Permission denied
ibennetch commented 4 years ago

libraries/cache is owned by www-data with drwxr-xr-x permissions. The only file is routes.cache.php which has -rw-r--r-- permissions.

The main phpMyAdmin folder is owned by the user whose account this runs under, and the script also runs as the same user.

williamdes commented 4 years ago

What user does run the script ? root by crontab ?

Just a small note: I would love to be able to have the same exact setup on my workstation or on dockers but that would require that we have all the scripts and configs here

ibennetch commented 4 years ago

I started to edit my previous reply but you are too quick, so rather than confusing the thread order I'll make a new comment with the my edits and answers to your questions.

libraries/cache is owned by www-data with drwxr-xr-x permissions. The only file is routes.cache.php which has -rw-r--r-- permissions.

The main phpMyAdmin folder is owned by the user whose account this runs under (a service account, let's say demoserver), and the script also runs as the same user. I manually deleted the file a week ago and let it regenerate, and the error returned the next time the script ran.

I have not yet added additional logging to the script to see what the problem is, but if this is a common problem we may need to reconsider how we use the cache in phpMyAdmin proper; we can't have users who aren't able to maintain their installations.

To reproduce, I think you can just checkout the scripts repository and run scripts/demo/bin/pma-demo-update manually. It should do all the checkout work for you. It creates a new subdirectory under home where the files are checked out. You should be able to either link the generated subdirectories to your web root or add them to your sites-available.

Modernizing the infrastructure is something I was working on with the website, so perhaps this can be next once I finish with that.

williamdes commented 4 years ago

we can't have users who aren't able to maintain their installations.

I think we can do it in another way, if the file is present (because it was built by the release script) then use it, if not disable cache mode

Does this seem better ?

MauricioFauth commented 4 years ago

we can't have users who aren't able to maintain their installations.

The libraries/cache/routes.cache.php only changes when the libraries/routes.php is updated. The idea is to warm up the cache before creating a release. In other words, this file only changes when updating the phpMyAdmin installation. The problem is that the demo server constantly updates the installation, so I added this command to force a cache warm up to fix 404 errors caused by missing routes in the cache file.