From 464401a924ffc15ae1b86a7ef445857c1c6c24fb Mon Sep 17 00:00:00 2001 From: root Date: Sat, 14 Sep 2024 20:29:49 -0300 Subject: [PATCH] Set materialious in different folder, same for valkey to spread the cache between invidious instances + others. --- invidious/invidious-vpn/docker-compose.yml | 65 +++++----- invidious/invidious-vpn/haproxy/haproxy.cfg | 3 +- invidious/invidious/docker-compose.yml | 116 +++--------------- invidious/invidious/haproxy/haproxy.cfg | 2 +- invidious/materialious/docker-compose.yml | 26 ++++ invidious/valkey-invidious/docker-compose.yml | 30 +++++ invidious/valkey-invidious/valkey.conf | 2 + 7 files changed, 117 insertions(+), 127 deletions(-) create mode 100644 invidious/materialious/docker-compose.yml create mode 100644 invidious/valkey-invidious/docker-compose.yml create mode 100644 invidious/valkey-invidious/valkey.conf diff --git a/invidious/invidious-vpn/docker-compose.yml b/invidious/invidious-vpn/docker-compose.yml index e0c8ffe..18273b0 100644 --- a/invidious/invidious-vpn/docker-compose.yml +++ b/invidious/invidious-vpn/docker-compose.yml @@ -1,16 +1,18 @@ # Docker compose file for ${DOMAIN} services: - valkey: - image: valkey/valkey:7.2-alpine - container_name: invidious-valkey-vpn - restart: unless-stopped - volumes: - - invidious-valkey-vpn:/data" - networks: - gluetun_network: - ipv4_address: 172.80.0.20 - + # valkey: + # image: valkey/valkey:7.2-alpine + # container_name: invidious-valkey-vpn + # restart: unless-stopped + # volumes: + # - invidious-valkey-vpn:/data" + # - ./valkey.conf:/usr/local/etc/valkey/valkey.conf + # command: "valkey-server /usr/local/etc/valkey/valkey.conf" + # networks: + # gluetun_network: + # ipv4_address: 172.80.0.20 + # INVIDIOUS CLEARNET invidious: env_file: @@ -32,15 +34,16 @@ services: # port: 5432 port: 3000 database_url: postgres://kemal:kemal@/invidious - redis_url: tcp://172.80.0.20:6379 + redis_url: tcp://valkey:6379 donation_url: "https://nadeko.net/donate" contact_url: "https://nadeko.net/contact" home_domain: "nadeko.net" materialious_domain: "materialious.nadeko.net" full_refresh: false - https_only: true + https_only: ${HTTPS_ONLY} hmac_key: "${HMAC_KEY}" domain: "${DOMAIN}" + alternative_domains: ["inv.nadeko.net", "inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion", "zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p", "inv.zzls.i2p"] use_pubsub_feeds: true popular_enabled: true captcha_enabled: true @@ -89,7 +92,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "172.80.0.30:12999" depends_on: - - valkey + # - valkey - inv_sig_helper - gluetun healthcheck: @@ -119,15 +122,16 @@ services: # port: 5432 port: 3001 database_url: postgres://kemal:kemal@/invidious - redis_url: tcp://172.80.0.20:6379 + redis_url: tcp://valkey:6379 donation_url: "https://nadeko.net/donate" contact_url: "https://nadeko.net/contact" home_domain: "nadeko.net" materialious_domain: "materialious.nadeko.net" full_refresh: false - https_only: true + https_only: ${HTTPS_ONLY} hmac_key: "${HMAC_KEY}" domain: "${DOMAIN}" + alternative_domains: ["inv.nadeko.net", "inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion", "zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p", "inv.zzls.i2p"] use_pubsub_feeds: true popular_enabled: true captcha_enabled: true @@ -176,7 +180,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "172.80.0.30:12999" depends_on: - - valkey + # - valkey - inv_sig_helper - gluetun healthcheck: @@ -206,15 +210,16 @@ services: # port: 5432 port: 3002 database_url: postgres://kemal:kemal@/invidious - redis_url: tcp://172.80.0.20:6379 + redis_url: tcp://valkey:6379 donation_url: "https://nadeko.net/donate" contact_url: "https://nadeko.net/contact" home_domain: "nadeko.net" materialious_domain: "materialious.nadeko.net" full_refresh: false - https_only: true + https_only: ${HTTPS_ONLY} hmac_key: "${HMAC_KEY}" domain: "${DOMAIN}" + alternative_domains: ["inv.nadeko.net", "inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion", "zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p", "inv.zzls.i2p"] use_pubsub_feeds: true popular_enabled: true captcha_enabled: true @@ -263,7 +268,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "172.80.0.30:12999" depends_on: - - valkey + # - valkey - inv_sig_helper - gluetun healthcheck: @@ -293,15 +298,16 @@ services: # port: 5432 port: 3003 database_url: postgres://kemal:kemal@/invidious - redis_url: tcp://172.80.0.20:6379 + redis_url: tcp://valkey:6379 donation_url: "https://nadeko.net/donate" contact_url: "https://nadeko.net/contact" home_domain: "nadeko.net" materialious_domain: "materialious.nadeko.net" full_refresh: false - https_only: true + https_only: ${HTTPS_ONLY} hmac_key: "${HMAC_KEY}" domain: "${DOMAIN}" + alternative_domains: ["inv.nadeko.net", "inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion", "zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p", "inv.zzls.i2p"] use_pubsub_feeds: true popular_enabled: true captcha_enabled: true @@ -350,7 +356,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "172.80.0.30:12999" depends_on: - - valkey + # - valkey - inv_sig_helper - gluetun healthcheck: @@ -380,15 +386,16 @@ services: # port: 5432 port: 3004 database_url: postgres://kemal:kemal@/invidious - redis_url: tcp://172.80.0.20:6379 + redis_url: tcp://valkey:6379 donation_url: "https://nadeko.net/donate" contact_url: "https://nadeko.net/contact" home_domain: "nadeko.net" materialious_domain: "materialious.nadeko.net" full_refresh: false - https_only: true + https_only: ${HTTPS_ONLY} hmac_key: "${HMAC_KEY}" domain: "${DOMAIN}" + alternative_domains: ["inv.nadeko.net", "inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion", "zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p", "inv.zzls.i2p"] use_pubsub_feeds: true popular_enabled: true captcha_enabled: true @@ -437,7 +444,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "172.80.0.30:12999" depends_on: - - valkey + # - valkey - inv_sig_helper - gluetun healthcheck: @@ -467,15 +474,16 @@ services: # port: 5432 port: 3005 database_url: postgres://kemal:kemal@/invidious - redis_url: tcp://172.80.0.20:6379 + redis_url: tcp://valkey:6379 donation_url: "https://nadeko.net/donate" contact_url: "https://nadeko.net/contact" home_domain: "nadeko.net" materialious_domain: "materialious.nadeko.net" full_refresh: false - https_only: true + https_only: ${HTTPS_ONLY} hmac_key: "${HMAC_KEY}" domain: "${DOMAIN}" + alternative_domains: ["inv.nadeko.net", "inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion", "zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p", "inv.zzls.i2p"] use_pubsub_feeds: true popular_enabled: true captcha_enabled: true @@ -524,7 +532,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "172.80.0.30:12999" depends_on: - - valkey + # - valkey - inv_sig_helper - gluetun healthcheck: @@ -556,6 +564,7 @@ services: haproxy: image: haproxy:lts-alpine container_name: invidious-haproxy-vpn + restart: unless-stopped ports: # Invidious - "127.0.0.1:10055:8001" diff --git a/invidious/invidious-vpn/haproxy/haproxy.cfg b/invidious/invidious-vpn/haproxy/haproxy.cfg index 863097e..cb57283 100644 --- a/invidious/invidious-vpn/haproxy/haproxy.cfg +++ b/invidious/invidious-vpn/haproxy/haproxy.cfg @@ -14,7 +14,7 @@ defaults mode http timeout client 10s timeout connect 10s - timeout server 5s + timeout server 30s timeout http-request 10s # Prometheus for graphs @@ -72,6 +72,7 @@ backend invidious option redispatch 2 backend http3-proxy + timeout server 15s # Caches video thumbnails, profile pictures and others http-request cache-use invidious-thumbnail-cache if { path_beg /vi/ } http-response cache-store invidious-thumbnail-cache diff --git a/invidious/invidious/docker-compose.yml b/invidious/invidious/docker-compose.yml index 507efdb..9daacab 100644 --- a/invidious/invidious/docker-compose.yml +++ b/invidious/invidious/docker-compose.yml @@ -1,32 +1,25 @@ # Docker compose file for inv.nadeko.net services: - valkey: - image: valkey/valkey:7.2-alpine - container_name: invidious-valkey - restart: unless-stopped - volumes: - - invidious-valkey:/data" - - invidious-refresher: - image: "git.nadeko.net/fijxu/invidious:${TAG}" - container_name: invidious-refresher - restart: unless-stopped - volumes: - - ./config/config-refresher.yml:/etc/invidious/config.yml:ro - - /var/run/postgresql/.s.PGSQL.5432:/var/run/postgresql/.s.PGSQL.5432:rw - environment: - INVIDIOUS_CONFIG_FILE: /etc/invidious/config.yml - depends_on: - - valkey - # - invidious-pgbouncer + # Not needed since PubSubHubBub is the one that pushes updates to invidious + # invidious-refresher: + # image: "git.nadeko.net/fijxu/invidious:${TAG}" + # container_name: invidious-refresher + # restart: unless-stopped + # volumes: + # - ./config/config-refresher.yml:/etc/invidious/config.yml:ro + # - /var/run/postgresql/.s.PGSQL.5432:/var/run/postgresql/.s.PGSQL.5432:rw + # environment: + # INVIDIOUS_CONFIG_FILE: /etc/invidious/config.yml + # depends_on: + # - valkey + # # - invidious-pgbouncer # INVIDIOUS CLEARNET invidious: env_file: - .env image: "git.nadeko.net/fijxu/invidious:${TAG}" - # container_name: invidious restart: unless-stopped deploy: replicas: 6 @@ -53,6 +46,7 @@ services: https_only: true hmac_key: "${HMAC_KEY}" domain: "inv.nadeko.net" + alternative_domains: ["inv.nadeko.net", "inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion", "zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p", "inv.zzls.i2p"] use_pubsub_feeds: true popular_enabled: true captcha_enabled: true @@ -77,7 +71,7 @@ services: banner: "${BANNER}" player_style: invidious quality: hd720 - quality_dash: auto + quality_dash: 720p default_home: Popular feed_menu: ["Popular", "Trending", "Subscriptions", "Playlists"] automatic_instance_redirect: true @@ -101,7 +95,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "inv_sig_helper:12999" depends_on: - - valkey + # - valkey - inv_sig_helper healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1 @@ -109,7 +103,6 @@ services: timeout: 5s retries: 2 - # INVIDIOUS TOR invidious-tor: env_file: @@ -190,7 +183,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "inv_sig_helper:12999" depends_on: - - valkey + # - valkey - inv_sig_helper healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1 @@ -279,7 +272,7 @@ services: visitor_data: "${VISITOR_DATA}" signature_server: "inv_sig_helper:12999" depends_on: - - valkey + # - valkey - inv_sig_helper healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1 @@ -324,78 +317,6 @@ services: # gluetun_network: # ipv4_address: 172.80.0.22 - # INVIDIOUS VALKEY METRICS - invidious-redis-exporter: - image: oliver006/redis_exporter - container_name: invidious-redis-exporter - restart: unless-stopped - ports: - - "127.0.0.1:9121:9121" - command: "--redis.addr=redis://valkey:6379" - - # MATERIALIOUS - materialious: - image: wardpearce/materialious:latest - container_name: materialious - restart: unless-stopped - ports: - - "127.0.0.1:10013:80" - environment: - VITE_DEFAULT_DEARROW_THUMBNAIL_INSTANCE: "https://dearrow-thumb.ajay.app" - #VITE_DEFAULT_SYNCIOUS_INSTANCE: "https://syncious.nadeko.net" - VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE: "https://returnyoutubedislikeapi.com" - VITE_DEFAULT_PEERJS_PATH: "/" - VITE_DEFAULT_PEERJS_HOST: "peerjs.nadeko.net" - VITE_DEFAULT_SPONSERBLOCK_INSTANCE: "https://sponsor.ajay.app" - VITE_DEFAULT_DEARROW_INSTANCE: "https://sponsor.ajay.app" - VITE_DEFAULT_INVIDIOUS_INSTANCE: "https://inv.nadeko.net" - VITE_DEFAULT_PEERJS_PORT: 443 - VITE_DEFAULT_SETTINGS: '{"darkMode": true, "themeColor": "#FFB3FD", "autoPlay": true, "alwaysLoop": false, "proxyVideos": false, "listenByDefault": false, "savePlaybackPosition": true, "dashEnabled": true, "theatreModeByDefault": false, "autoplayNextByDefault": true, "returnYtDislikes": true, "searchSuggestions": true, "previewVideoOnHover": true, "sponsorBlock": true, "sponsorBlockCategories": "sponsor,interaction,selfpromo", "deArrowEnabled": false, "playerMiniPlayer": true, "syncious": false}' - - # MATERIALIOUS TOR - materialious-tor: - image: wardpearce/materialious:latest - container_name: materialious-tor - restart: unless-stopped - ports: - - 127.0.0.1:10070:80 - environment: - VITE_DEFAULT_DEARROW_THUMBNAIL_INSTANCE: "https://dearrow-thumb.ajay.app" - #VITE_DEFAULT_SYNCIOUS_INSTANCE: "https://syncious.nadeko.net" - VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE: "https://returnyoutubedislikeapi.com" - VITE_DEFAULT_PEERJS_PATH: "/" - VITE_DEFAULT_PEERJS_HOST: "peerjs.nadeko.net" - VITE_DEFAULT_SPONSERBLOCK_INSTANCE: "https://sponsor.ajay.app" - VITE_DEFAULT_DEARROW_INSTANCE: "https://sponsor.ajay.app" - VITE_DEFAULT_INVIDIOUS_INSTANCE: "http://inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion" - VITE_DEFAULT_PEERJS_PORT: 443 - VITE_DEFAULT_SETTINGS: '{"darkMode": true, "themeColor": "#FFB3FD", "autoPlay": true, "alwaysLoop": false, "proxyVideos": false, "listenByDefault": false, "savePlaybackPosition": true, "dashEnabled": true, "theatreModeByDefault": false, "autoplayNextByDefault": true, "returnYtDislikes": true, "searchSuggestions": true, "previewVideoOnHover": true, "sponsorBlock": true, "sponsorBlockCategories": "sponsor,interaction,selfpromo", "deArrowEnabled": false, "playerMiniPlayer": true, "syncious": false}' - - - # API EXTENDED IS BROKEN - # api_extended: - # env_file: - # - .env - # image: wardpearce/invidious_api_extended:latest - # restart: unless-stopped - # ports: - # - 127.0.0.1:10014:80 - # volumes: - # - /var/run/postgresql/.s.PGSQL.5432:/var/run/postgresql/.s.PGSQL.5432:rw - # environment: - # api_extended_postgre: "${PGSQL_DB}" - # api_extended_allowed_origins: '["https://materialious.nadeko.net/"]' - # api_extended_debug: false - # api_extended_invidious_instance: "https://invidious.nadeko.net" - # api_extended_production_instance: "https://syncious.nadeko.net" - - peerjs: - image: peerjs/peerjs-server:latest - container_name: invidious-peerjs - restart: unless-stopped - ports: - - 127.0.0.1:10015:9000 - # SIGNATURE HELPER inv_sig_helper: image: quay.io/invidious/inv-sig-helper @@ -419,6 +340,7 @@ services: haproxy: image: haproxy:lts-alpine container_name: invidious-haproxy + restart: unless-stopped ports: # Invidious - "127.0.0.1:10011:8001" diff --git a/invidious/invidious/haproxy/haproxy.cfg b/invidious/invidious/haproxy/haproxy.cfg index a4e38f5..a76ad84 100644 --- a/invidious/invidious/haproxy/haproxy.cfg +++ b/invidious/invidious/haproxy/haproxy.cfg @@ -14,7 +14,7 @@ defaults mode http timeout client 10s timeout connect 10s - timeout server 5s + timeout server 30s timeout http-request 10s # Prometheus for graphs diff --git a/invidious/materialious/docker-compose.yml b/invidious/materialious/docker-compose.yml new file mode 100644 index 0000000..71bee3a --- /dev/null +++ b/invidious/materialious/docker-compose.yml @@ -0,0 +1,26 @@ +services: + # MATERIALIOUS + materialious: + image: wardpearce/materialious:latest + container_name: materialious + restart: unless-stopped + ports: + - "127.0.0.1:10013:80" + environment: + VITE_DEFAULT_DEARROW_THUMBNAIL_INSTANCE: "https://dearrow-thumb.ajay.app" + #VITE_DEFAULT_SYNCIOUS_INSTANCE: "https://syncious.nadeko.net" + VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE: "https://returnyoutubedislikeapi.com" + VITE_DEFAULT_PEERJS_PATH: "/" + VITE_DEFAULT_PEERJS_HOST: "peerjs.nadeko.net" + VITE_DEFAULT_SPONSERBLOCK_INSTANCE: "https://sponsor.ajay.app" + VITE_DEFAULT_DEARROW_INSTANCE: "https://sponsor.ajay.app" + VITE_DEFAULT_INVIDIOUS_INSTANCE: "https://inv.nadeko.net" + VITE_DEFAULT_PEERJS_PORT: 443 + VITE_DEFAULT_SETTINGS: '{"darkMode": true, "themeColor": "#FFB3FD", "autoPlay": true, "alwaysLoop": false, "proxyVideos": false, "listenByDefault": false, "savePlaybackPosition": true, "dashEnabled": true, "theatreModeByDefault": false, "autoplayNextByDefault": true, "returnYtDislikes": true, "searchSuggestions": true, "previewVideoOnHover": true, "sponsorBlock": true, "sponsorBlockCategories": "sponsor,interaction,selfpromo", "deArrowEnabled": false, "playerMiniPlayer": true, "syncious": false}' + + peerjs: + image: peerjs/peerjs-server:latest + container_name: invidious-peerjs + restart: unless-stopped + ports: + - 127.0.0.1:10015:9000 diff --git a/invidious/valkey-invidious/docker-compose.yml b/invidious/valkey-invidious/docker-compose.yml new file mode 100644 index 0000000..1e063e1 --- /dev/null +++ b/invidious/valkey-invidious/docker-compose.yml @@ -0,0 +1,30 @@ +services: + # One valkey instance for all invidious instances, to share cache and prevent duplicates + valkey: + image: valkey/valkey:7.2-alpine + restart: unless-stopped + volumes: + - ./valkey.conf:/usr/local/etc/valkey/valkey.conf + command: "valkey-server /usr/local/etc/valkey/valkey.conf" + networks: + - invidious-vpn + - invidious + - gluetun_network + + # INVIDIOUS VALKEY METRICS + invidious-redis-exporter: + image: oliver006/redis_exporter + restart: unless-stopped + ports: + - "127.0.0.1:9121:9121" + command: "--redis.addr=redis://valkey:6379" + networks: + - invidious + +networks: + invidious-vpn: + external: true + invidious: + external: true + gluetun_network: + external: true diff --git a/invidious/valkey-invidious/valkey.conf b/invidious/valkey-invidious/valkey.conf new file mode 100644 index 0000000..5ae2643 --- /dev/null +++ b/invidious/valkey-invidious/valkey.conf @@ -0,0 +1,2 @@ +maxmemory 1024mb +maxmemory-policy volatile-ttl