sungshon / PimpMyStremio

Local add-on manager for Stremio
MIT License
382 stars 52 forks source link

Add docker support (closes #82) #85

Closed sleeyax closed 4 years ago

sleeyax commented 4 years ago

Not sure where and how you want to update the docs so here's a snippet from my README:

Usage

docker run -v <data path>:/root/.local/share/PimpMyStremio/ <sideloaded addons path>:/app/sideloaded -p [<host ip>:]<host port>:7777 --build-arg version=<PMS version to use> sleeyax/pimpmystremio

Examples

Quick start:

docker run -p 7777:7777 sleeyax/pimpmystremio

Advanced:

docker run -v ~/Documents/PimpMyStremio/data:/root/.local/share/PimpMyStremio/ ~/Documents/PimpMyStremio/sideloaded:/app/sideloaded -p 127.0.0.1:7777:7777 --build-arg version=1.2.2 sleeyax/pimpmystremio

After running any of the commands above, PMS should should be available at http://localhost:7777 .


On a sidenote I don't think PMS supports specifying a different port yet, but this Dockerfile assumes it does (to be ready for the future). Though you'll only have to change ENTRYPOINT ["/app/PimpMyStremio", "--sideload=", "/app/sideloaded", "--verbose"] to ENTRYPOINT /app/PimpMyStremio --sideload= /app/sideloaded --port ${port} --verbose or something alike.

sungshon commented 4 years ago

Thanks, I'll think of where to add some docs for it.

adocampo commented 4 years ago

I think you cannot pass the --build-arg flag to a docker command, it says:

unknown flag: --build-arg version

That mustn't be specified only inside a Dockerfile?

PS: I ran the docker command without it and it just starts, but doesn't works:

First, I see a concerning message on docker logs, don't know if is meaningful, but is scary at least, as is related to libstdc++

/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)

Secondly, I configured Jackket addon, by accessing the PMS through the server_ip:7777 and configuring the addon, copying the URL and pasting on my PC' stremio, but thi error appears:

No playable URL found in the clipboard. Please copy a URL (e.g. a magnet link) to a video.

But opening that URL on a browser, I can reach indeed a json: image

Thirdly, I configured PMS to be LAN accesible, but "Save and Restart" option just stops the container and when I docker start it again, it stills listens on 127.0.0.1:7777 and my "domain IP" is the docker IP (172.17.0.4), this is the docker log

/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
PimpMyStremio - Checking for updates
PimpMyStremio - Already have latest version
PimpMyStremio - User defined add-ons list URL is valid, updating add-ons list
PimpMyStremio - Successfully updated add-ons list from remote source
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
Remote access choice: LAN
Domain IP: 172.17.0.4
Error: Unexpected body from HTTP request
    at needle.then (/snapshot/src/lib/https.js:65:12)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
Add-on running: BoredLama/stremio-jackett-local
PimpMyStremio server running at: http://127.0.0.1:7777
/root/.local/share/PimpMyStremio/assets/forked-systray/systrayhelper: error while loading shared libraries: libappindicator3.so.1: cannot open shared object file: No such file or directory

So, while it seems promising, still doesn't works as expected

Thank you!

sleeyax commented 4 years ago

I think you cannot pass the --build-arg flag to a docker command, it says:

Ah yes, my bad. ARG seems to be a build time only parameter (docker build --build-arg version=x to build a specific image works). A better solution would be to use ENV, so you can set an environment variable at runtime like docker run -e version=x. But actually it doesn't really matter anyways because I just noticed the auto updater updates to the latest version automatically¯_(ツ)_/¯

First, I see a concerning message on docker logs, don't know if is meaningful, but is scary at least, as is related to libstdc++

Yup you'll get those a lot of those but during my testing it didn't cause major trouble so it should be safe to ignore.

Secondly, I configured Jackket addon, by accessing the PMS through the server_ip:7777 and configuring the addon, copying the URL and pasting on my PC' stremio, but thi error appears:

Weird, it prompts for addon installation just fine on my end if I just paste it in here like this and press enter screenshot

Thirdly, I configured PMS to be LAN accesible, but "Save and Restart" option just stops the container and when I docker start it again, it stills listens on 127.0.0.1:7777 and my "domain IP" is the docker IP (172.17.0.4), this is the docker log

Yeah, this is most likely the fault of the LAN/local-ip package (don't remember its exact name) that PMs uses to determine the local ip address. Technically it behaves correctly as it does in fact get the local ip of the container within its docker network but I get that's not what we want haha.

sleeyax commented 4 years ago

To add to that last part, it looks like LAN IP can be manually set using a PMS_LAN_IP environment variable: https://github.com/sungshon/PimpMyStremio/blob/5b89b8ab8c0ded1a16da06445e0c5c8bbe2d1e7f/src/index.js#L87-L97

So something like ENV PMS_LAN_IP= could work. I'll try it out now.

sleeyax commented 4 years ago

But doesn't docker run -p 7777:7777 sleeyax/pimpmystremio mean it's accessible from LAN anyways @adocampo ?

According to docker docs

Note that ports which are not bound to the host (i.e., -p 80:80 instead of -p 127.0.0.1:80:80) will be accessible from the outside.

sungshon commented 4 years ago

it looks like LAN IP can be manually set using a PMS_LAN_IP environment variable

Yes, I have anticipated this predicament. 😄

adocampo commented 4 years ago

@sleeyax, sorry for the late response, I had no time to test the enviromental var until yesterday, and it worked! I've created my docker with this line:

docker create  \
  --name pms \
  --restart=unless-stopped \
  -e PMS_LAN_IP=192.168.1.100  \
  -v /data/.docker/pimpmystremio/data:/root/.local/share/PimpMyStremio/ \
  -v /data/.docker/pimpmystremio/sideloaded:/app/sideloaded \
  -p 7777:7777 \
  sleeyax/pimpmystremio

Seems to work flawlessly ;) Thank you for bringing PMS to docker!

sleeyax commented 4 years ago

@sungshon so are you going to create an 'official' docker image (and publish it to docker hub)?

adocampo commented 4 years ago

I want to publish to the Internet my PMS to configure it into my father-in-law's stremio. I configured my router to port triggering the 7777 port, but it doesn't work

/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
/app/PimpMyStremio: /usr/lib/libstdc++.so.6: no version information available (required by /app/PimpMyStremio)
PimpMyStremio - Checking for updates
PimpMyStremio - Already have latest version
PimpMyStremio - User defined add-ons list URL is valid, updating add-ons list
PimpMyStremio - Successfully updated add-ons list from remote source
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
/root/.local/share/PimpMyStremio/assets/engine: /usr/lib/libstdc++.so.6: no version information available (required by /root/.local/share/PimpMyStremio/assets/engine)
Remote access choice: External
Retrieving external IP ...
TypeError: Cannot read property '0' of null
    at /snapshot/src/node_modules/externalip/index.js:11:52
    at Request.callback (/snapshot/src/node_modules/superagent/lib/node/index.js:0)
    at Request.<anonymous> (/snapshot/src/node_modules/superagent/lib/node/index.js:0)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Stream.<anonymous> (/snapshot/src/node_modules/superagent/lib/node/index.js:0)
    at emitNone (events.js:111:20)
    at Stream.emit (events.js:208:7)
    at Unzip.<anonymous> (/snapshot/src/node_modules/superagent/lib/node/utils.js:0)
    at emitNone (events.js:111:20)
Process exit, code: 1

Is there any possibility to make docker PMS usable from external networks? Thank you!

sleeyax commented 4 years ago

PMS remote access option is getting confused by the docker network I guess. I think if you leave the 'remote access' option to local and make sure you publish the port with docker's -p 7777:7777 parameter, it should work.

adocampo commented 4 years ago

Changing it to local and port forwarding seems to work, I can access PMS from outside image But when trying to add the addon, it fails image please note I'm on http, not https

adocampo commented 4 years ago

Ok, I'd set up my reverse proxy, which manages let's encrypt certificates, and now is working! PERFECT!

sleeyax commented 4 years ago

Yes I was about to say; stremio requires https if its not local anymore

adocampo commented 4 years ago

I'm having now issues with all the IPTV addon but if it causes a lot of trouble, I will set up another PMS docker in LAN mode just for that addon. A big thank you for all you support and the good work @sleeyax !!

chicungunya commented 4 years ago

@adocampo I tried your docker image (and it did'nt work) but I use a Raspberry Pi 3 on Raspbian, so I think I cannot use it ?

chicungunya commented 4 years ago

@sleeyax Is that working on arm raspberry ? Your docker image doesn't work for me.

Thanks a lot

sleeyax commented 4 years ago

@chicungunya you already answered your own question. If you tried and it doesnt work, then it probably doesn't work on rpi. However, what does 'doesn't work' mean? Do you get a error? Collaborate more please.