manyfold icon indicating copy to clipboard operation
manyfold copied to clipboard

Check file/folder permissions and raise problems if wrong

Open Floppy opened this issue 1 year ago • 1 comments

Floppy avatar Aug 08 '24 15:08 Floppy

For whoever finds this next. The owner:group is set by the envs PUID/PGID defaulting to 1000:1000.

I was using a docker volume for my libraries instead of a folder.

nas ➜  manyfold cat docker-compose.yml 
services:
  app:
    image: ghcr.io/manyfold3d/manyfold:latest
    ports:
      - 3214:3214
    volumes:
      - libraries:/libraries
    environment:
      PUID: 1000
      PGID: 1000
...
volumes:
  db_data:
  libraries:
...
nas ➜  manyfold docker volume ls | grep manyfold
local     manyfold_db_data
local     manyfold_libraries

Default service name is app

nas ➜  manyfold docker compose ps
NAME                         IMAGE                                COMMAND                  SERVICE           CREATED          STATUS          PORTS
manyfold-app-1               ghcr.io/manyfold3d/manyfold:latest   "/init"                  app               42 minutes ago   Up 42 minutes   0.0.0.0:3214->3214/tcp, :::3214->3214/tcp
manyfold-postgres-server-1   postgres:15                          "docker-entrypoint.s…"   postgres-server   42 minutes ago   Up 42 minutes   5432/tcp
manyfold-redis-server-1      redis:7                              "docker-entrypoint.s…"   redis-server      42 minutes ago   Up 42 minutes   6379/tcp

My library folder is called default

nas ➜  manyfold docker compose exec -it app mkdir /libraries/default
nas ➜  manyfold docker compose exec -it app ls -lah /libraries/               
total 16K    
drwxr-xr-x    4 root     root        4.0K Sep  1 15:18 .
drwxr-xr-x    1 root     root        4.0K Sep  1 14:40 ..
drwxr-xr-x    2 root     root        4.0K Sep  1 15:18 default
nas ➜  manyfold docker compose exec -it app chown 1000:1000 /libraries/default
nas ➜  manyfold docker compose exec -it app ls -lah /libraries/                
total 16K    
drwxr-xr-x    4 root     root        4.0K Sep  1 15:18 .
drwxr-xr-x    1 root     root        4.0K Sep  1 14:40 ..
drwxr-xr-x    2 1000     1000        4.0K Sep  1 15:18 default
nas ➜  manyfold 

PhilipWhiteside avatar Sep 01 '24 15:09 PhilipWhiteside

@Floppy , just wanted to get some clarity on this issue. This feature is so that when Rails starts up, it throws a warning or error log to report that the libraries cannot be written to? Or is it for other folders?

You added the ability to check if the library path is writable when it has been created. Would that fulfill this feature or did you have something else in mind?

I started looking into using writable? but according to the docs, some file systems may incorrectly return true.

Another method I was thinking was to create a temp file in the library folders. If it couldn't File.touch(tmpfile) correctly, it could rescue from an error. I feel this would be more consistent but wanted to get your thoughts on this.

matthewbadeau avatar Apr 21 '25 10:04 matthewbadeau

Basically I want to be able to check that all model folders (and the library) are writable; it's easy to end up with the wrong permissions on a few folders. We could use a file touch if there's no safe other way, I guess.

Floppy avatar Apr 22 '25 16:04 Floppy