Stremio / server-docker

Builds and publishes Docker image for new releases of server.js
GNU General Public License v2.0
113 stars 20 forks source link

Access not from `localhost` #3

Closed yellowhat closed 1 year ago

yellowhat commented 1 year ago

Hi, I would like to run server-docker on a separate PC.

I run:

git clone https://github.com/stremio/server-docker --depth 1
cd server-docker
podman build --build-arg VERSION=v4.19.0 -t stremio/server:latest .
podman run -it --rm -p 11470:11470 stremio/server:latest

If I access localhost:11470, it redirects to https://app.strem.io/shell-v4.4/?streamingServer=http%3A%2F%2Flocalhost%3A11470#/, and I can play video.

Instead I access 192.168.178.21:11470 (computer IP), it redirects to https://app.strem.io/shell-v4.4/?streamingServer=http%3A%2F%2F192.168.178.21%3A11470#/, under "Settings" > "Streaming" > "Streaming server URL" is http://192.168.178.21:11470 but it shows Streaming server is not available.

I do not think that it is a firewall problem as I can:

$ curl http://192.168.178.21:11470/settings
{"options":[{"id":"localAddonEnabled","label":"ENABLE_LOCAL_FILES_ADDON","type":"checkbox"},{"id":"remoteHttps","label":"ENABLE_REMOTE_HTTPS_CONN","type":"select","class":"https","icon":true,"selections":[{"name":"Disabled","val":""},{"name":"10.0.2.100","val":"10.0.2.100"}]},{"id":"cacheSize","label":"CACHING","type":"select","class":"caching","icon":true,"selections":[{"name":"no caching","val":0},{"name":"2GB","val":2147483648},{"name":"5GB","val":5368709120},{"name":"10GB","val":10737418240},{"name":"∞","val":null}]}],"values":{"serverVersion":"4.19.0","appPath":"/root/.stremio-server","cacheRoot":"/root/.stremio-server","cacheSize":2147483648,"btMaxConnections":55,"btHandshakeTimeout":20000,"btRequestTimeout":4000,"btDownloadSpeedSoftLimit":2621440,"btDownloadSpeedHardLimit":3670016,"btMinPeersForStable":5,"remoteHttps":"","localAddonEnabled":false},"baseUrl":"http://10.0.2.100:11470"}

I get the same behaviour with:

podman run -it --rm -p 11470:11470 -e NO_CORS=1 stremio/server:latest

Any suggestions?

Thanks

raverydavis commented 1 year ago

This should do it (also using Podman) Dockerfile

# Base image
FROM node:16-alpine AS base

WORKDIR /srv/
RUN apk add --no-cache git wget

#########################################################################

# Builder image
FROM base AS builder-web

WORKDIR /srv/
RUN git clone https://github.com/Stremio/stremio-web.git

WORKDIR /srv/stremio-web
RUN npm install
RUN npm run build

##########################################################################

# Get server - this can be combined with below - useful if you clone from git
FROM base AS builder-service

ARG VERSION=v4.20.1
ARG BUILD=desktop

WORKDIR /srv/stremio-service

RUN wget https://dl.strem.io/server/${VERSION}/${BUILD}/server.js

##########################################################################

# Main image
FROM node:16-alpine

WORKDIR /srv/stremio
COPY ./stremio-web-service-run.sh ./
RUN chmod +x *.sh
COPY --from=builder-web /srv/stremio-web/build ./build
COPY --from=builder-service /srv/stremio-service ./
RUN npm install -g http-server

ENV NO_CORS=1

# Expose default ports
EXPOSE 11470 8080

CMD ["./stremio-web-service-run.sh"]

stremio-web-service-run.sh

#!/bin/sh -e

http-server build/ -p 8080 -d false &
node server.js

docker-compose.yml

version: "3.9"

services:
  stremio-web:
    image: stremio
    build:
      context: ./roles/docker/files
      dockerfile: stremio.Dockerfile
    container_name: stremio-web-service
    ports:
      - 8080:8080 # stremio-web
      - 11470:11470 # stremio-service
    volumes:
      - /some/mount/point/:/root/.stremio-server
    restart: unless-stopped

Run with docker-compose up --build

img

image
yellowhat commented 1 year ago

Thank you very much.

I manage to use the "official" server-docker via:

podman run -it --rm -p 8080:8080 node:alpine sh -c """
apk add git
git clone https://github.com/stremio/stremio-web --depth 1
cd stremio-web
npm install
npm run build
npm install -g http-server
http-server build/ -p 8080 -d false
"""

# Server
git clone https://github.com/stremio/server-docker --depth 1
cd server-docker
podman build --build-arg VERSION=v4.20.1 -t stremio/server:latest .
podman run -it --rm -p 11470:11470 -e NO_CORS=1 stremio/server:latest