From 33d1e534166f35e4d992432b440b0c2dd37a32c8 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Thu, 2 Dec 2021 21:04:01 +0100 Subject: [PATCH] Added Invidious --- .gitignore | 1 + build.sh | 2 ++ config/invidious.yml | 33 +++++++++++++++++ docker-compose.yml | 38 ++++++++++++++++++-- invidious-postgres.env.example | 19 ++++++++++ invidious.env.example | 38 ++++++++++++++++++++ nginx.env.example | 4 +++ nginx/root/etc/nginx/conf.d/default.template | 25 +++++++++++++ 8 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 config/invidious.yml create mode 100644 invidious-postgres.env.example create mode 100644 invidious.env.example diff --git a/.gitignore b/.gitignore index 1a9ef4e..69d608b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ bibliogram/ nitter/ omgur/ +invidious/ config/ diff --git a/build.sh b/build.sh index 73171b0..3bb5e01 100755 --- a/build.sh +++ b/build.sh @@ -8,4 +8,6 @@ echo "Updating bibliogram..." ./build.updaterepo.sh https://git.sr.ht/~cadence/bibliogram bibliogram echo "Updating omgur..." ./build.updaterepo.sh https://git.geraldwu.com/gerald/omgur.git omgur +echo "Updating invidious..." +./build.updaterepo.sh https://github.com/iv-org/invidious.git invidious echo "Done." diff --git a/config/invidious.yml b/config/invidious.yml new file mode 100644 index 0000000..03ea68c --- /dev/null +++ b/config/invidious.yml @@ -0,0 +1,33 @@ +# See: https://github.com/iv-org/invidious/blob/master/config/config.example.yml + +default_user_preferences: + #locale: en-US + #region: US + #captions: ["", "", ""] + dark_mode: true + thin_mode: false + feed_menu: ["Subscriptions", "Playlists"] + default_home: + max_results: 40 + #annotations: false + #annotations_subscribed: false + comments: ["", ""] + player_style: invidious + related_videos: false + autoplay: false + continue: false + #continue_autoplay: true + listen: false + video_loop: false + quality: hd720 + #quality_dash: auto + speed: 1.0 + volume: 100 + vr_mode: true + latest_only: false + notifications_only: false + unseen_only: false + sort: published + local: true + show_nick: true + automatic_instance_redirect: false diff --git a/docker-compose.yml b/docker-compose.yml index 72ac79e..78b5936 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: expose: - "10407" volumes: - - db:/app/db + - bibliogram-db:/app/db - ./config/bibliogram.config.js:/app/config.js networks: - socials @@ -65,8 +65,42 @@ services: depends_on: - omgur-redis + invidious-postgres: + image: ${INVP_IMG:-postgres:10-alpine} + container_name: ${INVP_CONTAINER_NAME:-invidious-postgres} + restart: ${INVP_RESTART:-unless-stopped} + volumes: + - invidious-postgres-data:/var/lib/postgresql/data + - ./invidious/config/sql:/config/sql:ro + - ./invidious/docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh:ro + env_file: + - invidious-postgres.env + expose: + - 5432 + networks: + - socials + + invidious: + build: + context: invidious/ + dockerfile: docker/Dockerfile + container_name: ${INV_CONTAINER_NAME:-invidious} + restart: ${INV_RESTART:-unless-stopped} + env_file: + - invidious-postgres.env + - invidious.env + expose: + - 3000 + volumes: + - ./config/invidious.yml:/config/config.yml + networks: + - socials + depends_on: + - invidious-postgres + volumes: - db: + bibliogram-db: + invidious-postgres-data: networks: default: diff --git a/invidious-postgres.env.example b/invidious-postgres.env.example new file mode 100644 index 0000000..dd95e25 --- /dev/null +++ b/invidious-postgres.env.example @@ -0,0 +1,19 @@ +DB_USER=invidious +DB_PASSWORD=invidious +DB_HOST=invidious-postgres +DB_PORT=5432 +DB_NAME=invidious + +## Note: The 'database_url' setting allows the use of UNIX +## sockets. To do so, remove the IP address (or FQDN) and port +## and append the 'host' parameter. E.g: +## postgres://kemal:kemal@/invidious?host=/var/run/postgresql +## +## Accepted values: a postgres:// URI +## Default: postgres://kemal:kemal@localhost:5432/invidious + +INVIDIOUS_DATABASE_URL=postgres://${DB_PASSWORD}:${DB_USER}@${DB_HOST}:${DB_PORT}/${DB_NAME} + +POSTGRES_USER=${DB_USER} +POSTGRES_PASSWORD=${DB_PASSWORD} +POSTGRES_DB=${DB_NAME} diff --git a/invidious.env.example b/invidious.env.example new file mode 100644 index 0000000..0c4f91e --- /dev/null +++ b/invidious.env.example @@ -0,0 +1,38 @@ +# See: +# - https://github.com/iv-org/invidious/pull/1702 +# - https://github.com/iv-org/invidious/blob/master/config/config.example.yml + +INVIDIOUS_CONFIG_FILE="/config/config.yml" + +INVIDIOUS_CHECK_TABLES=true +INVIDIOUS_PORT=3000 +INVIDIOUS_EXTERNAL_PORT=443 +INVIDIOUS_HOST_BINDING=0.0.0.0 +INVIDIOUS_DOMAIN=domain.tld +INVIDIOUS_HTTPS_ONLY=true +INVIDIOUS_HSTS=true +INVIDIOUS_DISABLE_PROXY=false +INVIDIOUS_POOL_SIZE=100 +#INVIDIOUS_USE_QUIC=false +#INVIDIOUS_COOKIES= +#INVIDIOUS_FORCE_RESOLVE= +#INVIDIOUS_OUTPUT=STDOUT +#INVIDIOUS_LOG_LEVEL=Info +#INVIDIOUS_POPULAR_ENABLED=false +#INVIDIOUS_STATISTICS_ENABLED=false +#INVIDIOUS_REGISTRATION_ENABLED=false +INVIDIOUS_LOGIN_ENABLED=true +INVIDIOUS_CAPTCHA_ENABLED=false +#INVIDIOUS_ADMINS=[""] +INVIDIOUS_CHANNEL_THREADS=1 +#INVIDIOUS_FULL_REFRESH=false +INVIDIOUS_FEED_THREADS=1 +#INVIDIOUS_DECRYPT_POLLING=true +#INVIDIOUS_CAPTCHA_API_URL= +#INVIDIOUS_CAPTCHA_KEY= +#INVIDIOUS_BANNER= +INVIDIOUS_USE_PUBSUB_FEEDS=true +#INVIDIOUS_HMAC_KEY= +#INVIDIOUS_DMCA_CONTENT=[""] +#INVIDIOUS_CACHE_ANNOTATIONS=false +#INVIDIOUS_MODIFIED_SOURCE_CODE_URL= diff --git a/nginx.env.example b/nginx.env.example index ee2a1bc..e96abad 100644 --- a/nginx.env.example +++ b/nginx.env.example @@ -14,6 +14,10 @@ OMG_HOSTNAME= OMG_ADDR=omgur OMG_PORT=8080 +INV_HOSTNAME= +INV_ADDR=invidious +INV_PORT=3000 + NGINX_LISTEN_PORT=80 # Reverse-proxy and certbot diff --git a/nginx/root/etc/nginx/conf.d/default.template b/nginx/root/etc/nginx/conf.d/default.template index 81f3f03..9dd4086 100644 --- a/nginx/root/etc/nginx/conf.d/default.template +++ b/nginx/root/etc/nginx/conf.d/default.template @@ -27,6 +27,13 @@ upstream omgur { server ${OMG_ADDR}:${OMG_PORT}; } +upstream invidious { + # Cannot connect to network of this container + server 127.0.0.1 down; + ## Can be connected with the network + server ${INV_ADDR}:${INV_PORT}; +} + server { # This is a catch-all hostname (it will never trigger on a real hostname). # If an access by IP or by an unhandled domain linking to this IP is tried, @@ -105,3 +112,21 @@ server { } } + +server { + listen ${NGINX_LISTEN_PORT}; + server_name ${INV_HOSTNAME}; + + # Disable do not add the server version in the header + server_tokens off; + + location / { + proxy_pass http://invidious; + } + + location = /robots.txt { + add_header Content-Type text/plain; + return 200 "User-agent: *\nDisallow: /\n"; + } + +}