AnalogJ / scrutiny

Hard Drive S.M.A.R.T Monitoring, Historical Trends & Real World Failure Thresholds
MIT License
5.02k stars 164 forks source link

[BUG] Permissions of Influxdb folder do not follow PUID/PGID set in the docker-compose file #362

Open garret opened 2 years ago

garret commented 2 years ago

I ran scrutiny with such docker-compose scheme on my raspberry pi 4b (4GB):

    scrutiny:
        cap_add:
            - SYS_RAWIO
        ports:
            - 8123:8080
        environment:
            - PUID=${PUID}
            - PGID=${PGID}
            - TZ=${TIMEZONE}
        volumes:
            - /run/udev:/run/udev:ro
            - ${CONFIG_FOLDER}/scrutiny/config:/opt/scrutiny/config
            - ${CONFIG_FOLDER}/scrutiny/influxdb:/opt/scrutiny/influxdb
        devices:
            - /dev/sdb
        container_name: scrutiny
        restart: unless-stopped
        image: ghcr.io/analogj/scrutiny:master-omnibus

Since it was introduced the influxdb database I now encounter the issue that the /opt/scrutiny/influxdb folder is not locally saved after my PUID and PGID settings (set in an .env file next to my docker-compose file). That is not the case for the /opt/scrutiny/config folder which instead respects the PUID and PGID settings.

I tried adding user: ${PUID}:${PGID} in the docker-compose but in that way scrutiny does not event start.

Do you know how to solve such issue?

AnalogJ commented 1 year ago

Unfortunately Scrutiny doesn't support the PUID and PGID env variables (I'm guessing you set them up for the LSIO image?)

I'd be happy to add support for those variables, would you be willing to open a PR? I think you can start with setting permissions in a https://github.com/AnalogJ/scrutiny/tree/master/rootfs/etc/cont-init.d file.

garret commented 1 year ago

Unfortunately, I am everything except a programmer so I can't contribute with any PR. I can see that the permission issues started when influxdb was introduced. If I connect scrutiny to another container running influxdb, maybe I can solve the issue this wasy?

adripo commented 1 year ago

Copying from the older version of linuxserver's images should do the job: https://github.com/linuxserver/docker-baseimage-alpine/blob/4af8d4292fad7fc653eedcafd6a0443edfc1f288/root/etc/cont-init.d/10-adduser

adripo commented 1 year ago

@AnalogJ please have a look at my PR. I haven't tested the build yet.