Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filebot not found because its in a Docker container #36

Open
vakrolme opened this issue Jul 26, 2018 · 4 comments
Open

Filebot not found because its in a Docker container #36

vakrolme opened this issue Jul 26, 2018 · 4 comments

Comments

@vakrolme
Copy link

vakrolme commented Jul 26, 2018

Hi, thanks for the plugin.

I am getting "Filebot not found", and the plugin turns off in the preferences on each system restart.

I am running my setup on an armv7 NAS, so to avoid dealing with compilation, I run Deluge as a container and Filebot as another container. The filebot command in the Deluge container is aliased to run filebot in the Filebot container (by binding with host machine's Docker process). So running filebot -version from inside the Deluge container gives a few seconds lag, but other than that there's no difference from running it natively (AFAIK). Now, I'm not sure how find_executable works, so I tried to dupe the plugin by appending PATH with a fake path, gave more privileges to deluged — still, my limited knowledge of Linux is insufficient to solve this.

Is it possible to make this setup work?

Here's my deluge image:

FROM lsioarmhf/deluge
RUN apk update
RUN apk add docker
RUN apk update
RUN apk add openrc --no-cache
RUN rc-update add docker boot
RUN echo 'alias filebot="docker exec filebot filebot"' >> ~/.bashrc

CMD export PATH=$PATH:$ADDITIONAL_PATH; /bin/echo -e "ADDITIONAL_PATH is $ADDITIONAL_PATH\nPATH is $PATH"

RUN chown root:root /usr/bin/deluge
RUN chmod 4755 /usr/bin/deluge

Docker-compose:

version: '2'
services:
  filebot:
    image: filebot
    command: tail -F anything
    volumes:
      - /share/Kevin:/Kevin
  deluge:
    image: deluged:latest
    privileged: true
    command: tail -F anything
    volumes:
      - f966a27a1b07c155350094f94e986c07faef0746c3638455a63165f22ffad30f:/config
      - 6ddcd2b08cfa8025b0a2b3ed1dc9fd51dd44f26afa9caf66b0a5ee69080d0c29:/downloads
      - /share/Kevin:/Kevin
      - "/var/run/docker.sock:/var/run/docker.sock"
    #environment:
      #- ADDITIONAL_PATH=/usr/bin/filebot
    ports:
      - "1791:1791"
      - "1792:1792"
      - "1776:58846"
      - "58946:58946"
      - "8112:8112"
@Laharah
Copy link
Owner

Laharah commented Jul 26, 2018

I wish I could say I'm more versed in the intricacies of calling docker processes from other docker processes, so it's quite possible that there's something in there preventing the call that I can't help you with.

I see that you change the owner and the permissions on the deluge bin to have the setuid and setgid permissions, but are you sure that deluge is running with root permissions, and that that user has the required permissions to call filebot? In general, if the user in a simple shell can use the filebot -version command, then filebot should be in the path and the plugin should be able to find filebot too.

Looking closer, I'm pretty sure that the alias you're using won't help the deluged process. As far as I know, .bashrc only gets run when an interactive shell is started, not for other processes. So while filebot -version will work fine for a shell, it won't for any applications looking for a filebot command.

You could try substituting your alias with a basic shell script at /usr/bin/filebot that passes everything along to the filebot container:

#!/bin/bash
docker exec filebot filebot $@

Just make sure that the script is chmodded to 755 and that it works like you expect, namely that it passes your arguments to filebot and you get back both the stdout and stderr streams. So long as that works, the plugin should be able to use it too.

@Laharah
Copy link
Owner

Laharah commented Jul 26, 2018

Forgot the last bit.

As for the part where filebottool keeps getting disabled after you restart, I'm not sure what could be causing that. I'm pretty sure there's some state file that deluge writes to keep track of what plugins are enabled or dissabled. Maybe that's either not getting saved or can't be read for some reason? I'm not entirely sure but it seems like something from the docker side of things.

@vakrolme
Copy link
Author

vakrolme commented Jul 27, 2018

Thanks for the tip on .bashrc, didn't know that.
I've updated the image like you said, so instead of aliasing it passes filebot commands to docker via script. I tested this setup on a real command filebot -get-subtitles, ran it from the Deluge container bash, it works the same as if I run it from within the Filebot container. Yet the plugin still says "Filebot not found".

Maybe there are other checks in the plugin that might give this false negative?

As for the plugin being disabled issue, sorry, I cannot reproduce it now.

UPD: in the meantime I managed to build one container with both apps, it detects Filebot as expected.

@Laharah
Copy link
Owner

Laharah commented Jul 27, 2018

I'm glad you got it working, I'm not sure what could be causing the filebot not found error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants