From d825a31d0847c1b588e400ce97dc54292d14113c Mon Sep 17 00:00:00 2001 From: girst Date: Sat, 25 Jul 2020 17:22:35 +0200 Subject: [PATCH] better document standalone modules --- README.md | 13 +++++++++++++ config/startup.sh | 2 ++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index d9013f1..beb0d6d 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ TODO: - invidious search: api returns 'nice' author strings (e.g. numberphile instead of UC...) if not channel_id.match(...): redirect('/user/...') (in invidious blueprint) - subscription button not in invidious blueprint; should also work for playlists + - sometimes we cache broken video-urls!! stuff to look at: - app.config.from_pyfile('the-config.cfg') @@ -111,3 +112,15 @@ that looks like this: Then from the `sqlite3` console, issue: .mode csv .import guest.csv subscriptions + +## Running modules on different Hosts + +The `webhooks` and `proxy` modules support being ran standalone on a different +machine. For this, remove them from `config.ini`'s `[frontend]modules` and +start them using gunicorn by replacing `app:app` with (e.g.) +`app.webhooks:app()` (the parenthesis are required, as those use the factory +pattern to not uselessly instantiate the Flask app object if it wouldn't be +needed). An example is given in `startup.sh`. + +Note that the proxy endpoint can't reliably access ip-restricted streams if its +IP is different to the frontend's. diff --git a/config/startup.sh b/config/startup.sh index 863e2a1..f78b94f 100755 --- a/config/startup.sh +++ b/config/startup.sh @@ -7,6 +7,8 @@ CONFIG_DIR="/opt/yt/config/" export YT_CONFIG="$CONFIG_DIR/config.ini" PATH="$VENV_DIR/bin" gunicorn --config="$CONFIG_DIR/gunicorn-frontend-config.py" --chdir="$MOD_DIR" --daemon app:app + +# If you intend to run the webhooks on a different port/machine (remove otherwise): PATH="$VENV_DIR/bin" gunicorn --config="$CONFIG_DIR/gunicorn-webhooks-config.py" --chdir="$MOD_DIR" --daemon 'app.webhooks:app()' # hacky redirect to https, optional: -- 2.39.3