laur89 / docker-seedbox-rclone-fetch-extract

Dockerised service pulling data from remote seedbox & extracting archives
10 stars 3 forks source link

DEST_FINAL is not writable #3

Open Caledrith opened 11 months ago

Caledrith commented 11 months ago

I apologize if there is something about docker I don't understand, but I attempted to build a docker compose yml to run this container.

version: "2.1"
  services:
    seedbox-fetcher:
      container_name: seedbox-fetcher
      image: layr/seedbox-rclone-fetch-extract
      environment:
       - REMOTE=seedbox
       - SRC_DIR=/torrents/rtorrent
       - DEST_INITIAL=/path/to/initial
       - DEST_FINAL=/path/to/final
       - PUID=1000 
       - PGID=1000
    volumes:
     - /media:/data 
     - /path/to/config:/config 

(1000:1000 is my normal user on the vm)

When I locally use the config file (which is contained on my vm) to sync, it works. In the container logs, the container gives me this log essentially over and over

crond: USER abc pid 1184 cmd sync.sh sendmail: can't connect to remote host (127.0.0.1): Connection refused

When I use sudo docker exec -it --user abc seedbox-fetcher /bin/sh to get into the container, I get the following error when I run ./sync.sh

[sync-34] ERROR DEST_FINAL /path/to/final] is not writable

This seems insane to me as the /path/to/final permissions are drwxrwxrwt 2 abc abc 4096 Dec 23 08:23 Downloads (I realize this is insecure, I just have been beating my head against the wall about this forever).

When I execute just echo "$DEST_FINAL is $( [[ -w "$DEST_FINAL" ]] && echo "writable" || echo "not writable" )", I get that the folder is writable. Only within the script does it fail, and I've altered the script to export the condition that's giving this error in common.sh.

Is there something I'm missing?

laur89 commented 11 months ago

Could you post the actual contents of the compose file? Current example shows no volume mapping for /path/to/{initial,final}. Also ls -lt output of said folders would be nice to verify dir permissions.

Caledrith commented 11 months ago
version: "2.1"
  services:
    seedbox-fetcher:
        container_name: seedbox-fetcher
        image: layr/seedbox-rclone-fetch-extract
        environment:
         - REMOTE=seedbox
         - SRC_DIR=/torrents/rtorrent
         - DEST_INITIAL=/data/rclone-tmp
         - DEST_FINAL=/data/Downloads
         - PUID=1000
         - PGID=1000
        volumes:
         - /media:/data 
         - /home/jmnemelka/.config/rclone:/config

/media on my vm is a mount of my NAS. docker is my vm name. As you can see, I've completely removed file restrictions from almost everything image 1000 (the PUID/PGID in my compose) is that of my user. image Screenshot of confirmed permissions inside container image

laur89 commented 5 months ago

@Caledrith did you manage to get down to this? Back then was unable to reproduce it in any way.

Caledrith commented 5 months ago

So sorry, I haven't touched it since I got frustrated haha. I'll see if I can check it out today.

Caledrith commented 4 months ago

I finally got around to finding a solution, but I'm not happy with it.

Inside of common.sh is the validate_config_common() function, and for whatever reason, on the [[ -w "$DEST_FINAL" ]] and [[ -w "$DEST_INITIAL" ]] calls fails. When I run the commands via the terminal, it works, but not when it runs via the script. I deleted the two lines and the sync is working properly. I verified the right user and right user permissions are being utilized, and in the terminal, whether I use root or abc it works. Very strange behavior.