luigi311 / JellyPlex-Watched

Sync watched between jellyfin and plex locally
GNU General Public License v3.0
398 stars 22 forks source link

[Feature Request] Allow specifying PUID and PGID (which I think will resolve permission issue with mounted folder in docker) #166

Closed convexshiba closed 2 months ago

convexshiba commented 5 months ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Running service with docker on Unraid, I want to be able to allow writing logs into a mounted file/folder.

When specify log location to /tmp/log.log, and then mount /tmp/jellyplextmp:/tmp, this will incur

Traceback (most recent call last):
  File "/app/main.py", line 11, in <module>
    main()
  File "/app/src/main.py", line 412, in main
    logger(error, log_type=2)
  File "/app/src/functions.py", line 35, in logger
    file = open(logfile, "a", encoding="utf-8")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/tmp/log.log'

Describe the solution you'd like A clear and concise description of what you want to happen.

Somehow allow logs to write to a mounted folder in which can be located in Array, instead of insider docker fs.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Thanks!

luigi311 commented 5 months ago

This is definitely something i need to implement, ive never really worked on PUID and PGID support in any of my containers so ive been pushing it off for a while now. Ill see what i can do with it and hopefully in a way that doesnt break existing setups.

gab9281 commented 3 months ago

Until it is resolved (podman can be changed for docker):

I've ran the software without mount:

# !/bin/bash 
podman run --rm -it \
  --name jellyplex-watched \
docker.io/luigi311/jellyplex-watched:latest

Then i started a terminal : podman container exec -it jellyplex-watched /bin/bash

then i've checked for the container main user id : cat /etc/passwd

image

Then changed the permission of my logs folder: chown -R 100:101 $(pwd)/logs

Just remount your logs:

# !/bin/bash 
podman run --rm -it \
  --name jellyplex-watched \
  --label io.containers.autoupdate=registry \
  -v "$(pwd)/.env:/app/.env" \
  -v "$(pwd)/logs:/log" \
ghcr.io/luigi311/jellyplex-watched:latest

Have a great day!

luigi311 commented 2 months ago

Can you guys try the puid_pgid branch? ghcr.io/luigi311/jellyplex-watched:puid_pgid