Skip to content

Commit

Permalink
refactor(stremio-web): update docker compose
Browse files Browse the repository at this point in the history
refactor(stremio-web): rename RUN_PATCHES env var
chore(stremio-web): update README
  • Loading branch information
n0bodysec committed Sep 28, 2022
1 parent 5f38d64 commit 558e6ec
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 18 deletions.
55 changes: 42 additions & 13 deletions stremio-web/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,54 @@
# stremio-web

Docker image for stremio-server (no-cors) and stremio-web.
This docker image contains a built copy of the open source [stremio-web](https://github.com/Stremio/stremio-web/) and a copy of the closed source [stremio-server](http://dl.strem.io/four/master/server.js).

Feel free to edit the `docker-compose.yml` to update the webpack port.

## Table of contents

- [🃏 Features](#-features)
- [🚀 Deploy](#-deploy)
- [📜 Notice](#-notice)
With this image, you can quickly deploy a ready-to-use stremio-web client and server.

## 🃏 Features

- Stremio Server (fixed CORS).
- Stremio Web Player.
- Small final image (thanks to multi-stage builds).
- Fully customizable through environment variables and bind mounts.
- Optional patches for better usability (via script).

## 🚀 Deploy

1. Edit the `docker-compose.yml` file to suit your needs (e.g. webpack port).
1. Create a `docker-compose.override.yml` file and edit it to suit your needs (***optional***).
2. Run `docker compose up -d`.

## 📜 Notice
## ⚙️ Configuration

## Best practice

Running the container with docker compose, with `APPLY_PATCHES`, `FIX_UNSUPPORTED_MEDIA` and `NO_CORS` env vars is the preferred way to go.

Example (without compose)
```console
docker run --rm -p 8080:8080 -p 11470:11470 -e APPLY_PATCHES=1 -e FIX_UNSUPPORTED_MEDIA=1 -e NO_CORS=1 -v ${PWD}:/root/.stremio-server n0bodysec/stremio
```

## Docker Compose

Using docker compose is the preferred way to go.
```shell
docker compose up -d
```

## Apply custom patches

To apply the optional patches (see `patches.sh`) you **must** set the environment variable `APPLY_PATCHES`.
```shell
docker run -e APPLY_PATCHES=1 n0bodysec/stremio
```

## Environment variables

| **Variable** | **Description** | **Source** |
|----------------------- |------------------------------------- |------------ |
| APPLY_PATCHES | Apply patches defined in patches.sh | run.sh |
| FIX_UNSUPPORTED_MEDIA | Fix for HTTP 415 | patches.sh |
| FIX_CORS | **Deprecated.** See NO_CORS | patches.sh |
| NO_CORS | Do no check CORS in the SERVER | server.js |

If you change the webpack port, remember to update the exposed docker port as well.
For more environment variables, please check the `server.js` file.
Undocumented env vars: `APPDATA`, `APP_PATH`, `BLUEBIRD_DEBUG`, `BLUEBIRD_LONG_STACK_TRACES`, `BLUEBIRD_WARNINGS`, `BLUEBIRD_W_FORGOTTEN_RETURN`, `CASTING_DISABLED`, `COLORTERM`, `DEBUG`, `DEBUG_COLORS`, `DEBUG_COLORS`, `DEBUG_DEPTH`, `DEBUG_FD`, `DEBUG_MIME`, `DEBUG_SHOW_HIDDEN`, `DISABLE_CACHING`, `DISABLE_CACHING`, `FFMPEG_BIN`, `FFMPEG_DEBUG`, `FFSPLIT_DEBUG`, `FORCE_COLOR`, `HOME`, `HTTPS_CERT_ENDPOINT`, `NODE_DEBUG`, `NODE_ENV`, `NO_CORS`, `NO_DEPRECATION`, `OPEN`, `OSTYPE`, `PATHEXT`, `PORT`, `READABLE_STREAM`, `SUDO_USER`, `SystemRoot`, `TEMP`, `TERM`, `TMP`, `TMPDIR`, `TRACE_DEPRECATION`, `TV_ENV`, `WEBUI_LOCATION`, `YTDL_NO_UPDATE`, `npm_config_arch`, `npm_config_platform`,
`windir`
15 changes: 15 additions & 0 deletions stremio-web/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.9'

services:
stremio:
image: stremio
build: .
ports:
- '11470:11470'
- '8080:8080'
volumes:
- ./data/:/root/.stremio-server
environment:
APPLY_PATCHES: 1
FIX_UNSUPPORTED_MEDIA: 1
NO_CORS: 1
6 changes: 3 additions & 3 deletions stremio-web/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ version: '3.9'

services:
stremio:
image: stremio
build: .
image: n0bodysec/stremio
ports:
- '11470:11470'
- '8080:8080'
volumes:
- ./data/:/root/.stremio-server
environment:
RUN_PATCHES: 1
APPLY_PATCHES: 1
FIX_UNSUPPORTED_MEDIA: 1
NO_CORS: 1
2 changes: 1 addition & 1 deletion stremio-web/patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Only if you re-use containers (please do not do that)
cp server/server.js.bak server/server.js

# Deprecated?
# Fix for HTTP 415 Unsupported Media Type
if [[ ${FIX_UNSUPPORTED_MEDIA:-0} -eq 1 ]]; then
echo "Applying patch for HTTP 415 Unsupported Media Type..."
sed -i -E "s|(var first = req\.params\.first)|if (req.params.first === 'hlsv2') { req.params.first = req.query.mediaURL.split('/')[3]; req.params.second = req.query.mediaURL.split('/')[4]; }\n \1|" server/server.js
Expand Down
2 changes: 1 addition & 1 deletion stremio-web/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

if [[ ${RUN_PATCHES:-0} -eq 1 ]]; then
if [[ ${APPLY_PATCHES:-0} -eq 1 ]]; then
echo "Applying patches..."
chmod +x ./patches.sh
sh ./patches.sh
Expand Down

0 comments on commit 558e6ec

Please sign in to comment.