YunoHost-Apps / librephotos_ynh

Librephotos package for YunoHost
https://github.com/LibrePhotos/librephotos
MIT License
5 stars 3 forks source link

Does not seem to work with different directory #13

Closed brimwats1 closed 3 years ago

brimwats1 commented 3 years ago

I have all of my media saved on /var/Multimedia subfolders. For example, music is at /var/Multimedia/Music.

Photos are saved at /var/Multimedia/Photos. I tried to let Librephotos know this by going to Admin area -> and setting the user storage to /var/Multimedia/Photos. However, every time I saved it, it just resets to `/home/yunohost.app/librephotos/data/nextcloud_media'

In the past for YNH apps I have fixed this by adding apps to a group called Multimedia. That looks like this:

sudo su
usermod librephotos -a -G multimedia
# Set permissions
chown librephotos:multimedia -R /var/Multimedia
find /var/Multimedia -type d -exec chmod 0775 {} \;
find /var/Multimedia -type f -exec chmod 0664 {} \;
setfacl -d -m u::rwX,g::rwX,o::r /var/Multimedia
# Restart services
systemctl restart nginx
systemctl restart php7.3-fpm
systemctl restart php7.4-fpm
systemctl restart librephotos

However, this didn't seem to work in librephotos case. What am I missing?

Jules-Bertholet commented 3 years ago

Did you enable any of the Nextcloud integration options in LibrePhotos? If so you should disable them. By default, nothing at all should be stored in /home/yunohost.app/librephotos/data/nextcloud_media, and LibrePhotos should scan photos from /home/yunohost.multimedia/<username>/Picture (/home/yunohost.multimedia is a standard directory that many YunoHost packages use, it's set up almost exactly like you set up your /var/Multimedia). You can change the scan path for each user from the admin panel

brimwats1 commented 3 years ago

Did you enable any of the Nextcloud integration options in LibrePhotos? If so you should disable them. By default, nothing at all should be stored in /home/yunohost.app/librephotos/data/nextcloud_media, and LibrePhotos should scan photos from /home/yunohost.multimedia/<username>/Picture (/home/yunohost.multimedia is a standard directory that many YunoHost packages use, it's set up almost exactly like you set up your /var/Multimedia). You can change the scan path for each user from the admin panel

Well I only enabled them in that I tried to fill them out in the previous page. But that doesn't work because it won't save the password. I've tried deleting it, presing cancel, etc, and all it does it automatically refill it

Jules-Bertholet commented 3 years ago

I would guess this is an upstream bug, you will want to report it there. You can remove your Nextcloud credentials from your account manually with:

sudo sudo -u librephotos bash
/opt/yunohost/librephotos/bin/librephotos-cli shell
from django.contrib.auth import get_user_model
User = get_user_model()
user = User.objects.get(username='your_username')
user.nextcloud_app_password = None
user.nextcloud_scan_directory = None
user.nextcloud_server_address = None
user.nextcloud_username = None
user.save()
exit()
exit
brimwats1 commented 3 years ago

thanks! I'll try reinstalling

brimwats1 commented 3 years ago

I tried reinstalling but still cannot change anything in admin area :(

Jules-Bertholet commented 3 years ago

What happens when you try? Can you post a screenshot?

brimwats1 commented 3 years ago

Step 1 image

Step 2 image

Step 3. Refresh Step 4: it's still the same: image

brimwats1 commented 3 years ago

I then tried to make a symlink:

ln -s /home/yunohost.multimedia/briwats/Picture /var/Multimedia/Picture

then I tried "scan photos: and still nothing

Jules-Bertholet commented 3 years ago

Can the librephotos user read the /var/Multimedia folder?

brimwats1 commented 3 years ago

I don't know, that's what I'm asking, what I missed because I feel like I did 😢

I did this

sudo su
usermod librephotos -a -G multimedia
# Set permissions
chown librephotos:multimedia -R /var/Multimedia
find /var/Multimedia -type d -exec chmod 0775 {} \;
find /var/Multimedia -type f -exec chmod 0664 {} \;
setfacl -d -m u::rwX,g::rwX,o::r /var/Multimedia
# Restart services
systemctl restart nginx
systemctl restart php7.3-fpm
systemctl restart php7.4-fpm
systemctl restart librephotos

but it's not working so I feel like I am missing something

Jules-Bertholet commented 3 years ago

I think it may be that in your setfacl command you are not giving traverse permissions for directories to other. To match the permissions of yunohost.multimedia you want sudo setfacl -nR -m g:multimedia:rwX,g::rwX,o:r-X -m d:g:multimedia:rwX,g::rwX,o:r-X "/var/Multimedia"

Jules-Bertholet commented 3 years ago

You can always test with sudo sudo -u librephotos ls /var/Multimedia/Picture

brimwats1 commented 3 years ago

sudo sudo -u librephotos ls /var/Multimedia/Picture

works! shows all the directories

I think it may be that in your setfacl command you are not giving traverse permissions for directories to other. To match the permissions of yunohost.multimedia you want sudo setfacl -nR -m g:multimediaA:rwX,g::rwX,o:r-X -m d:g:multimediaA:rwX,g::rwX,o:r-X "/var/Multimedia"

I tried this

setfacl -nR -m g:multimediaA:rwX,g::rwX,o:r-X -m d:g:multimediaA:rwX,g::rwX,o:r-x "/var/Multimedia"                                       
setfacl: Option -m: Invalid argument near character 3 

i noticed you had a cap A at the end of multimediA, so I removed that it and reran. The terminal seemed to be thinking for a bit. I then restarted everything via services webadmin and still get the same problem

Jules-Bertholet commented 3 years ago

Maybe check journalctl, or the logfiles under /var/log/librephotos? Otherwise I am stumped

brimwats1 commented 3 years ago

Nothing there except system starting stuff :(

Jules-Bertholet commented 3 years ago

One last thing to try:

sudo sudo -u librephotos bash
/opt/yunohost/librephotos/bin/librephotos-cli shell
from django.contrib.auth import get_user_model
User = get_user_model()
user = User.objects.get(username='briwats')
user.scan_directory = '/var/Multimedia/Picture'
user.save()
exit()
exit
brimwats1 commented 3 years ago

!! for the first time it's doing something!

image

brimwats1 commented 3 years ago

it seems to be working now, but there's almost 100k photos for it to go through, so I'll report back! Thanks so much for the help!