YunoHost-Apps / kimai2_ynh

Kimai v2 package for YunoHost
https://www.kimai.org/
MIT License
13 stars 8 forks source link

Installing Plugins Breaks Kimai #35

Closed leuchtrakete666 closed 3 years ago

leuchtrakete666 commented 3 years ago

i am back ...

i installed the MetaFieldsBundle Plugin. i did as i was instructed. created the folder in ../var/plugins, cleared cache and created database.

thats the outcome:

image

thats the terminal output of clearing the cache:

image

and thats what happens when i create the database:

image

anmol26s commented 3 years ago

Ohh..God .. save me. I will have to reproduce that.

kevinpapst commented 3 years ago

This has nothing todo with YunoHost.

@anmol26s Please close the issue

@leuchtrakete666 please contact me as explained here: https://www.kimai.org/documentation/buy-a-plugin.html

kevinpapst commented 3 years ago

BTW in almost 100% of all cases this error comes from wrong file permissions. Fix them as explained here: http://kimai.org/documentation/cache.html

kevinpapst commented 3 years ago

@anmol26s maybe you can document the webserver user somewhere? I guess it is not www-data?

anmol26s commented 3 years ago

@anmol26s maybe you can document the webserver user somewhere? I guess it is not www-data? You mean this? https://github.com/YunoHost-Apps/kimai2_ynh/blob/master/scripts/install#L171

I guess I will have to add few more rules under it?

chmod -R g+r .
chmod -R g+rw var/
chmod -R g+rw public/avatars/
kevinpapst commented 3 years ago

Not necessarily. In my demo script I am setting the group, which doesn't have write permissions by default. But your script changes the user, which should always have the write permissions. And its applied from kimai root, so it should work.

But if y user now triggers the bin/console kimai:reload command to flush the cache, the cache files and directories are recreated under his account. And then the $app user cannot write runtime files, leading to a 500 error.

So we need to know which user is $app and how can a YunoHost admin fix the file permissions after the cache was manually reloaded.

anmol26s commented 3 years ago

I would have to change it to something like below command, so that user can have access and run this. $ USER /usr/bin/phpPHPVERSION PATH/bin/console kimai:reload

Maybe I can do it on cron?

leuchtrakete666 commented 3 years ago

thanks again for all your efforts. i just reacently discovered yunohost and i like it a lot.

i want to use this service for my small company. kimai, baikal, nextcloud and dolibarr. perfect kombination.

leuchtrakete666 commented 3 years ago

thanks to @kevinpapst here is the solution:

after running the bin/console kimai:reload command the cache is rebuilt and the system changes group and user of the files to root.

so simply change the group:owner back to kimai2.

move to ../kimai2 folder and enter this commands:

chown -R kimai2:kimai2 . chmod -R g+r . chmod -R g+rw var/ chmod -R g+rw public/avatars/

and everything works fine again.

thank you @kevinpapst and thank you @anmol26s

edit: i should mention, this works with yunohost, because the server user is kimai2. on a different system it might be a different user.